LeechCraft  %{LEECHCRAFT_VERSION}
Modular cross-platform feature rich live environment.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
LeechCraft::QuarkComponent Class Reference

Describes a single quark. More...

#include "iquarkcomponentprovider.h"

+ Collaboration diagram for LeechCraft::QuarkComponent:

Public Member Functions

 QuarkComponent ()
 Initializes a null quark component. More...
 
 QuarkComponent (const QString &subdir, const QString &filename)
 Initializes a quark component for the given file path. More...
 
 ~QuarkComponent ()
 Destroys the quark. 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...
 
QList< QPair< QString, QObject * > > ContextProps_
 Context-depended properties to be exposed to the engine. More...
 
QList< QPair< QString, QVariant > > StaticProps_
 
QList< QPair< QString,
QDeclarativeImageProvider * > > 
ImageProviders_
 

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 69 of file iquarkcomponentprovider.h.

Constructor & Destructor Documentation

LeechCraft::QuarkComponent::QuarkComponent ( )
inline

Initializes a null quark component.

Definition at line 95 of file iquarkcomponentprovider.h.

LeechCraft::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 114 of file iquarkcomponentprovider.h.

LeechCraft::QuarkComponent::~QuarkComponent ( )
inline

Destroys the quark.

Destroys the quark and all context-specific properties listed in the ContextProps_ list.

Definition at line 124 of file iquarkcomponentprovider.h.

Member Data Documentation

QList<QPair<QString, QObject*> > LeechCraft::QuarkComponent::ContextProps_

Context-depended properties to be exposed to the engine.

Definition at line 89 of file iquarkcomponentprovider.h.

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

Dynamic properties to be exposed to the engine.

Definition at line 85 of file iquarkcomponentprovider.h.

QList<QPair<QString, QDeclarativeImageProvider*> > LeechCraft::QuarkComponent::ImageProviders_

Definition at line 91 of file iquarkcomponentprovider.h.

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

Definition at line 90 of file iquarkcomponentprovider.h.

QUrl LeechCraft::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 81 of file iquarkcomponentprovider.h.


The documentation for this class was generated from the following file: