forked from qt-creator/qt-creator
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:
@@ -20,25 +20,9 @@ int main(int argc, char *argv[])
|
|||||||
QGuiApplication app(argc, argv);
|
QGuiApplication app(argc, argv);
|
||||||
|
|
||||||
QQmlApplicationEngine engine;
|
QQmlApplicationEngine engine;
|
||||||
|
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
|
||||||
const QUrl mainQml(QStringLiteral("qrc:/main.qml"));
|
if (engine.rootObjects().isEmpty())
|
||||||
|
return -1;
|
||||||
// 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);
|
|
||||||
|
|
||||||
return app.exec();
|
return app.exec();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user