GCF::QmlApplication Class Reference
Offers an application object for GCF QML applications. More...
#include <GCF3/QmlApplication>
Public Member Functions | |
QmlApplication (int &argc, char **argv) | |
~QmlApplication () | |
int | processArgumentsAndExec (const QStringList &additionalArgs=QStringList()) |
![]() | |
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 |
Additional Inherited Members | |
![]() | |
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... | |
![]() | |
QmlApplicationServices () | |
~QmlApplicationServices () | |
virtual void | initQmlEngine (QQmlEngine *) |
![]() | |
ApplicationServices () | |
virtual | ~ApplicationServices () |
Detailed Description
This class implements both QGuiApplication
and GCF::QmlApplicationServices. The only function it offers is processArgumentsAndExec(). You must create an instance of this class if you are building a QML application in GCF and call the GCF::QmlApplicationServices::setQmlEngine() method to set a QML engine for your application. Shown below is a typical main()
function in a QML application
#include <GCF3/QmlApplication>
#include <GCF3/QmlComponent>
int main(int argc, char **argv)
{
GCF::QmlApplication a(argc, argv);
QQuickView qmlView;
// This part is very important. You must
// set a QML engine with the application!
a.setQmlEngine(qmlView.engine());
....
....
....
return a.processArgumentsAndExec();
}
- Note
- This class is available only if GCF is compiled and linked against Qt 5.
- Qml applications cannot use QtWidgets module
Constructor & Destructor Documentation
GCF::QmlApplication::QmlApplication | ( | int & | argc, |
char ** | argv | ||
) |
Constructor.
- Parameters
-
argc reference to an integer that holds number of command-line arguments passed to the applicaiton. argv pointer to an array of character strings that hold the command-line arguments.
GCF::QmlApplication::~QmlApplication | ( | ) |
Destructor
Member Function Documentation
void GCF::QmlApplication::processArgumentsAndExec | ( | const QStringList & | additionalArgs = QStringList() | ) |
Process all arguments from qApp->arguments()
and additionalArgs
and invokes QApplication::exec().