summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoona Petrell <joona.t.petrell@nokia.com>2010-08-26 05:08:41 (GMT)
committerJoona Petrell <joona.t.petrell@nokia.com>2010-08-30 04:48:09 (GMT)
commitfce17c2847fa48410adae098b1df3db76fa4ef67 (patch)
treee1794bd2385278471eaebde0b87045b7f982f0b4
parent7c81d90e490a95c67e0d0c9a184be479bd59817a (diff)
downloadQt-fce17c2847fa48410adae098b1df3db76fa4ef67.zip
Qt-fce17c2847fa48410adae098b1df3db76fa4ef67.tar.gz
Qt-fce17c2847fa48410adae098b1df3db76fa4ef67.tar.bz2
Fix application exiting in embedded qml examples
Task-number: QTBUG-13178 Reviewed-by: Martin Jones
-rw-r--r--demos/embedded/qmlcalculator/qmlcalculator.cpp4
-rw-r--r--demos/embedded/qmlclocks/qmlclocks.cpp2
-rw-r--r--demos/embedded/qmldialcontrol/qmldialcontrol.cpp2
-rw-r--r--demos/embedded/qmleasing/deployment.pri2
-rw-r--r--demos/embedded/qmleasing/qmleasing.cpp2
-rw-r--r--demos/embedded/qmlflickr/qmlflickr.cpp4
-rw-r--r--demos/embedded/qmlphotoviewer/qmlphotoviewer.cpp2
-rw-r--r--demos/embedded/qmltwitter/qmltwitter.cpp3
-rw-r--r--examples/declarative/animation/easing/content/QuitButton.qml12
-rw-r--r--examples/declarative/animation/easing/content/quit.pngbin0 -> 583 bytes
-rw-r--r--examples/declarative/animation/easing/easing.qml19
-rw-r--r--examples/declarative/toys/clocks/clocks.qml5
-rw-r--r--examples/declarative/toys/clocks/content/QuitButton.qml12
-rw-r--r--examples/declarative/toys/clocks/content/quit.pngbin0 -> 583 bytes
-rw-r--r--examples/declarative/ui-components/dialcontrol/content/QuitButton.qml12
-rw-r--r--examples/declarative/ui-components/dialcontrol/content/quit.pngbin0 -> 583 bytes
-rw-r--r--examples/declarative/ui-components/dialcontrol/dialcontrol.qml5
-rw-r--r--src/declarative/qml/qdeclarativeengine.cpp3
18 files changed, 82 insertions, 7 deletions
diff --git a/demos/embedded/qmlcalculator/qmlcalculator.cpp b/demos/embedded/qmlcalculator/qmlcalculator.cpp
index 3030e81..6c41e61 100644
--- a/demos/embedded/qmlcalculator/qmlcalculator.cpp
+++ b/demos/embedded/qmlcalculator/qmlcalculator.cpp
@@ -42,6 +42,7 @@
#include <QtCore/QFileInfo>
#include <QtGui/QApplication>
#include <QtDeclarative/QDeclarativeView>
+#include <QtDeclarative/QDeclarativeEngine>
#if defined(Q_OS_SYMBIAN)
#include <eikenv.h>
@@ -58,7 +59,8 @@ int main(int argc, char *argv[])
QDeclarativeView view;
view.setSource(QUrl(mainQmlApp));
view.setResizeMode(QDeclarativeView::SizeRootObjectToView);
-
+ QObject::connect(view.engine(), SIGNAL(quit()), &application, SLOT(quit()));
+
#if defined(QT_KEYPAD_NAVIGATION)
QApplication::setNavigationMode(Qt::NavigationModeCursorAuto);
#endif // QT_KEYPAD_NAVIGATION
diff --git a/demos/embedded/qmlclocks/qmlclocks.cpp b/demos/embedded/qmlclocks/qmlclocks.cpp
index d94cbdd..a09801b 100644
--- a/demos/embedded/qmlclocks/qmlclocks.cpp
+++ b/demos/embedded/qmlclocks/qmlclocks.cpp
@@ -42,6 +42,7 @@
#include <QtCore/QFileInfo>
#include <QtGui/QApplication>
#include <QtDeclarative/QDeclarativeView>
+#include <QtDeclarative/QDeclarativeEngine>
#if defined(Q_OS_SYMBIAN)
#include <eikenv.h>
@@ -58,6 +59,7 @@ int main(int argc, char *argv[])
QDeclarativeView view;
view.setSource(QUrl(mainQmlApp));
view.setResizeMode(QDeclarativeView::SizeRootObjectToView);
+ QObject::connect(view.engine(), SIGNAL(quit()), &application, SLOT(quit()));
#if defined(QT_KEYPAD_NAVIGATION)
QApplication::setNavigationMode(Qt::NavigationModeCursorAuto);
diff --git a/demos/embedded/qmldialcontrol/qmldialcontrol.cpp b/demos/embedded/qmldialcontrol/qmldialcontrol.cpp
index 311cee0..56b21d7 100644
--- a/demos/embedded/qmldialcontrol/qmldialcontrol.cpp
+++ b/demos/embedded/qmldialcontrol/qmldialcontrol.cpp
@@ -42,6 +42,7 @@
#include <QtCore/QFileInfo>
#include <QtGui/QApplication>
#include <QtDeclarative/QDeclarativeView>
+#include <QtDeclarative/QDeclarativeEngine>
int main(int argc, char *argv[])
{
@@ -51,6 +52,7 @@ int main(int argc, char *argv[])
QDeclarativeView view;
view.setSource(QUrl(mainQmlApp));
view.setResizeMode(QDeclarativeView::SizeRootObjectToView);
+ QObject::connect(view.engine(), SIGNAL(quit()), &application, SLOT(quit()));
#if defined(QT_KEYPAD_NAVIGATION)
QApplication::setNavigationMode(Qt::NavigationModeCursorAuto);
diff --git a/demos/embedded/qmleasing/deployment.pri b/demos/embedded/qmleasing/deployment.pri
index 984f5c8..d3621cb 100644
--- a/demos/embedded/qmleasing/deployment.pri
+++ b/demos/embedded/qmleasing/deployment.pri
@@ -4,5 +4,5 @@ symbian {
qmleasing_uid3 = A000E3FE
qmleasing_files.path = $$APP_PRIVATE_DIR_BASE/$$qmleasing_uid3
}
-qmleasing_files.sources = $$qmleasing_src/easing.qml
+qmleasing_files.sources = $$qmleasing_src/easing.qml $$qmleasing_src/content
DEPLOYMENT += qmleasing_files
diff --git a/demos/embedded/qmleasing/qmleasing.cpp b/demos/embedded/qmleasing/qmleasing.cpp
index d326468..713fe67 100644
--- a/demos/embedded/qmleasing/qmleasing.cpp
+++ b/demos/embedded/qmleasing/qmleasing.cpp
@@ -42,6 +42,7 @@
#include <QtCore/QFileInfo>
#include <QtGui/QApplication>
#include <QtDeclarative/QDeclarativeView>
+#include <QtDeclarative/QDeclarativeEngine>
int main(int argc, char *argv[])
{
@@ -51,6 +52,7 @@ int main(int argc, char *argv[])
QDeclarativeView view;
view.setSource(QUrl(mainQmlApp));
view.setResizeMode(QDeclarativeView::SizeRootObjectToView);
+ QObject::connect(view.engine(), SIGNAL(quit()), &application, SLOT(quit()));
#if defined(QT_KEYPAD_NAVIGATION)
QApplication::setNavigationMode(Qt::NavigationModeCursorAuto);
diff --git a/demos/embedded/qmlflickr/qmlflickr.cpp b/demos/embedded/qmlflickr/qmlflickr.cpp
index 7068f88..c05806c 100644
--- a/demos/embedded/qmlflickr/qmlflickr.cpp
+++ b/demos/embedded/qmlflickr/qmlflickr.cpp
@@ -48,6 +48,7 @@
#include <QtNetwork/QNetworkConfiguration>
#include <QtNetwork/QNetworkConfigurationManager>
#include <QtNetwork/QNetworkAccessManager>
+#include <QtDeclarative/QDeclarativeEngine>
// Factory to create QNetworkAccessManagers that use the saved network configuration; otherwise
// the system default.
@@ -95,7 +96,8 @@ int main(int argc, char *argv[])
view.engine()->setNetworkAccessManagerFactory(&networkAccessManagerFactory);
view.setSource(QUrl(mainQmlApp));
view.setResizeMode(QDeclarativeView::SizeRootObjectToView);
-
+ QObject::connect(view.engine(), SIGNAL(quit()), &application, SLOT(quit()));
+
#if defined(Q_OS_SYMBIAN)
view.showFullScreen();
#else // Q_OS_SYMBIAN
diff --git a/demos/embedded/qmlphotoviewer/qmlphotoviewer.cpp b/demos/embedded/qmlphotoviewer/qmlphotoviewer.cpp
index 2b9db5e..d9cf67c 100644
--- a/demos/embedded/qmlphotoviewer/qmlphotoviewer.cpp
+++ b/demos/embedded/qmlphotoviewer/qmlphotoviewer.cpp
@@ -96,6 +96,8 @@ int main(int argc, char *argv[])
view.setSource(QUrl(mainQmlApp));
view.setResizeMode(QDeclarativeView::SizeRootObjectToView);
+ QObject::connect(view.engine(), SIGNAL(quit()), &application, SLOT(quit()));
+
#if defined(Q_OS_SYMBIAN)
view.showFullScreen();
#else // Q_OS_SYMBIAN
diff --git a/demos/embedded/qmltwitter/qmltwitter.cpp b/demos/embedded/qmltwitter/qmltwitter.cpp
index c53098a4..30c4601 100644
--- a/demos/embedded/qmltwitter/qmltwitter.cpp
+++ b/demos/embedded/qmltwitter/qmltwitter.cpp
@@ -95,7 +95,8 @@ int main(int argc, char *argv[])
view.engine()->setNetworkAccessManagerFactory(&networkAccessManagerFactory);
view.setSource(QUrl(mainQmlApp));
view.setResizeMode(QDeclarativeView::SizeRootObjectToView);
-
+ QObject::connect(view.engine(), SIGNAL(quit()), &application, SLOT(quit()));
+
#if defined(Q_OS_SYMBIAN)
view.showFullScreen();
#else // Q_OS_SYMBIAN
diff --git a/examples/declarative/animation/easing/content/QuitButton.qml b/examples/declarative/animation/easing/content/QuitButton.qml
new file mode 100644
index 0000000..70747a8
--- /dev/null
+++ b/examples/declarative/animation/easing/content/QuitButton.qml
@@ -0,0 +1,12 @@
+import Qt 4.7
+Image {
+ source: "quit.png"
+ scale: quitMouse.pressed ? 0.8 : 1.0
+ smooth: quitMouse.pressed
+ MouseArea {
+ id: quitMouse
+ anchors.fill: parent
+ anchors.margins: -10
+ onClicked: Qt.quit()
+ }
+} \ No newline at end of file
diff --git a/examples/declarative/animation/easing/content/quit.png b/examples/declarative/animation/easing/content/quit.png
new file mode 100644
index 0000000..b822057
--- /dev/null
+++ b/examples/declarative/animation/easing/content/quit.png
Binary files differ
diff --git a/examples/declarative/animation/easing/easing.qml b/examples/declarative/animation/easing/easing.qml
index 9cdbad1..b53cb98 100644
--- a/examples/declarative/animation/easing/easing.qml
+++ b/examples/declarative/animation/easing/easing.qml
@@ -39,6 +39,7 @@
****************************************************************************/
import Qt 4.7
+import "content"
Rectangle {
id: window
@@ -134,11 +135,23 @@ Rectangle {
}
Flickable {
- anchors.fill: parent; contentHeight: layout.height
-
+ anchors.fill: parent
+ contentHeight: layout.height
+ Rectangle {
+ id: titlePane
+ color: "#444444"
+ height: 35
+ anchors { top: parent.top; left: parent.left; right: parent.right }
+ QuitButton {
+ id: quitButton
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.right: parent.right
+ anchors.rightMargin: 10
+ }
+ }
Column {
id: layout
- anchors.left: parent.left; anchors.right: parent.right
+ anchors { top: titlePane.bottom; topMargin: 10; left: parent.left; right: parent.right }
Repeater { model: easingTypes; delegate: delegate }
}
}
diff --git a/examples/declarative/toys/clocks/clocks.qml b/examples/declarative/toys/clocks/clocks.qml
index 124e391..82a1dbf 100644
--- a/examples/declarative/toys/clocks/clocks.qml
+++ b/examples/declarative/toys/clocks/clocks.qml
@@ -51,4 +51,9 @@ Rectangle {
Clock { city: "Mumbai"; shift: 5.5 }
Clock { city: "Tokyo"; shift: 9 }
}
+ QuitButton {
+ anchors.right: parent.right
+ anchors.top: parent.top
+ anchors.margins: 10
+ }
}
diff --git a/examples/declarative/toys/clocks/content/QuitButton.qml b/examples/declarative/toys/clocks/content/QuitButton.qml
new file mode 100644
index 0000000..70747a8
--- /dev/null
+++ b/examples/declarative/toys/clocks/content/QuitButton.qml
@@ -0,0 +1,12 @@
+import Qt 4.7
+Image {
+ source: "quit.png"
+ scale: quitMouse.pressed ? 0.8 : 1.0
+ smooth: quitMouse.pressed
+ MouseArea {
+ id: quitMouse
+ anchors.fill: parent
+ anchors.margins: -10
+ onClicked: Qt.quit()
+ }
+} \ No newline at end of file
diff --git a/examples/declarative/toys/clocks/content/quit.png b/examples/declarative/toys/clocks/content/quit.png
new file mode 100644
index 0000000..b822057
--- /dev/null
+++ b/examples/declarative/toys/clocks/content/quit.png
Binary files differ
diff --git a/examples/declarative/ui-components/dialcontrol/content/QuitButton.qml b/examples/declarative/ui-components/dialcontrol/content/QuitButton.qml
new file mode 100644
index 0000000..70747a8
--- /dev/null
+++ b/examples/declarative/ui-components/dialcontrol/content/QuitButton.qml
@@ -0,0 +1,12 @@
+import Qt 4.7
+Image {
+ source: "quit.png"
+ scale: quitMouse.pressed ? 0.8 : 1.0
+ smooth: quitMouse.pressed
+ MouseArea {
+ id: quitMouse
+ anchors.fill: parent
+ anchors.margins: -10
+ onClicked: Qt.quit()
+ }
+} \ No newline at end of file
diff --git a/examples/declarative/ui-components/dialcontrol/content/quit.png b/examples/declarative/ui-components/dialcontrol/content/quit.png
new file mode 100644
index 0000000..b822057
--- /dev/null
+++ b/examples/declarative/ui-components/dialcontrol/content/quit.png
Binary files differ
diff --git a/examples/declarative/ui-components/dialcontrol/dialcontrol.qml b/examples/declarative/ui-components/dialcontrol/dialcontrol.qml
index 46cc3e6..a7da5c6 100644
--- a/examples/declarative/ui-components/dialcontrol/dialcontrol.qml
+++ b/examples/declarative/ui-components/dialcontrol/dialcontrol.qml
@@ -88,5 +88,10 @@ Rectangle {
}
}
}
+ QuitButton {
+ anchors.right: parent.right
+ anchors.top: parent.top
+ anchors.margins: 10
+ }
}
//! [0]
diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp
index c5a5c18..0fe1ea3 100644
--- a/src/declarative/qml/qdeclarativeengine.cpp
+++ b/src/declarative/qml/qdeclarativeengine.cpp
@@ -1716,6 +1716,9 @@ void QDeclarativeEnginePrivate::sendQuit()
{
Q_Q(QDeclarativeEngine);
emit q->quit();
+ if (q->receivers(SIGNAL(quit())) == 0) {
+ qWarning("Signal QDeclarativeEngine::quit() emitted, but no receivers connected to handle it.");
+ }
}
static void dumpwarning(const QDeclarativeError &error)