LeechCraft  0.6.70-15082-g543737046d
Modular cross-platform feature rich live environment.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules
LC::QuarkComponent Class Reference

Describes a single quark. More...

#include "iquarkcomponentprovider.h"

+ Collaboration diagram for LC::QuarkComponent:

Public Member Functions

 QuarkComponent ()=default
 Initializes a null quark component. More...
 
 QuarkComponent (QuarkComponent &&other)=default
 Move-constructs this quark component from other. More...
 
QuarkComponentoperator= (QuarkComponent &&other)=default
 Move-assigns this quark component from other. More...
 
 QuarkComponent (const QString &subdir, const QString &filename)
 Initializes a quark component for the given file path. More...
 

Public Attributes

QUrl Url_
 URL of the main QML of this file. More...
 
QList< QPair< QString, QObject * > > DynamicProps_
 Dynamic properties to be exposed to the engine. More...
 
std::vector< std::pair< QString, std::unique_ptr< QObject > > > ContextProps_
 Context-depended properties to be exposed to the engine. More...
 
QList< QPair< QString, QVariant > > StaticProps_
 Statis properties to be exposed to the engine. More...
 
QList< QPair< QString, QQuickImageProvider * > > ImageProviders_
 The image providers to be exposed to the engine. More...
 

Detailed Description

Describes a single quark.

A single quark can be loaded in several different views at the same time. Each view defines a quark context. For example, the same panel of SB2 will have different contexts for different windows.

Communicating with C++

Quarks may want to communicate with the C++ part of the providing plugin. Quark properties serve exactly this purpose.

Context-dependent and shareable properties

Different views can share some properties and may need to have different others according to the quark context. Shareable properties should be listed in DynamicProps_ and StaticProps_, while unique per-view properties should be listed in ContextProps_. Context per-view properties will be destroyed if the quark is removed from the view.

In other words, ownership of shareable properties is left for the quark component provider, while ownership of the context-dependent properties is transferred to the calling view.

See also
IQuarkComponentProvider

Definition at line 50 of file iquarkcomponentprovider.h.

Constructor & Destructor Documentation

◆ QuarkComponent() [1/3]

LC::QuarkComponent::QuarkComponent ( )
default

Initializes a null quark component.

◆ QuarkComponent() [2/3]

LC::QuarkComponent::QuarkComponent ( QuarkComponent &&  other)
default

Move-constructs this quark component from other.

The other quark component is in unspecified state after the move and can only be destructed.

Parameters
[in]otherThe quark component to move from.

◆ QuarkComponent() [3/3]

LC::QuarkComponent::QuarkComponent ( const QString &  subdir,
const QString &  filename 
)
inline

Initializes a quark component for the given file path.

This utility constructor provides an easy way to create a quark component for a QML file located in the Util::SysPath::QML location under the given subdir and filename.

For example, if a plugin installs its quark file QuarkName.qml contained in directory pluginName via

install (DIRECTORY pluginName DESTINATION ${LC_QML_DEST})

then proper QuarkComponent will be initialized by calling

QuarkComponent { "pluginName", "QuarkName.qml" }

.

See also
Util::GetSysPath()

Definition at line 125 of file iquarkcomponentprovider.h.

Member Function Documentation

◆ operator=()

QuarkComponent& LC::QuarkComponent::operator= ( QuarkComponent &&  other)
default

Move-assigns this quark component from other.

The other quark component is in unspecified state after the move and can only be destructed.

Parameters
[in]otherThe quark component to move from.
Returns
A reference to this quark component.

Member Data Documentation

◆ ContextProps_

std::vector<std::pair<QString, std::unique_ptr<QObject> > > LC::QuarkComponent::ContextProps_

Context-depended properties to be exposed to the engine.

Definition at line 70 of file iquarkcomponentprovider.h.

◆ DynamicProps_

QList<QPair<QString, QObject*> > LC::QuarkComponent::DynamicProps_

Dynamic properties to be exposed to the engine.

Definition at line 66 of file iquarkcomponentprovider.h.

◆ ImageProviders_

QList<QPair<QString, QQuickImageProvider*> > LC::QuarkComponent::ImageProviders_

The image providers to be exposed to the engine.

The list contains pairs of a QString and an image provider. Each image provider is added to the engine under the name in the corresponding QString upon addng the quark to the view.

Definition at line 85 of file iquarkcomponentprovider.h.

◆ StaticProps_

QList<QPair<QString, QVariant> > LC::QuarkComponent::StaticProps_

Statis properties to be exposed to the engine.

These properties are set once upon adding quark to a view, and they are not modified further.

Definition at line 77 of file iquarkcomponentprovider.h.

◆ Url_

QUrl LC::QuarkComponent::Url_

URL of the main QML of this file.

This file will be loaded to the corresponding declarative view via a Loader or similar methods. It can be both a local file and a remote resource.

Url_ + ".manifest" is also expected to exist, and it is a manifest file that describes the quark.

Definition at line 62 of file iquarkcomponentprovider.h.


The documentation for this class was generated from the following file:
LC::QuarkComponent::QuarkComponent
QuarkComponent()=default
Initializes a null quark component.