diff options
author | Alessandro Portale <alessandro.portale@qt.io> | 2018-02-05 22:41:48 +0100 |
---|---|---|
committer | Alessandro Portale <alessandro.portale@qt.io> | 2018-02-06 09:50:02 +0000 |
commit | 3f757998b5aafccfe2793f1838e833cc56ff22a9 (patch) | |
tree | 09732b3536957beaf8a8618d249473aaea430691 /share/qtcreator | |
parent | 3f87c4685e3d93522e8cad11a725dd193156d20d (diff) |
Revert "Wizards: Accept asynchronous root components for qqapplication"
This reverts commit dcb8681cb79cb91df14bc051025a1bf9705f7c84.
The effort to handle asynchronous loading is not required for the
qmllivepreview (for which it had been introduced).
Task-number: QTCREATORBUG-19648
Change-Id: I20cbd318dedb3da43d4993c0c0a1910ffe6d5761
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'share/qtcreator')
-rw-r--r-- | share/qtcreator/templates/wizards/projects/qtquickapplication/main.cpp | 22 |
1 files changed, 3 insertions, 19 deletions
diff --git a/share/qtcreator/templates/wizards/projects/qtquickapplication/main.cpp b/share/qtcreator/templates/wizards/projects/qtquickapplication/main.cpp index a562da6d5d5..986dcd606f1 100644 --- a/share/qtcreator/templates/wizards/projects/qtquickapplication/main.cpp +++ b/share/qtcreator/templates/wizards/projects/qtquickapplication/main.cpp @@ -20,25 +20,9 @@ int main(int argc, char *argv[]) QGuiApplication app(argc, argv); QQmlApplicationEngine engine; - - const QUrl mainQml(QStringLiteral("qrc:/main.qml")); - - // Catch the objectCreated signal, so that we can determine if the root component was loaded - // successfully. If not, then the object created from it will be null. The root component may - // get loaded asynchronously. - const QMetaObject::Connection connection = QObject::connect( - &engine, &QQmlApplicationEngine::objectCreated, - &app, [&](QObject *object, const QUrl &url) { - if (url != mainQml) - return; - - if (!object) - app.exit(-1); - else - QObject::disconnect(connection); - }, Qt::QueuedConnection); - - engine.load(mainQml); + engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); + if (engine.rootObjects().isEmpty()) + return -1; return app.exec(); } |