From 3f757998b5aafccfe2793f1838e833cc56ff22a9 Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Mon, 5 Feb 2018 22:41:48 +0100 Subject: [PATCH] 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 --- .../projects/qtquickapplication/main.cpp | 22 +++---------------- 1 file 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(); }