From 87750fe0cfc3861dbe3421bdd3f20dc0f97ad45a Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Fri, 27 Aug 2010 11:06:07 +1000 Subject: Improve stability of test on loaded hw. --- tests/auto/declarative/qdeclarativebehaviors/data/qtbug12295.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/qtbug12295.qml b/tests/auto/declarative/qdeclarativebehaviors/data/qtbug12295.qml index 804559c..d41add3 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/data/qtbug12295.qml +++ b/tests/auto/declarative/qdeclarativebehaviors/data/qtbug12295.qml @@ -11,7 +11,7 @@ Rectangle { width: 100 height: 100 Behavior on x { - NumberAnimation {} + NumberAnimation { duration: 500 } } } } -- cgit v0.12 From 93c8a38e5f4912c51c4484975ebd433bec43a0f1 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Fri, 27 Aug 2010 11:11:29 +1000 Subject: Improve stability of test on loaded hw. --- .../qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp b/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp index 6d5a357..d0afc8a 100644 --- a/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp +++ b/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp @@ -389,6 +389,7 @@ void tst_qdeclarativeimageprovider::threadTest() } provider->ok = true; provider->cond.wakeAll(); + QTest::qWait(250); foreach(QDeclarativeImage *img, images) { TRY_WAIT(img->status() == QDeclarativeImage::Ready); } -- cgit v0.12 From 94d7ec29f177665e8e2a218a161df517f3ae51d5 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Fri, 27 Aug 2010 11:46:45 +1000 Subject: Improve test reliability when running in parallel with other tests. --- .../qdeclarativegridview/tst_qdeclarativegridview.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp index 896d69e..d4d8bf6 100644 --- a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp +++ b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp @@ -655,6 +655,15 @@ void tst_QDeclarativeGridView::currentIndex() gridview->setFlow(QDeclarativeGridView::TopToBottom); + qApp->setActiveWindow(canvas); +#ifdef Q_WS_X11 + // to be safe and avoid failing setFocus with window managers + qt_x11_wait_for_window_manager(canvas); +#endif + QTRY_VERIFY(canvas->hasFocus()); + QTRY_VERIFY(canvas->scene()->hasFocus()); + qApp->processEvents(); + QTest::keyClick(canvas, Qt::Key_Right); QCOMPARE(gridview->currentIndex(), 5); -- cgit v0.12 From c43cf8ad4f1ba7d6d9e2403520a7e54ceadee60c Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Fri, 27 Aug 2010 14:57:02 +1000 Subject: Fix VisualDataModel model update handling when rootIndex is specified. Task-number: QTBUG-13038 --- .../graphicsitems/qdeclarativevisualitemmodel.cpp | 15 +++--- .../qdeclarativevisualdatamodel/data/datalist.qml | 16 +++--- .../tst_qdeclarativevisualdatamodel.cpp | 61 ++++++++++++++++++++++ 3 files changed, 80 insertions(+), 12 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp index b4e8bda..a46ee73 100644 --- a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp +++ b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp @@ -1305,24 +1305,27 @@ void QDeclarativeVisualDataModel::_q_itemsMoved(int from, int to, int count) void QDeclarativeVisualDataModel::_q_rowsInserted(const QModelIndex &parent, int begin, int end) { - if (!parent.isValid()) + Q_D(QDeclarativeVisualDataModel); + if (parent == d->m_root) _q_itemsInserted(begin, end - begin + 1); } void QDeclarativeVisualDataModel::_q_rowsRemoved(const QModelIndex &parent, int begin, int end) { - if (!parent.isValid()) + Q_D(QDeclarativeVisualDataModel); + if (parent == d->m_root) _q_itemsRemoved(begin, end - begin + 1); } void QDeclarativeVisualDataModel::_q_rowsMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationRow) { + Q_D(QDeclarativeVisualDataModel); const int count = sourceEnd - sourceStart + 1; - if (!destinationParent.isValid() && !sourceParent.isValid()) { + if (destinationParent == d->m_root && sourceParent == d->m_root) { _q_itemsMoved(sourceStart, destinationRow, count); - } else if (!sourceParent.isValid()) { + } else if (sourceParent == d->m_root) { _q_itemsRemoved(sourceStart, count); - } else if (!destinationParent.isValid()) { + } else if (destinationParent == d->m_root) { _q_itemsInserted(destinationRow, count); } } @@ -1330,7 +1333,7 @@ void QDeclarativeVisualDataModel::_q_rowsMoved(const QModelIndex &sourceParent, void QDeclarativeVisualDataModel::_q_dataChanged(const QModelIndex &begin, const QModelIndex &end) { Q_D(QDeclarativeVisualDataModel); - if (!begin.parent().isValid()) + if (begin.parent() == d->m_root) _q_itemsChanged(begin.row(), end.row() - begin.row() + 1, d->m_roles); } diff --git a/tests/auto/declarative/qdeclarativevisualdatamodel/data/datalist.qml b/tests/auto/declarative/qdeclarativevisualdatamodel/data/datalist.qml index a798f77..c5e945a 100644 --- a/tests/auto/declarative/qdeclarativevisualdatamodel/data/datalist.qml +++ b/tests/auto/declarative/qdeclarativevisualdatamodel/data/datalist.qml @@ -4,12 +4,16 @@ ListView { width: 100 height: 100 anchors.fill: parent - model: myModel - delegate: Component { - Rectangle { - height: 25 - width: 100 - Text { objectName: "display"; text: display } + model: VisualDataModel { + id: visualModel + objectName: "visualModel" + model: myModel + delegate: Component { + Rectangle { + height: 25 + width: 100 + Text { objectName: "display"; text: display } + } } } } diff --git a/tests/auto/declarative/qdeclarativevisualdatamodel/tst_qdeclarativevisualdatamodel.cpp b/tests/auto/declarative/qdeclarativevisualdatamodel/tst_qdeclarativevisualdatamodel.cpp index 3cd786f..95ef4fc 100644 --- a/tests/auto/declarative/qdeclarativevisualdatamodel/tst_qdeclarativevisualdatamodel.cpp +++ b/tests/auto/declarative/qdeclarativevisualdatamodel/tst_qdeclarativevisualdatamodel.cpp @@ -84,6 +84,7 @@ public: private slots: void rootIndex(); void updateLayout(); + void childChanged(); void objectListModel(); private: @@ -174,22 +175,82 @@ void tst_qdeclarativevisualdatamodel::updateLayout() QVERIFY(contentItem != 0); QDeclarativeText *name = findItem(contentItem, "display", 0); + QVERIFY(name); QCOMPARE(name->text(), QString("Row 1 Item")); name = findItem(contentItem, "display", 1); + QVERIFY(name); QCOMPARE(name->text(), QString("Row 2 Item")); name = findItem(contentItem, "display", 2); + QVERIFY(name); QCOMPARE(name->text(), QString("Row 3 Item")); model.invisibleRootItem()->sortChildren(0, Qt::DescendingOrder); name = findItem(contentItem, "display", 0); + QVERIFY(name); QCOMPARE(name->text(), QString("Row 3 Item")); name = findItem(contentItem, "display", 1); + QVERIFY(name); QCOMPARE(name->text(), QString("Row 2 Item")); name = findItem(contentItem, "display", 2); + QVERIFY(name); QCOMPARE(name->text(), QString("Row 1 Item")); } +void tst_qdeclarativevisualdatamodel::childChanged() +{ + QDeclarativeView view; + + QStandardItemModel model; + initStandardTreeModel(&model); + + view.rootContext()->setContextProperty("myModel", &model); + + view.setSource(QUrl::fromLocalFile(SRCDIR "/data/datalist.qml")); + + QDeclarativeListView *listview = qobject_cast(view.rootObject()); + QVERIFY(listview != 0); + + QDeclarativeItem *contentItem = listview->contentItem(); + QVERIFY(contentItem != 0); + + QDeclarativeVisualDataModel *vdm = listview->findChild("visualModel"); + vdm->setRootIndex(QVariant::fromValue(model.indexFromItem(model.item(1,0)))); + + QDeclarativeText *name = findItem(contentItem, "display", 0); + QVERIFY(name); + QCOMPARE(name->text(), QString("Row 2 Child Item")); + + model.item(1,0)->child(0,0)->setText("Row 2 updated child"); + + name = findItem(contentItem, "display", 0); + QVERIFY(name); + QCOMPARE(name->text(), QString("Row 2 updated child")); + + model.item(1,0)->appendRow(new QStandardItem(QLatin1String("Row 2 Child Item 2"))); + QTest::qWait(300); + + name = findItem(contentItem, "display", 1); + QVERIFY(name != 0); + QCOMPARE(name->text(), QString("Row 2 Child Item 2")); + + model.item(1,0)->takeRow(1); + name = findItem(contentItem, "display", 1); + QVERIFY(name == 0); + + vdm->setRootIndex(QVariant::fromValue(QModelIndex())); + QTest::qWait(300); + name = findItem(contentItem, "display", 0); + QVERIFY(name); + QCOMPARE(name->text(), QString("Row 1 Item")); + name = findItem(contentItem, "display", 1); + QVERIFY(name); + QCOMPARE(name->text(), QString("Row 2 Item")); + name = findItem(contentItem, "display", 2); + QVERIFY(name); + QCOMPARE(name->text(), QString("Row 3 Item")); +} + void tst_qdeclarativevisualdatamodel::objectListModel() { QDeclarativeView view; -- cgit v0.12 From bd521ed56f8e4be7117dc3534c6fded68f7a70c5 Mon Sep 17 00:00:00 2001 From: Lasse Holmstedt Date: Fri, 27 Aug 2010 13:05:25 +0200 Subject: QDeclarativeDebug: Destroy incoming connections if already connected Without this, QML Inspector in Qt Creator gets no error message for failed connections, which can lead to confusion. Reviewed-by: ogoffart --- src/declarative/debugger/qdeclarativedebugservice.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/declarative/debugger/qdeclarativedebugservice.cpp b/src/declarative/debugger/qdeclarativedebugservice.cpp index dca2695..1bbfcf4 100644 --- a/src/declarative/debugger/qdeclarativedebugservice.cpp +++ b/src/declarative/debugger/qdeclarativedebugservice.cpp @@ -128,6 +128,8 @@ void QDeclarativeDebugServer::newConnection() if (d->connection) { qWarning("QDeclarativeDebugServer error: another client is already connected"); + QTcpSocket *faultyConnection = d->tcpServer->nextPendingConnection(); + delete faultyConnection; return; } -- cgit v0.12 From fce17c2847fa48410adae098b1df3db76fa4ef67 Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Thu, 26 Aug 2010 15:08:41 +1000 Subject: Fix application exiting in embedded qml examples Task-number: QTBUG-13178 Reviewed-by: Martin Jones --- demos/embedded/qmlcalculator/qmlcalculator.cpp | 4 +++- demos/embedded/qmlclocks/qmlclocks.cpp | 2 ++ demos/embedded/qmldialcontrol/qmldialcontrol.cpp | 2 ++ demos/embedded/qmleasing/deployment.pri | 2 +- demos/embedded/qmleasing/qmleasing.cpp | 2 ++ demos/embedded/qmlflickr/qmlflickr.cpp | 4 +++- demos/embedded/qmlphotoviewer/qmlphotoviewer.cpp | 2 ++ demos/embedded/qmltwitter/qmltwitter.cpp | 3 ++- .../animation/easing/content/QuitButton.qml | 12 ++++++++++++ .../declarative/animation/easing/content/quit.png | Bin 0 -> 583 bytes examples/declarative/animation/easing/easing.qml | 19 ++++++++++++++++--- examples/declarative/toys/clocks/clocks.qml | 5 +++++ .../declarative/toys/clocks/content/QuitButton.qml | 12 ++++++++++++ examples/declarative/toys/clocks/content/quit.png | Bin 0 -> 583 bytes .../ui-components/dialcontrol/content/QuitButton.qml | 12 ++++++++++++ .../ui-components/dialcontrol/content/quit.png | Bin 0 -> 583 bytes .../ui-components/dialcontrol/dialcontrol.qml | 5 +++++ src/declarative/qml/qdeclarativeengine.cpp | 3 +++ 18 files changed, 82 insertions(+), 7 deletions(-) create mode 100644 examples/declarative/animation/easing/content/QuitButton.qml create mode 100644 examples/declarative/animation/easing/content/quit.png create mode 100644 examples/declarative/toys/clocks/content/QuitButton.qml create mode 100644 examples/declarative/toys/clocks/content/quit.png create mode 100644 examples/declarative/ui-components/dialcontrol/content/QuitButton.qml create mode 100644 examples/declarative/ui-components/dialcontrol/content/quit.png 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 #include #include +#include #if defined(Q_OS_SYMBIAN) #include @@ -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 #include #include +#include #if defined(Q_OS_SYMBIAN) #include @@ -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 #include #include +#include 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 #include #include +#include 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 #include #include +#include // 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 Binary files /dev/null and b/examples/declarative/animation/easing/content/quit.png 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 Binary files /dev/null and b/examples/declarative/toys/clocks/content/quit.png 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 Binary files /dev/null and b/examples/declarative/ui-components/dialcontrol/content/quit.png 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) -- cgit v0.12 From bcef15f4134a0825db85e1749aa90c60d94ab04b Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Fri, 27 Aug 2010 12:14:24 +1000 Subject: QML Viewer should be put under QtDemos instead of QtExamples folder in Symbian app menu Task-number: Reviewed-by: Martin Jones --- tools/qml/qml.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/qml/qml.pro b/tools/qml/qml.pro index d794005..3927dd6 100644 --- a/tools/qml/qml.pro +++ b/tools/qml/qml.pro @@ -34,7 +34,7 @@ maemo5 { } symbian { TARGET.UID3 = 0x20021317 - include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) + include($$QT_SOURCE_TREE/demos/symbianpkgrules.pri) TARGET.EPOCHEAPSIZE = 0x20000 0x4000000 TARGET.CAPABILITY = NetworkServices ReadUserData !contains(S60_VERSION, 3.1):!contains(S60_VERSION, 3.2) { -- cgit v0.12 From 75fc8a8dd52156b2089764ce82925289877eee1d Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Mon, 30 Aug 2010 15:22:28 +1000 Subject: Snake: Don't use Behavior with states. Changing states mid-animation confuses states where property value is not specified explicitly for each state. Task-number: QT-3823 --- demos/declarative/snake/content/Cookie.qml | 6 +++++- demos/declarative/snake/content/Link.qml | 8 +++++++- demos/declarative/snake/content/snake.js | 2 +- demos/declarative/snake/snake.qml | 7 +++++-- 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/demos/declarative/snake/content/Cookie.qml b/demos/declarative/snake/content/Cookie.qml index e67a7af..eb57fd2 100644 --- a/demos/declarative/snake/content/Cookie.qml +++ b/demos/declarative/snake/content/Cookie.qml @@ -59,7 +59,6 @@ Item { anchors.fill: parent source: "pics/cookie.png" opacity: 0 - Behavior on opacity { NumberAnimation { duration: 100 } } Text { font.bold: true anchors.verticalCenter: parent.verticalCenter @@ -87,4 +86,9 @@ Item { PropertyChanges { target: img; opacity: 0 } } ] + transitions: [ + Transition { + NumberAnimation { target: img; property: "opacity"; duration: 100 } + } + ] } diff --git a/demos/declarative/snake/content/Link.qml b/demos/declarative/snake/content/Link.qml index 9aa6006..942008d 100644 --- a/demos/declarative/snake/content/Link.qml +++ b/demos/declarative/snake/content/Link.qml @@ -86,7 +86,6 @@ Item { id:link } opacity: 0 - Behavior on opacity { NumberAnimation { duration: 200 } } } @@ -114,4 +113,11 @@ Item { id:link PropertyChanges { target: img; opacity: 0 } } ] + + transitions: [ + Transition { + NumberAnimation { target: img; property: "opacity"; duration: 200 } + } + ] + } diff --git a/demos/declarative/snake/content/snake.js b/demos/declarative/snake/content/snake.js index fab7834..c2e9d3a 100644 --- a/demos/declarative/snake/content/snake.js +++ b/demos/declarative/snake/content/snake.js @@ -35,7 +35,7 @@ function startNewGame() if (heartbeat.running) { endGame(); startNewGameTimer.running = true; - state = "starting"; + state = ""; return; } diff --git a/demos/declarative/snake/snake.qml b/demos/declarative/snake/snake.qml index 12ad71c..cf037fc 100644 --- a/demos/declarative/snake/snake.qml +++ b/demos/declarative/snake/snake.qml @@ -106,7 +106,7 @@ Rectangle { anchors.fill: parent anchors.horizontalCenter: parent.horizontalCenter anchors.verticalCenter: parent.verticalCenter - Behavior on opacity { NumberAnimation { duration: 500 } } + onOpacityChanged: console.log("opacity: "+opacity); Text { color: "white" @@ -236,7 +236,10 @@ Rectangle { from: "*" to: "starting" NumberAnimation { target: progressIndicator; property: "width"; duration: 1000 } - + NumberAnimation { target: title; property: "opacity"; duration: 500 } + }, + Transition { + NumberAnimation { target: title; property: "opacity"; duration: 500 } } ] -- cgit v0.12 From 755dee37d9eef756642ff0e9f40547b1ab3f8d0b Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Mon, 30 Aug 2010 16:25:42 +1000 Subject: Remove debug. --- demos/declarative/snake/snake.qml | 1 - 1 file changed, 1 deletion(-) diff --git a/demos/declarative/snake/snake.qml b/demos/declarative/snake/snake.qml index cf037fc..4d989df 100644 --- a/demos/declarative/snake/snake.qml +++ b/demos/declarative/snake/snake.qml @@ -106,7 +106,6 @@ Rectangle { anchors.fill: parent anchors.horizontalCenter: parent.horizontalCenter anchors.verticalCenter: parent.verticalCenter - onOpacityChanged: console.log("opacity: "+opacity); Text { color: "white" -- cgit v0.12