Base-class for GCF::QmlApplication. More...
#include <GCF3/QmlApplication>
Public Member Functions | |
void | setQmlEngine (QQmlEngine *engine) |
QQmlEngine * | qmlEngine () const |
![]() | |
QDateTime | launchTimestamp () const |
ObjectTree * | objectTree () const |
QObject * | findObject (const QString &path) const |
void | loadComponent (Component *component) |
void | unloadComponent (Component *component) |
QObjectList | components () const |
void | activateComponent (Component *component) |
void | deactivateComponent (Component *component) |
bool | isLoaded (const Component *component) const |
bool | isActive (const Component *component) const |
void | unloadAllComponents () |
Component * | instantiateComponent (const QString &library) |
Component * | loadComponent (const QString &library) |
Component * | loadComponent (const QString &library, const QList< QPair< QByteArray, QVariant > > &properties) |
QList< Component * > | loadComponents (const QStringList &libraries) |
QVariantMap | argumentsMap () const |
void | processArguments (const QStringList &additionalArgs=QStringList()) |
GCF::Result | invokeMethod (const QString &path, const QString &method, const QVariantList &args, bool secureCall=true) const |
This method can be used to invoke a named method in an object. More... | |
GCF::JobListModel * | jobs () const |
QString | translate (const QString &string) const |
Static Public Member Functions | |
static QmlApplicationServices * | instance () |
![]() | |
static GCF::Result | invokeMethod (QObject *object, const QString &method, const QVariantList &args, bool secureCall=true) |
This method can be used to invoke a named method in an object. More... | |
static GCF::Result | invokeMethod (QObject *object, const QMetaMethod &method, const QVariantList &args, bool secureCall=true) |
This method can be used to invoke a named method in an object. More... | |
Protected Member Functions | |
QmlApplicationServices () | |
~QmlApplicationServices () | |
virtual void | initQmlEngine (QQmlEngine *) |
![]() | |
ApplicationServices () | |
virtual | ~ApplicationServices () |
Detailed Description
This class extends GCF::ApplicationServices by offering certain Qml specific application services in addition to what the base class offers. Its subclass GCF::QmlApplication should be instantiated for writing QML+GCF applications. Whenever an instance of GCF::QmlApplication is created, you must call the setQmlEngine() method to set the application engine that will be used by your QML application.
You will never have to use this class directly, because in most cases you will create an instance of GCF::QmlApplication and use that. There is one exception though: read documentation for initQmlEngine() to know more.
- Note
- This class is available only if GCF is compiled and linked against Qt 5.
Constructor & Destructor Documentation
|
protected |
Constructor
|
protected |
Destructor
Member Function Documentation
|
static |
This function returns pointer to the only instance of GCF::QmlApplicationServices in the application. The function returns NULL if no such instance was created.
void GCF::QmlApplicationServices::setQmlEngine | ( | QQmlEngine * | engine | ) |
Using this function you can set the QML engine for use with your GCF application. This function has to be called before any QML code is loaded and evaluated by the engine.
- Parameters
-
engine pointer to a QQmlEngine
that needs to be set as GCF's Qml engine
Example:
This function sets two context-properties on the engine's root-context.
gApp
- references the GCF application objectgcf
- references an internal GCF object that offers the following methodsfindObject(string)
: returns an object at the specified pathfindImplementation(string)
: returns an object that implements the specified class/interfacefindImplementations(string)
: returns all objects that implement the specified class/interfaceaddQmlItem(string,object)
: adds a QML item to the object tree with the first parameter as name. Once added, the item will be exposed as"Application.{name}"
removeQmlItem(string)
: removes a QML item, whose name is specified in the parameter, from the object tree
engine
.
- Note
- this function can be called only once. Once the engine is set, further calls to this function become a no-op.
QQmlEngine * GCF::QmlApplicationServices::qmlEngine | ( | ) | const |
Returns pointer to the QQmlEngine
that was set using the setQmlEngine() method. NULL pointer if no engine was set.
|
protectedvirtual |
You can reimplement this function to customize the initialization of the QQmlEngine
passed as paramete to this function. This function is called from setQmlEngine(). By the time this function is called, the gcf
and gApp
context properties have already been set.
The default implementation does nothing.