Revert "Wizards: Accept asynchronous root components for qqapplication"

This reverts commit dcb8681cb7.

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>
This commit is contained in:
Alessandro Portale
2018-02-05 22:41:48 +01:00
parent 3f87c4685e
commit 3f757998b5

View File

@@ -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();
}