-
Book Overview & Buying
-
Table Of Contents
Application Development with Qt Creator - Second Edition
You can run a simple Qt Quick application using the qmlviewer application, an application provided as part of the Qt SDK. However, most of the time, you'll create a Qt Quick application using the Qt Quick application wizard in Qt Creator, which results in a hybrid application consisting of a Qt C++ application container and QML files as resources that the application loads and plays at runtime.
If we take a look at main.cpp in a project that we create with this wizard, we will see the following code:
#include <QGuiApplication>
#include <QQmlApplicationEngine>
int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
QQmlApplicationEngine engine;
engine.load(QUrl(QStringLiteral("qrc:///main.qml")));
return app.exec();
}This is pretty straightforward: it creates an instance of QQmlApplicationEngine, a class that inherits from QGuiApplication, and instantiates a top-level window containing a single instance of QQmlEngine, the Qt Quick...