From ca1ed2bd2528d1474c870d1b508c65b1bf9442da Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Mon, 23 Nov 2009 15:40:24 +1000 Subject: Fix occasionally-failing debug tests. --- tests/auto/declarative/shared/debugutil.cpp | 9 +++++---- tests/auto/declarative/shared/debugutil_p.h | 3 +++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/auto/declarative/shared/debugutil.cpp b/tests/auto/declarative/shared/debugutil.cpp index 7008529..8f6fdef 100644 --- a/tests/auto/declarative/shared/debugutil.cpp +++ b/tests/auto/declarative/shared/debugutil.cpp @@ -88,8 +88,8 @@ void QmlDebugTestService::messageReceived(const QByteArray &ba) void QmlDebugTestService::enabledChanged(bool e) { - emit enabledStateChanged(); enabled = e; + emit enabledStateChanged(); } @@ -100,17 +100,18 @@ QmlDebugTestClient::QmlDebugTestClient(const QString &s, QmlDebugConnection *c) QByteArray QmlDebugTestClient::waitForResponse() { - QSignalSpy spy(this, SIGNAL(serverMessage(QByteArray))); + lastMsg.clear(); QmlDebugTest::waitForSignal(this, SIGNAL(serverMessage(QByteArray))); - if (spy.count() == 0) { + if (lastMsg.isEmpty()) { qWarning() << "tst_QmlDebugClient: no response from server!"; return QByteArray(); } - return spy.at(0).at(0).value(); + return lastMsg; } void QmlDebugTestClient::messageReceived(const QByteArray &ba) { + lastMsg = ba; emit serverMessage(ba); } diff --git a/tests/auto/declarative/shared/debugutil_p.h b/tests/auto/declarative/shared/debugutil_p.h index 665aeda..cb20f5c 100644 --- a/tests/auto/declarative/shared/debugutil_p.h +++ b/tests/auto/declarative/shared/debugutil_p.h @@ -119,6 +119,9 @@ signals: protected: virtual void messageReceived(const QByteArray &ba); + +private: + QByteArray lastMsg; }; class tst_QmlDebug_Thread : public QThread -- cgit v0.12 From 222f6954057b271745fa6158f14b331de2f032d8 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Mon, 23 Nov 2009 15:40:46 +1000 Subject: Doc. --- doc/src/declarative/globalobject.qdoc | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/doc/src/declarative/globalobject.qdoc b/doc/src/declarative/globalobject.qdoc index e983ad0..e3c8b9a 100644 --- a/doc/src/declarative/globalobject.qdoc +++ b/doc/src/declarative/globalobject.qdoc @@ -64,7 +64,7 @@ files. The Qt object contains all enums in the Qt namespace. For example, you can access the AlignLeft member of the Qt::AlignmentFlag enum with \c Qt.AlignLeft. -For a full list of enums, see the Qt Namespace documentation. +For a full list of enums, see the \l{Qt Namespace} documentation. \section2 Types The Qt object also contains helper functions for creating objects of specific @@ -88,20 +88,20 @@ This function returns a Color with the specified \c red, \c green, \c blue and \ This function returns a Color with the specified \c hue, \c saturation, \c lightness and \c alpha components. All components should be in the range 0-1 inclusive. \section3 Qt.rect(int x, int y, int width, int height) -This function returns a Rect with the top-left corner at \c x,\c y and the specified \c width and \c height. +This function returns a Rect with the top-left corner at \c x, \c y and the specified \c width and \c height. \section3 Qt.point(int x, int y) This function returns a Point with the specified \c x and \c y coordinates. \section3 Qt.size(int width, int height) -This function returns as Size with the specified width and height. +This function returns as Size with the specified \c width and \c height. \section3 Qt.vector3d(real x, real y, real z) -This function returns a Vector3D with the specified x, y and z. +This function returns a Vector3D with the specified \c x, \c y and \c z. \section2 Functions The Qt object also contains the following miscellaneous functions which expose Qt functionality for use in QML. \section3 Qt.lighter(color baseColor) This function returns a color 50% lighter than \c baseColor. See QColor::lighter() for further details. \section3 Qt.darker(color baseColor) -This function returns a color 50% darker than \c baseColor. See QColor::lighter() for further details. +This function returns a color 50% darker than \c baseColor. See QColor::darker() for further details. \section3 Qt.tint(color baseColor, color tintColor) This function allows tinting one color with another. @@ -117,6 +117,16 @@ This function returns a color 50% darker than \c baseColor. See QColor::lighter( \section3 Qt.closestAngle(number fromAngle, number toAngle) This function returns an equivalent angle to toAngle, such that the difference between fromAngle and toAngle is never more than 180 degrees. This is useful when animating angles using a NumberAnimation, which does not know about equivalent angles, when you always want to take the shortest path. +For example, the following would rotate myItem counterclockwise from 350 degrees to 10 degrees, for a total of 340 degrees of rotation. +\qml +NumberAnimation { target: myItem; property: "rotation"; from: 350; to: 10 } +\endqml + +while the following would rotate myItem clockwise from 350 degrees to 370 degrees (which is visually equivilant to 10 degrees), for a total of 20 degrees of rotation. +\qml +NumberAnimation { target: myItem; property: "rotation"; from: 350; to: Qt.closetAngle(350, 10) } +\endqml + \section3 Qt.playSound(url soundLocation) This function plays the audio file located at \c soundLocation. Only .wav files are supported. -- cgit v0.12 From effd2866ae343b858c69a66b61ececcd455d59d2 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Mon, 23 Nov 2009 16:05:08 +1000 Subject: QmlView doc. --- src/declarative/util/qmlview.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/declarative/util/qmlview.cpp b/src/declarative/util/qmlview.cpp index 63115bb..c981cde 100644 --- a/src/declarative/util/qmlview.cpp +++ b/src/declarative/util/qmlview.cpp @@ -168,6 +168,9 @@ public: view->execute(); ... \endcode + + To receive errors related to loading and executing QML with QmlView, + you can connect to the errors() signal. */ /*! -- cgit v0.12 From 4c72b0441380fd43b8ca63c9b7159adfb89c60e6 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Mon, 23 Nov 2009 16:20:57 +1000 Subject: QmlView doc. --- src/declarative/util/qmlview.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/declarative/util/qmlview.cpp b/src/declarative/util/qmlview.cpp index c981cde..62bcc07 100644 --- a/src/declarative/util/qmlview.cpp +++ b/src/declarative/util/qmlview.cpp @@ -167,6 +167,7 @@ public: ... view->execute(); ... + view->show(); \endcode To receive errors related to loading and executing QML with QmlView, -- cgit v0.12 From 8bbbb67aa06077678a0bd865783efc1212a918c3 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Mon, 23 Nov 2009 17:01:36 +1000 Subject: Avoid warnings --- tests/auto/declarative/anchors/data/anchors.qml | 13 +------------ tests/auto/declarative/anchors/tst_anchors.cpp | 13 +++++-------- 2 files changed, 6 insertions(+), 20 deletions(-) diff --git a/tests/auto/declarative/anchors/data/anchors.qml b/tests/auto/declarative/anchors/data/anchors.qml index e6bed48..b64d0b0 100644 --- a/tests/auto/declarative/anchors/data/anchors.qml +++ b/tests/auto/declarative/anchors/data/anchors.qml @@ -120,7 +120,7 @@ Rectangle { anchors.centerIn: masterRect } Rectangle { - id: rect23a; objectName: "rect23a" + id: rect23; objectName: "rect23" anchors.left: masterRect.left anchors.leftMargin: 5 anchors.right: masterRect.right @@ -131,17 +131,6 @@ Rectangle { anchors.bottomMargin: 5 } Rectangle { - id: rect23b; objectName: "rect23b" - anchors.left: rect23a.anchors.left - anchors.leftMargin: rect23a.anchors.leftMargin - anchors.right: rect23a.anchors.right - anchors.rightMargin: rect23a.anchors.rightMargin - anchors.top: rect23a.anchors.top - anchors.topMargin: rect23a.anchors.topMargin - anchors.bottom: rect23a.anchors.bottom - anchors.bottomMargin: rect23a.anchors.bottomMargin - } - Rectangle { id: rect24; objectName: "rect24" width: 10; height: 10 anchors.horizontalCenter: masterRect.left diff --git a/tests/auto/declarative/anchors/tst_anchors.cpp b/tests/auto/declarative/anchors/tst_anchors.cpp index d65d289..3011fdc 100644 --- a/tests/auto/declarative/anchors/tst_anchors.cpp +++ b/tests/auto/declarative/anchors/tst_anchors.cpp @@ -39,6 +39,7 @@ ** ****************************************************************************/ #include +#include #include #include #include @@ -144,14 +145,10 @@ void tst_anchors::basicAnchors() QCOMPARE(findItem(view->root(), QLatin1String("rect22"))->y(), 5.0); //margins - QCOMPARE(findItem(view->root(), QLatin1String("rect23a"))->x(), 31.0); - QCOMPARE(findItem(view->root(), QLatin1String("rect23a"))->y(), 5.0); - QCOMPARE(findItem(view->root(), QLatin1String("rect23a"))->width(), 86.0); - QCOMPARE(findItem(view->root(), QLatin1String("rect23a"))->height(), 10.0); - QCOMPARE(findItem(view->root(), QLatin1String("rect23b"))->x(), 31.0); - QCOMPARE(findItem(view->root(), QLatin1String("rect23b"))->y(), 5.0); - QCOMPARE(findItem(view->root(), QLatin1String("rect23b"))->width(), 86.0); - QCOMPARE(findItem(view->root(), QLatin1String("rect23b"))->height(), 10.0); + QCOMPARE(findItem(view->root(), QLatin1String("rect23"))->x(), 31.0); + QCOMPARE(findItem(view->root(), QLatin1String("rect23"))->y(), 5.0); + QCOMPARE(findItem(view->root(), QLatin1String("rect23"))->width(), 86.0); + QCOMPARE(findItem(view->root(), QLatin1String("rect23"))->height(), 10.0); // offsets QCOMPARE(findItem(view->root(), QLatin1String("rect24"))->x(), 26.0); -- cgit v0.12