LeechCraft  0.6.70-3565-g2d86529
Modular cross-platform feature rich live environment.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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_
 Statis properties to be exposed to the engine. More...
 
QList< QPair< QString,
QDeclarativeImageProvider * > > 
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 73 of file iquarkcomponentprovider.h.

Constructor & Destructor Documentation

LeechCraft::QuarkComponent::QuarkComponent ( )
inline

Initializes a null quark component.

Definition at line 116 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 135 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 145 of file iquarkcomponentprovider.h.

References ContextProps_.

Member Data Documentation

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

Context-depended properties to be exposed to the engine.

Definition at line 93 of file iquarkcomponentprovider.h.

Referenced by ~QuarkComponent().

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

Dynamic properties to be exposed to the engine.

Definition at line 89 of file iquarkcomponentprovider.h.

QList<QPair<QString, QDeclarativeImageProvider*> > LeechCraft::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 109 of file iquarkcomponentprovider.h.

QList<QPair<QString, QVariant> > LeechCraft::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 100 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 85 of file iquarkcomponentprovider.h.


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