| 1 | // Copyright (C) 2020 The Qt Company. |
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
| 3 | |
| 4 | #include <QGuiApplication> |
| 5 | #include <QQmlApplicationEngine> |
| 6 | |
| 7 | int main(int argc, char* argv[]) |
| 8 | { |
| 9 | QGuiApplication app(argc, argv); |
| 10 | |
| 11 | QQmlApplicationEngine engine; |
| 12 | const QUrl url(QStringLiteral("qrc:/main.qml")); |
| 13 | QObject::connect(&engine, &QQmlApplicationEngine::objectCreated, |
| 14 | &app, [url](QObject *obj, const QUrl &objUrl) { |
| 15 | if (!obj && url == objUrl) |
| 16 | QCoreApplication::exit(-1); |
| 17 | }, Qt::QueuedConnection); |
| 18 | engine.load(url); |
| 19 | |
| 20 | return app.exec(); |
| 21 | } |