Difference between QQmlApplicationEngine and QtQuick2ApplicationViewer



  • I started developing my app with Qt 5.1. So I created a new QtQuick Application with the QtCreator wizard. The Application is started with the following code in main.cpp:

    @#include <QtGui/QGuiApplication>
    #include "qtquick2applicationviewer.h"

    int main(int argc, char *argv[])
    {
    QGuiApplication app(argc, argv);

    QtQuick2ApplicationViewer viewer;
    viewer.setMainQmlFile&#40;QStringLiteral("qml/MyApp/main.qml"&#41;&#41;;
    viewer.showExpanded();
    
    return app.exec&#40;&#41;;
    

    }@

    Now with Qt 5.3 I created a new QtQuick Application with the QtCreator wizard and the startup process has changed in main.cpp:

    @#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&#40;&#41;;
    

    }
    @

    Are there any important differences between the startup strategies, like performance impacts? My Application runs on Android, if that matters.



  • You can run QML profiler to test the speed.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.