Make Qt.quit() from inside QML work in the examples
authorJan Kundrát <jkt@flaska.net>
Tue, 16 Oct 2012 18:33:55 +0000 (20:33 +0200)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Wed, 17 Oct 2012 06:50:52 +0000 (08:50 +0200)
Without this patch, the samegame's quit button does not work.

Change-Id: I904832d018d589e90564534ac1eca02e0dbb54fc
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Kai Koehne <kai.koehne@digia.com>

examples/shared/shared.h

index 0e9395a..bf3857f 100644 (file)
@@ -39,6 +39,7 @@
 ****************************************************************************/
 #include <QDir>
 #include <QGuiApplication>
+#include <QQmlEngine>
 #include <QQuickView>
 #define DECLARATIVE_EXAMPLE_MAIN(NAME) int main(int argc, char* argv[]) \
 {\
@@ -68,6 +69,7 @@
             qWarning("Could not find file '%s'", qPrintable(QDir::toNativeSeparators(fileName)));\
             return -1;\
     }\
+    view.connect(view.engine(), SIGNAL(quit()), &app, SLOT(quit()));\
     view.setSource(QUrl::fromLocalFile(fileName));\
     view.show();\
     return app.exec();\