diff options
author | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2015-07-28 12:54:03 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2015-08-25 11:30:42 +0000 |
commit | c4a911e564cfccfcd0c1e98a1baa8c25b91a085b (patch) | |
tree | 4ce1b03a301bd6eda59fa648e22639838cc9f5b6 /examples | |
parent | 66b68ed94032e03b7a0ed9d15f72b1fc5e2cb729 (diff) | |
download | qtquickcontrols-c4a911e564cfccfcd0c1e98a1baa8c25b91a085b.tar.gz |
Make examples return -1 on load failures.
Avoid hanging processes and empty windows in case some module is not
installed.
Change-Id: Ib220a6251076fd1fdbd126524a723d5c3f94bfb9
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@theqtcompany.com>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/quick/controls/basiclayouts/src/main.cpp | 2 | ||||
-rw-r--r-- | examples/quick/controls/calendar/src/main.cpp | 2 | ||||
-rw-r--r-- | examples/quick/controls/filesystembrowser/main.cpp | 2 | ||||
-rw-r--r-- | examples/quick/controls/gallery/main.cpp | 2 | ||||
-rw-r--r-- | examples/quick/controls/styles/main.cpp | 3 | ||||
-rw-r--r-- | examples/quick/controls/texteditor/src/main.cpp | 2 | ||||
-rw-r--r-- | examples/quick/controls/touch/src/main.cpp | 2 | ||||
-rw-r--r-- | examples/quick/controls/uiforms/main.cpp | 2 | ||||
-rw-r--r-- | examples/quick/dialogs/systemdialogs/main.cpp | 2 | ||||
-rw-r--r-- | examples/quick/extras/dashboard/main.cpp | 2 | ||||
-rw-r--r-- | examples/quick/extras/flat/main.cpp | 2 | ||||
-rw-r--r-- | examples/quick/extras/gallery/main.cpp | 2 |
12 files changed, 24 insertions, 1 deletions
diff --git a/examples/quick/controls/basiclayouts/src/main.cpp b/examples/quick/controls/basiclayouts/src/main.cpp index bb4b3bdd..e66387f7 100644 --- a/examples/quick/controls/basiclayouts/src/main.cpp +++ b/examples/quick/controls/basiclayouts/src/main.cpp @@ -45,5 +45,7 @@ int main(int argc, char *argv[]) { QtQuickControlsApplication app(argc, argv); QQmlApplicationEngine engine(QUrl("qrc:/main.qml")); + if (engine.rootObjects().isEmpty()) + return -1; return app.exec(); } diff --git a/examples/quick/controls/calendar/src/main.cpp b/examples/quick/controls/calendar/src/main.cpp index 6b3c058a..bab7e4b2 100644 --- a/examples/quick/controls/calendar/src/main.cpp +++ b/examples/quick/controls/calendar/src/main.cpp @@ -48,5 +48,7 @@ int main(int argc, char *argv[]) QtQuickControlsApplication app(argc, argv); qmlRegisterType<SqlEventModel>("org.qtproject.examples.calendar", 1, 0, "SqlEventModel"); QQmlApplicationEngine engine(QUrl("qrc:/qml/main.qml")); + if (engine.rootObjects().isEmpty()) + return -1; return app.exec(); } diff --git a/examples/quick/controls/filesystembrowser/main.cpp b/examples/quick/controls/filesystembrowser/main.cpp index ac24bada..e9c63c20 100644 --- a/examples/quick/controls/filesystembrowser/main.cpp +++ b/examples/quick/controls/filesystembrowser/main.cpp @@ -143,6 +143,8 @@ int main(int argc, char *argv[]) engine.rootContext()->setContextProperty("fileSystemModel", fsm); engine.rootContext()->setContextProperty("rootPathIndex", fsm->index(fsm->rootPath())); engine.load(QUrl(QStringLiteral("qrc:///main.qml"))); + if (engine.rootObjects().isEmpty()) + return -1; return app.exec(); } diff --git a/examples/quick/controls/gallery/main.cpp b/examples/quick/controls/gallery/main.cpp index 4c254a4e..ac3f447d 100644 --- a/examples/quick/controls/gallery/main.cpp +++ b/examples/quick/controls/gallery/main.cpp @@ -52,5 +52,7 @@ int main(int argc, char *argv[]) QSurfaceFormat::setDefaultFormat(fmt); } QQmlApplicationEngine engine(QUrl("qrc:/main.qml")); + if (engine.rootObjects().isEmpty()) + return -1; return app.exec(); } diff --git a/examples/quick/controls/styles/main.cpp b/examples/quick/controls/styles/main.cpp index 1f6684a6..55c592e6 100644 --- a/examples/quick/controls/styles/main.cpp +++ b/examples/quick/controls/styles/main.cpp @@ -47,6 +47,7 @@ int main(int argc, char *argv[]) QQmlApplicationEngine engine; engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); - + if (engine.rootObjects().isEmpty()) + return -1; return app.exec(); } diff --git a/examples/quick/controls/texteditor/src/main.cpp b/examples/quick/controls/texteditor/src/main.cpp index 160e6a9a..1ef76e3a 100644 --- a/examples/quick/controls/texteditor/src/main.cpp +++ b/examples/quick/controls/texteditor/src/main.cpp @@ -47,5 +47,7 @@ int main(int argc, char *argv[]) QtQuickControlsApplication app(argc, argv); qmlRegisterType<DocumentHandler>("org.qtproject.example", 1, 0, "DocumentHandler"); QQmlApplicationEngine engine(QUrl("qrc:/qml/main.qml")); + if (engine.rootObjects().isEmpty()) + return -1; return app.exec(); } diff --git a/examples/quick/controls/touch/src/main.cpp b/examples/quick/controls/touch/src/main.cpp index bb4b3bdd..e66387f7 100644 --- a/examples/quick/controls/touch/src/main.cpp +++ b/examples/quick/controls/touch/src/main.cpp @@ -45,5 +45,7 @@ int main(int argc, char *argv[]) { QtQuickControlsApplication app(argc, argv); QQmlApplicationEngine engine(QUrl("qrc:/main.qml")); + if (engine.rootObjects().isEmpty()) + return -1; return app.exec(); } diff --git a/examples/quick/controls/uiforms/main.cpp b/examples/quick/controls/uiforms/main.cpp index de92dd70..6a15842a 100644 --- a/examples/quick/controls/uiforms/main.cpp +++ b/examples/quick/controls/uiforms/main.cpp @@ -55,5 +55,7 @@ int main(int argc, char *argv[]) qmlRegisterSingletonType(QUrl(QStringLiteral("qrc:/qml/CustomerModel.qml")), "io.qt.example", 1, 0, "CustomerModel"); QQmlApplicationEngine engine(QUrl("qrc:/main.qml")); + if (engine.rootObjects().isEmpty()) + return -1; return app.exec(); } diff --git a/examples/quick/dialogs/systemdialogs/main.cpp b/examples/quick/dialogs/systemdialogs/main.cpp index f83c8c22..5f65ce04 100644 --- a/examples/quick/dialogs/systemdialogs/main.cpp +++ b/examples/quick/dialogs/systemdialogs/main.cpp @@ -53,5 +53,7 @@ int main(int argc, char *argv[]) QSurfaceFormat::setDefaultFormat(fmt); } QQmlApplicationEngine engine(QUrl("qrc:/dialogs/systemdialogs/systemdialogs.qml")); + if (engine.rootObjects().isEmpty()) + return -1; return app.exec(); } diff --git a/examples/quick/extras/dashboard/main.cpp b/examples/quick/extras/dashboard/main.cpp index 77a0ada5..74ea0772 100644 --- a/examples/quick/extras/dashboard/main.cpp +++ b/examples/quick/extras/dashboard/main.cpp @@ -51,5 +51,7 @@ int main(int argc, char *argv[]) app.setFont(QFont("DejaVu Sans")); QQmlApplicationEngine engine(QUrl("qrc:/qml/dashboard.qml")); + if (engine.rootObjects().isEmpty()) + return -1; return app.exec(); } diff --git a/examples/quick/extras/flat/main.cpp b/examples/quick/extras/flat/main.cpp index 1012fa4e..8faafdca 100644 --- a/examples/quick/extras/flat/main.cpp +++ b/examples/quick/extras/flat/main.cpp @@ -51,5 +51,7 @@ int main(int argc, char *argv[]) } QQmlApplicationEngine engine; engine.load(QUrl("qrc:/main.qml")); + if (engine.rootObjects().isEmpty()) + return -1; return app.exec(); } diff --git a/examples/quick/extras/gallery/main.cpp b/examples/quick/extras/gallery/main.cpp index 9ba1835e..1d5d2313 100644 --- a/examples/quick/extras/gallery/main.cpp +++ b/examples/quick/extras/gallery/main.cpp @@ -45,5 +45,7 @@ int main(int argc, char *argv[]) { QGuiApplication app(argc, argv); QQmlApplicationEngine engine(QUrl("qrc:/qml/gallery.qml")); + if (engine.rootObjects().isEmpty()) + return -1; return app.exec(); } |