From 8a4829ef1559787726b576a210dfd0c86b91b249 Mon Sep 17 00:00:00 2001 From: Jerome Pasion Date: Mon, 21 Jan 2013 16:35:21 +0100 Subject: Doc: Fixed "QML Types" node in Assistant MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Removed "class" from the "selectors" variable in qdocconf file. Task-number: QTBUG-29242 Change-Id: I960dcbdb22358e033177b0ccb9c211136c0e4dcb Reviewed-by: Topi Reiniƶ Reviewed-by: Venugopal Shivashankar Reviewed-by: Geir Vattekar --- src/quick/doc/qtquick.qdocconf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/quick/doc/qtquick.qdocconf b/src/quick/doc/qtquick.qdocconf index 96ee13bb51..5131db03b4 100644 --- a/src/quick/doc/qtquick.qdocconf +++ b/src/quick/doc/qtquick.qdocconf @@ -20,7 +20,7 @@ qhp.QtQuick.customFilters.Qt.filterAttributes = qtquick 5.0.1 qhp.QtQuick.subprojects = qmltypes classes examples qhp.QtQuick.subprojects.qmltypes.title = QML Types qhp.QtQuick.subprojects.qmltypes.indexTitle = Qt Quick QML Types -qhp.QtQuick.subprojects.qmltypes.selectors = class fake:headerfile +qhp.QtQuick.subprojects.qmltypes.selectors = fake:headerfile qhp.QtQuick.subprojects.qmltypes.sortPages = true qhp.QtQuick.subprojects.classes.title = Classes qhp.QtQuick.subprojects.classes.title = C++ Classes -- cgit v1.2.3 From 1cdbd299884a2978a76d5d4bd4fccf4d64b1d708 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Thu, 17 Jan 2013 09:17:58 +0100 Subject: Remove outdated macro usage Change-Id: I4b58f3d74d7dec9a95a07b907c500990630e7762 Reviewed-by: Jerome Pasion Reviewed-by: Kai Koehne --- .../gettingStartedQml/parts/part5/filedialog/dialogPlugin.cpp | 3 --- .../gettingStartedQml/parts/part5/filedialog/dialogPlugin.h | 2 +- src/plugins/qmltooling/qmldbg_ost/qmlostplugin.cpp | 2 -- src/plugins/qmltooling/qmldbg_ost/qmlostplugin.h | 1 + src/qml/qml/qqmlextensionplugin.cpp | 6 +++--- src/quick/doc/src/concepts/modelviewsdata/cppmodels.qdoc | 4 ++-- 6 files changed, 7 insertions(+), 11 deletions(-) diff --git a/examples/quick/tutorials/gettingStartedQml/parts/part5/filedialog/dialogPlugin.cpp b/examples/quick/tutorials/gettingStartedQml/parts/part5/filedialog/dialogPlugin.cpp index d71e622b33..79b890c097 100644 --- a/examples/quick/tutorials/gettingStartedQml/parts/part5/filedialog/dialogPlugin.cpp +++ b/examples/quick/tutorials/gettingStartedQml/parts/part5/filedialog/dialogPlugin.cpp @@ -52,6 +52,3 @@ void DialogPlugin::registerTypes(const char *uri){ //qRegisterMetaType > ("QQmlListProperty"); } - -//FileDialog is the plugin name (same as the TARGET in the project file) and DialogPlugin is the plugin classs -Q_EXPORT_PLUGIN2(FileDialog, DialogPlugin); diff --git a/examples/quick/tutorials/gettingStartedQml/parts/part5/filedialog/dialogPlugin.h b/examples/quick/tutorials/gettingStartedQml/parts/part5/filedialog/dialogPlugin.h index 82035193c8..6776f91e2b 100644 --- a/examples/quick/tutorials/gettingStartedQml/parts/part5/filedialog/dialogPlugin.h +++ b/examples/quick/tutorials/gettingStartedQml/parts/part5/filedialog/dialogPlugin.h @@ -46,7 +46,7 @@ class DialogPlugin : public QQmlExtensionPlugin { Q_OBJECT - + Q_PLUGIN_METADATA(IID "org.qt-project.QmlExtensionPlugin.FileDialog") public: //registerTypes is inherited from QQmlExtensionPlugin void registerTypes(const char *uri); diff --git a/src/plugins/qmltooling/qmldbg_ost/qmlostplugin.cpp b/src/plugins/qmltooling/qmldbg_ost/qmlostplugin.cpp index 9b9503c937..6cc9189520 100644 --- a/src/plugins/qmltooling/qmldbg_ost/qmlostplugin.cpp +++ b/src/plugins/qmltooling/qmldbg_ost/qmlostplugin.cpp @@ -145,6 +145,4 @@ void QmlOstPlugin::readyRead() d->debugServer->receiveMessage(content); } -Q_EXPORT_PLUGIN2(qmlostplugin, QmlOstPlugin) - QT_END_NAMESPACE diff --git a/src/plugins/qmltooling/qmldbg_ost/qmlostplugin.h b/src/plugins/qmltooling/qmldbg_ost/qmlostplugin.h index 2a1031869f..15cd2af81d 100644 --- a/src/plugins/qmltooling/qmldbg_ost/qmlostplugin.h +++ b/src/plugins/qmltooling/qmldbg_ost/qmlostplugin.h @@ -53,6 +53,7 @@ class QmlOstPluginPrivate; class QmlOstPlugin : public QObject, public QQmlDebugServerConnection { Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.Qml.QmlOstPlugin") Q_DECLARE_PRIVATE(QmlOstPlugin) Q_DISABLE_COPY(QmlOstPlugin) Q_INTERFACES(QQmlDebugServerConnection) diff --git a/src/qml/qml/qqmlextensionplugin.cpp b/src/qml/qml/qqmlextensionplugin.cpp index 9f2272a04e..291292fbbe 100644 --- a/src/qml/qml/qqmlextensionplugin.cpp +++ b/src/qml/qml/qqmlextensionplugin.cpp @@ -58,8 +58,8 @@ QT_BEGIN_NAMESPACE To write a QML extension plugin: \list - \li Subclass QQmlExtensionPlugin, implement registerTypes() method - to register types using qmlRegisterType(), and export the class using the Q_EXPORT_PLUGIN2() macro + \li Subclass QQmlExtensionPlugin, implement registerTypes() method to register types + using qmlRegisterType(), and export the class using the Q_PLUGIN_METADATA() macro \li Write an appropriate project file for the plugin \li Create a \l{Module Definition qmldir Files}{qmldir file} to describe the plugin \endlist @@ -140,7 +140,7 @@ QT_BEGIN_NAMESPACE Constructs a QML extension plugin with the given \a parent. Note that this constructor is invoked automatically by the - Q_EXPORT_PLUGIN2() macro, so there is no need for calling it + Q_PLUGIN_METADATA() macro, so there is no need for calling it explicitly. */ QQmlExtensionPlugin::QQmlExtensionPlugin(QObject *parent) diff --git a/src/quick/doc/src/concepts/modelviewsdata/cppmodels.qdoc b/src/quick/doc/src/concepts/modelviewsdata/cppmodels.qdoc index d9bfee2638..8fd24b00ec 100644 --- a/src/quick/doc/src/concepts/modelviewsdata/cppmodels.qdoc +++ b/src/quick/doc/src/concepts/modelviewsdata/cppmodels.qdoc @@ -178,6 +178,8 @@ created directly as elements within QML: \code class MyModelPlugin : public QQmlExtensionPlugin { + Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.QmlExtension.MyModel" FILE "mymodel.json") public: void registerTypes(const char *uri) { @@ -185,8 +187,6 @@ public: "MyModel"); } } - -Q_EXPORT_PLUGIN2(mymodelplugin, MyModelPlugin); \endcode \li -- cgit v1.2.3 From 57f593b96f2b1af21e7d84099d169d51f698672f Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Wed, 23 Jan 2013 14:18:28 +0100 Subject: Make HTML horizontal alignment work like in QtQuick 1 If the text width set is higher than the ideal width, there's no risk of wrapping, and thus we align the text based on the full width of the Text element. This matches the behavior in Qt Quick 1.1. Task-number: QTBUG-29262 Change-Id: Ib191e3dd9d17e3bea63ca7825708f53768960e26 Reviewed-by: Gunnar Sletta --- src/quick/items/qquicktext.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/quick/items/qquicktext.cpp b/src/quick/items/qquicktext.cpp index 5a97f77e56..934451e825 100644 --- a/src/quick/items/qquicktext.cpp +++ b/src/quick/items/qquicktext.cpp @@ -527,7 +527,7 @@ void QQuickTextPrivate::updateSize() } if (internalWidthUpdate) return; - if (wrapMode != QQuickText::NoWrap && q->widthValid()) + if (q->widthValid() && (wrapMode != QQuickText::NoWrap || extra->doc->idealWidth() < q->width())) extra->doc->setTextWidth(q->width()); else extra->doc->setTextWidth(extra->doc->idealWidth()); // ### Text does not align if width is not set (QTextDoc bug) -- cgit v1.2.3 From 38d42bf35fdd72db301c4b8ddc32080d0862620d Mon Sep 17 00:00:00 2001 From: Jerome Pasion Date: Mon, 21 Jan 2013 16:56:02 +0100 Subject: Doc: Updated change log with documentation entry Change-Id: I1cd4dc70265f2425045328910be12a0cfaeb795c Reviewed-by: Sergio Ahumada --- dist/changes-5.0.1 | 1 + 1 file changed, 1 insertion(+) diff --git a/dist/changes-5.0.1 b/dist/changes-5.0.1 index d19b58f0de..d0d6d1844e 100644 --- a/dist/changes-5.0.1 +++ b/dist/changes-5.0.1 @@ -28,6 +28,7 @@ General Improvements - qmltest: Added the possibility to use QApplication - [QTBUG-28611] Quick tests: Introduce QQmlMessageHandler. - Compile with QT_NO_WHEELEVENT. + - Various documentation improvements. **************************************************************************** * Library * -- cgit v1.2.3 From c5fb0a9d8a7eedaed0c4ecfe354219a9d252062f Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Wed, 23 Jan 2013 22:02:53 -0600 Subject: Disconnect from previous loading image when loading a new image. Change-Id: If2fa95d9715a55d3f07ecf5f232e4f4b9a44a6fb Reviewed-by: Gunnar Sletta --- src/quick/items/qquickimagebase.cpp | 1 + .../auto/quick/qquickimage/data/correctStatus.qml | 26 +++++++++++ tests/auto/quick/qquickimage/tst_qquickimage.cpp | 51 ++++++++++++++++++++++ 3 files changed, 78 insertions(+) create mode 100644 tests/auto/quick/qquickimage/data/correctStatus.qml diff --git a/src/quick/items/qquickimagebase.cpp b/src/quick/items/qquickimagebase.cpp index 2a9edb37d1..c07f7067f5 100644 --- a/src/quick/items/qquickimagebase.cpp +++ b/src/quick/items/qquickimagebase.cpp @@ -207,6 +207,7 @@ void QQuickImageBase::load() options |= QQuickPixmap::Asynchronous; if (d->cache) options |= QQuickPixmap::Cache; + d->pix.clear(this); d->pix.load(qmlEngine(this), d->url, d->sourcesize, options); if (d->pix.isLoading()) { diff --git a/tests/auto/quick/qquickimage/data/correctStatus.qml b/tests/auto/quick/qquickimage/data/correctStatus.qml new file mode 100644 index 0000000000..2326078657 --- /dev/null +++ b/tests/auto/quick/qquickimage/data/correctStatus.qml @@ -0,0 +1,26 @@ +import QtQuick 2.0 + +Item { + property alias status: image1.status + + Image { + id: image1 + asynchronous: true + source: "image://test/first-image.png" + } + + Image { + id: image2 + asynchronous: true + source: "image://test/first-image.png" + } + + Timer { + interval: 50 + running: true + repeat: false + onTriggered: { + image1.source = "image://test/second-image.png" + } + } +} diff --git a/tests/auto/quick/qquickimage/tst_qquickimage.cpp b/tests/auto/quick/qquickimage/tst_qquickimage.cpp index 7f3f0d5cbc..51ac5c640a 100644 --- a/tests/auto/quick/qquickimage/tst_qquickimage.cpp +++ b/tests/auto/quick/qquickimage/tst_qquickimage.cpp @@ -56,6 +56,7 @@ #include #include #include +#include #include "../../shared/util.h" #include "../../shared/testhttpserver.h" @@ -102,6 +103,7 @@ private slots: void sourceSize(); void progressAndStatusChanges(); void sourceSizeChanges(); + void correctStatus(); private: QQmlEngine engine; @@ -868,6 +870,55 @@ void tst_qquickimage::progressAndStatusChanges() delete obj; } +class TestQImageProvider : public QQuickImageProvider +{ +public: + TestQImageProvider() : QQuickImageProvider(Image) {} + + QImage requestImage(const QString &id, QSize *size, const QSize& requestedSize) + { + if (id == QLatin1String("first-image.png")) { + QTest::qWait(50); + int width = 100; + int height = 100; + QImage image(width, height, QImage::Format_RGB32); + image.fill(QColor("yellow").rgb()); + if (size) + *size = QSize(width, height); + return image; + } + + QTest::qWait(400); + int width = 100; + int height = 100; + QImage image(width, height, QImage::Format_RGB32); + image.fill(QColor("green").rgb()); + if (size) + *size = QSize(width, height); + return image; + } +}; + +void tst_qquickimage::correctStatus() +{ + QQmlEngine engine; + engine.addImageProvider(QLatin1String("test"), new TestQImageProvider()); + + QQmlComponent component(&engine, testFileUrl("correctStatus.qml")); + QObject *obj = component.create(); + QVERIFY(obj); + + QTest::qWait(200); + + // at this point image1 should be attempting to load second-image.png, + // and should be in the loading state. Without a clear prior to that load, + // the status can mistakenly be in the ready state. + QCOMPARE(obj->property("status").toInt(), int(QQuickImage::Loading)); + + QTest::qWait(400); + delete obj; +} + QTEST_MAIN(tst_qquickimage) #include "tst_qquickimage.moc" -- cgit v1.2.3 From dde265294fb8c48f9e0dce95d2287482ef0c0c6b Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 24 Jan 2013 10:28:19 +0100 Subject: Fix alignment of Text element with implicit size In change e1d6b323d474acc5cd70fd9a0b283326316f55a0 there's an optimization which disables layouts on the QTextDocument, but the layout has to be re-enabled before we can call idealWidth() since this will be zero as long as the page size is 0x0. We simply set the page size to undefined again before calling idealWidth. Task-number: QTBUG-29262 Change-Id: I6bebe7be4c99fce0de8fc4178b5e1abc81abbe87 Reviewed-by: Michael Brasser Reviewed-by: aavit --- src/quick/items/qquicktext.cpp | 3 ++ .../data/text/text_html_center_tag.qml | 35 ++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 tests/manual/scenegraph_lancelot/data/text/text_html_center_tag.qml diff --git a/src/quick/items/qquicktext.cpp b/src/quick/items/qquicktext.cpp index 934451e825..917eaeadd8 100644 --- a/src/quick/items/qquicktext.cpp +++ b/src/quick/items/qquicktext.cpp @@ -527,10 +527,13 @@ void QQuickTextPrivate::updateSize() } if (internalWidthUpdate) return; + + extra->doc->setPageSize(QSizeF()); if (q->widthValid() && (wrapMode != QQuickText::NoWrap || extra->doc->idealWidth() < q->width())) extra->doc->setTextWidth(q->width()); else extra->doc->setTextWidth(extra->doc->idealWidth()); // ### Text does not align if width is not set (QTextDoc bug) + widthExceeded = extra->doc->textWidth() < extra->doc->idealWidth(); QSizeF dsize = extra->doc->size(); layedOutTextRect = QRectF(QPointF(0,0), dsize); diff --git a/tests/manual/scenegraph_lancelot/data/text/text_html_center_tag.qml b/tests/manual/scenegraph_lancelot/data/text/text_html_center_tag.qml new file mode 100644 index 0000000000..86b528f0a4 --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/text/text_html_center_tag.qml @@ -0,0 +1,35 @@ +import QtQuick 2.0 + +Item { + width: 320 + height: 480 + + Text { + id: implicitSizedText + textFormat: Text.RichText + text: "
Implicit size
----- Second line -----
" + anchors.centerIn: parent + color: "white" + + Rectangle { + anchors.fill: parent + z: -1 + color: "blue" + } + } + Text { + textFormat: Text.RichText + text: "
Explicit size
----- Second line -----
" + anchors.top: implicitSizedText.bottom + anchors.topMargin: 10 + anchors.horizontalCenter: parent.horizontalCenter + width: 300 + color: "white" + + Rectangle { + anchors.fill: parent + z: -1 + color: "blue" + } + } +} -- cgit v1.2.3 From d4425318801c055127dba04792ebf4ef69643b6e Mon Sep 17 00:00:00 2001 From: Debao Zhang Date: Thu, 10 Jan 2013 15:47:11 +0800 Subject: Doc: Fix uses of \since Change-Id: Idf497424279fbee08e6e5750e6a15372c808105f Reviewed-by: Joerg Bornemann Reviewed-by: Jerome Pasion --- src/qml/qml/v8/qjsengine.cpp | 1 - src/quick/util/qquickimageprovider.cpp | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/qml/qml/v8/qjsengine.cpp b/src/qml/qml/v8/qjsengine.cpp index acc734d549..5b1464afe6 100644 --- a/src/qml/qml/v8/qjsengine.cpp +++ b/src/qml/qml/v8/qjsengine.cpp @@ -349,7 +349,6 @@ QJSValue QJSEngine::create(int type, const void *ptr) /*! \internal - \since 4.5 convert \a value to \a type, store the result in \a ptr */ bool QJSEngine::convertV2(const QJSValue &value, int type, void *ptr) diff --git a/src/quick/util/qquickimageprovider.cpp b/src/quick/util/qquickimageprovider.cpp index fb75a7669e..4e3748f78f 100644 --- a/src/quick/util/qquickimageprovider.cpp +++ b/src/quick/util/qquickimageprovider.cpp @@ -52,7 +52,7 @@ public: /*! \class QQuickTextureFactory - \since 5.0 + \since QtQuick 2.0 \brief The QQuickTextureFactory class provides an interface for loading custom textures from QML. \inmodule QtQuick @@ -127,7 +127,7 @@ QImage QQuickTextureFactory::image() const /*! \class QQuickImageProvider - \since 5.0 + \since QtQuick 2.0 \inmodule QtQuick \brief The QQuickImageProvider class provides an interface for supporting pixmaps and threaded image requests in QML. -- cgit v1.2.3 From 6933b7e8e6dc279a8eb34e1f4c60bc109dfb7d26 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Fri, 11 Jan 2013 14:48:32 +0100 Subject: Ungrab mouse when FocusAboutToChange instead of Leave Commit 7b2e2117162594a2d0234bb02408f5b5a446488b introduced a regression in mouse handling: When moving the mouse out of the window it would cancel all further mouse events. That is actually not wanted (eg scroll bars). Instead ungrab the mouse when the focus changes, that means the mouse handling with popups works and the scrollbar use case is also fixed. All the tests related to this seem quite timing sensitive, so try some more QTRY_VERIFY. Remove the parallel_test so that more cpu time will actually let the tests pass more reliably. Change-Id: I90586b05f461d3762728a466d71bcb967e03d14b Reviewed-by: Gabriel de Dietrich --- src/quick/items/qquickwindow.cpp | 4 ++-- .../auto/quick/qquickflickable/qquickflickable.pro | 1 - .../quick/qquickflickable/tst_qquickflickable.cpp | 10 ++++----- .../auto/quick/qquickmousearea/qquickmousearea.pro | 2 -- .../quick/qquickmousearea/tst_qquickmousearea.cpp | 26 +++++++++++++--------- 5 files changed, 23 insertions(+), 20 deletions(-) diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp index f812840782..f4334286fa 100644 --- a/src/quick/items/qquickwindow.cpp +++ b/src/quick/items/qquickwindow.cpp @@ -1129,8 +1129,6 @@ bool QQuickWindow::event(QEvent *e) case QEvent::Leave: d->clearHover(); d->lastMousePosition = QPoint(); - if (d->mouseGrabberItem) - d->mouseGrabberItem->ungrabMouse(); break; #ifndef QT_NO_DRAGANDDROP case QEvent::DragEnter: @@ -1148,6 +1146,8 @@ bool QQuickWindow::event(QEvent *e) if (d->activeFocusItem) qGuiApp->inputMethod()->commit(); #endif + if (d->mouseGrabberItem) + d->mouseGrabberItem->ungrabMouse(); break; default: break; diff --git a/tests/auto/quick/qquickflickable/qquickflickable.pro b/tests/auto/quick/qquickflickable/qquickflickable.pro index 3ba752bf7d..95c703befe 100644 --- a/tests/auto/quick/qquickflickable/qquickflickable.pro +++ b/tests/auto/quick/qquickflickable/qquickflickable.pro @@ -9,6 +9,5 @@ include (../shared/util.pri) TESTDATA = data/* -CONFIG += parallel_test QT += core-private gui-private v8-private qml-private quick-private testlib DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp index 662e86018c..784988b913 100644 --- a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp +++ b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp @@ -618,7 +618,7 @@ void tst_qquickflickable::movingAndFlicking() window->setSource(testFileUrl("flickable03.qml")); window->show(); window->requestActivate(); - QTest::qWaitForWindowActive(window); + QVERIFY(QTest::qWaitForWindowActive(window)); QVERIFY(window->rootObject() != 0); QQuickFlickable *flickable = qobject_cast(window->rootObject()); @@ -639,7 +639,7 @@ void tst_qquickflickable::movingAndFlicking() // do a flick that keeps the view within the bounds flick(window, flickFrom, flickToWithoutSnapBack, 200); - QVERIFY(flickable->isMoving()); + QTRY_VERIFY(flickable->isMoving()); QCOMPARE(flickable->isMovingHorizontally(), horizontalEnabled); QCOMPARE(flickable->isMovingVertically(), verticalEnabled); QVERIFY(flickable->isFlicking()); @@ -695,7 +695,7 @@ void tst_qquickflickable::movingAndFlicking() QTRY_VERIFY(!flickable->isMoving()); flick(window, flickFrom, flickToWithSnapBack, 200); - QVERIFY(flickable->isMoving()); + QTRY_VERIFY(flickable->isMoving()); QCOMPARE(flickable->isMovingHorizontally(), horizontalEnabled); QCOMPARE(flickable->isMovingVertically(), verticalEnabled); QVERIFY(flickable->isFlicking()); @@ -999,7 +999,7 @@ void tst_qquickflickable::pressWhileFlicking() // flicking == false, moving == true; flick(window, QPoint(20,190), QPoint(20, 50), 200); QVERIFY(flickable->verticalVelocity() > 0.0); - QVERIFY(flickable->isFlicking()); + QTRY_VERIFY(flickable->isFlicking()); QVERIFY(flickable->isFlickingVertically()); QVERIFY(!flickable->isFlickingHorizontally()); QVERIFY(flickable->isMoving()); @@ -1257,7 +1257,7 @@ void tst_qquickflickable::flickTwiceUsingTouches() window->setSource(testFileUrl("longList.qml")); window->show(); window->requestActivate(); - QTest::qWaitForWindowActive(window); + QVERIFY(QTest::qWaitForWindowActive(window)); QVERIFY(window->rootObject() != 0); QQuickFlickable *flickable = qobject_cast(window->rootObject()); diff --git a/tests/auto/quick/qquickmousearea/qquickmousearea.pro b/tests/auto/quick/qquickmousearea/qquickmousearea.pro index 957b04a558..dd7b434898 100644 --- a/tests/auto/quick/qquickmousearea/qquickmousearea.pro +++ b/tests/auto/quick/qquickmousearea/qquickmousearea.pro @@ -10,7 +10,5 @@ include (../../shared/util.pri) TESTDATA = data/* -CONFIG += parallel_test - QT += core-private gui-private qml-private quick-private network testlib DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp b/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp index 9fd42373e2..ffe7b51537 100644 --- a/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp +++ b/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp @@ -248,7 +248,7 @@ void tst_QQuickMouseArea::dragging() window->setSource(testFileUrl("dragging.qml")); window->show(); window->requestActivate(); - QTest::qWait(20); + QVERIFY(QTest::qWaitForWindowExposed(window)); QVERIFY(window->rootObject() != 0); QQuickMouseArea *mouseRegion = window->rootObject()->findChild("mouseregion"); @@ -274,19 +274,17 @@ void tst_QQuickMouseArea::dragging() // First move event triggers drag, second is acted upon. // This is due to possibility of higher stacked area taking precedence. - QTest::mouseMove(window, QPoint(111,111)); - QTest::qWait(50); - QTest::mouseMove(window, QPoint(122,122)); - QTest::qWait(50); + QTest::mouseMove(window, QPoint(111,111), 50); + QTest::mouseMove(window, QPoint(116,116), 50); + QTest::mouseMove(window, QPoint(122,122), 50); - QVERIFY(drag->active()); - QCOMPARE(blackRect->x(), 72.0); + QTRY_VERIFY(drag->active()); + QTRY_COMPARE(blackRect->x(), 72.0); QCOMPARE(blackRect->y(), 72.0); QTest::mouseRelease(window, button, 0, QPoint(122,122)); - QTest::qWait(50); - QVERIFY(!drag->active()); + QTRY_VERIFY(!drag->active()); QCOMPARE(blackRect->x(), 72.0); QCOMPARE(blackRect->y(), 72.0); @@ -477,20 +475,28 @@ void tst_QQuickMouseArea::noOnClickedWithPressAndHold() window->show(); window->requestActivate(); QVERIFY(window->rootObject() != 0); + QQuickMouseArea *mouseArea = qobject_cast(window->rootObject()->children().first()); + QVERIFY(mouseArea); QMouseEvent pressEvent(QEvent::MouseButtonPress, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, 0); QGuiApplication::sendEvent(window, &pressEvent); + QVERIFY(mouseArea->pressedButtons() == Qt::LeftButton); QVERIFY(!window->rootObject()->property("clicked").toBool()); QVERIFY(!window->rootObject()->property("held").toBool()); + // timeout is 800 (in qquickmousearea.cpp) QTest::qWait(1000); + QCoreApplication::processEvents(); + + QVERIFY(!window->rootObject()->property("clicked").toBool()); + QVERIFY(window->rootObject()->property("held").toBool()); QMouseEvent releaseEvent(QEvent::MouseButtonRelease, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, 0); QGuiApplication::sendEvent(window, &releaseEvent); + QTRY_VERIFY(window->rootObject()->property("held").toBool()); QVERIFY(!window->rootObject()->property("clicked").toBool()); - QVERIFY(window->rootObject()->property("held").toBool()); delete window; } -- cgit v1.2.3 From 6bffd4b52ddf1d5040936cc2f387b7dc99ad0cfc Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Thu, 24 Jan 2013 15:43:32 +0100 Subject: Doc: Add QML Types to table of contents in Assistant Replace 'headerfile' with 'qmlclass' in qdocconf file. As a positive side-effect, QDoc will also add files for 'All members' for QML Types into .qhp as well. Task-number: QTBUG-29226 Change-Id: I282ef42283ec147ea0f2b466b15e7f104c8a012a Reviewed-by: Jerome Pasion Reviewed-by: Venugopal Shivashankar --- src/quick/doc/qtquick.qdocconf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/quick/doc/qtquick.qdocconf b/src/quick/doc/qtquick.qdocconf index 5131db03b4..6af5a1281c 100644 --- a/src/quick/doc/qtquick.qdocconf +++ b/src/quick/doc/qtquick.qdocconf @@ -20,7 +20,7 @@ qhp.QtQuick.customFilters.Qt.filterAttributes = qtquick 5.0.1 qhp.QtQuick.subprojects = qmltypes classes examples qhp.QtQuick.subprojects.qmltypes.title = QML Types qhp.QtQuick.subprojects.qmltypes.indexTitle = Qt Quick QML Types -qhp.QtQuick.subprojects.qmltypes.selectors = fake:headerfile +qhp.QtQuick.subprojects.qmltypes.selectors = fake:qmlclass qhp.QtQuick.subprojects.qmltypes.sortPages = true qhp.QtQuick.subprojects.classes.title = Classes qhp.QtQuick.subprojects.classes.title = C++ Classes -- cgit v1.2.3 From d2491c6e2445f672ac97420d8aa03bd235aad825 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Fri, 25 Jan 2013 10:22:08 -0600 Subject: Prevent possible leak with texture providers. If the job has been cancelled, ensure we clean up the texture factory that was created. Change-Id: I0a6e4a23732e6041084ddc483d701a25befd91c9 Reviewed-by: Gunnar Sletta --- src/quick/util/qquickpixmapcache.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/quick/util/qquickpixmapcache.cpp b/src/quick/util/qquickpixmapcache.cpp index e43c5e9b71..dda2fbe2b0 100644 --- a/src/quick/util/qquickpixmapcache.cpp +++ b/src/quick/util/qquickpixmapcache.cpp @@ -565,6 +565,8 @@ void QQuickPixmapReader::processJob(QQuickPixmapReply *runningJob, const QUrl &u mutex.lock(); if (!cancelled.contains(runningJob)) runningJob->postReply(errorCode, errorStr, readSize, t); + else + delete t; mutex.unlock(); } -- cgit v1.2.3 From 7cbfd6b3d26df37d06b54ecc873acb63dfa945e8 Mon Sep 17 00:00:00 2001 From: Fabian Bumberger Date: Fri, 25 Jan 2013 16:47:34 +0100 Subject: Introduce a workaround for a GLSL bug on BB10 When using the sizeTable property of the QQuickImageParticles, the vertex shader is not compiling. This is a workaround for a compiler bug on BB10. Change-Id: I32d5e92bc300304cb856d97b1310f607df1e48be Reviewed-by: Alan Alpert --- src/particles/qquickimageparticle.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/particles/qquickimageparticle.cpp b/src/particles/qquickimageparticle.cpp index bb6edb26a5..e0572ef424 100644 --- a/src/particles/qquickimageparticle.cpp +++ b/src/particles/qquickimageparticle.cpp @@ -128,7 +128,11 @@ static const char vertexShaderCode[] = " fTex = vPosTex.zw;\n" "#endif\n" " highp float currentSize = mix(vData.z, vData.w, t * t);\n" +#if defined (Q_OS_BLACKBERRY) + " highp float fade = 1.;\n" +#else " lowp float fade = 1.;\n" +#endif " highp float fadeIn = min(t * 10., 1.);\n" " highp float fadeOut = 1. - clamp((t - 0.75) * 4.,0., 1.);\n" "\n" -- cgit v1.2.3 From 6c18353123f22c1279258f8ccbd7c45c98bd0980 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 24 Jan 2013 18:32:19 +0100 Subject: fix installation of qmltestcase example split the project along the built-as-part-of-qt line: in qt, it must comply with the installation rules for examples, and it shouldn't be an actual test case - our CI is not supposed to run it ... the stand-alone build (which users are supposed to make use of) needed adding TESTDATA for proper installation. Change-Id: I1bbf7b1204410c5eb8755477310bb023e8f87623 Reviewed-by: Alan Alpert --- examples/qmltest/qmltest/qmltest.pro | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/examples/qmltest/qmltest/qmltest.pro b/examples/qmltest/qmltest/qmltest.pro index 3ade5f2cbd..f290fd21e1 100644 --- a/examples/qmltest/qmltest/qmltest.pro +++ b/examples/qmltest/qmltest/qmltest.pro @@ -1,11 +1,26 @@ TEMPLATE=app TARGET=tst_qmltestexample -CONFIG += qmltestcase + SOURCES += tst_qmltest.cpp -# Note: Normally, tests are auto-installed to a test-specific directory. Overwritten here -# so this one will end up in the examples tree. +!QTDIR_build { +# This is the code actual testcases should use: + +CONFIG += qmltestcase + +TESTDATA += tst_basic.qml tst_item.qml + +} else { +# This code exists solely for the purpose of building this example +# inside the examples/ hierarchy. + +QT += qml qmltest + +macx: CONFIG -= app_bundle + target.path = $$[QT_INSTALL_EXAMPLES]/qmltest qml.files = tst_basic.qml tst_item.qml qml.path = $$[QT_INSTALL_EXAMPLES]/qmltest INSTALLS += target qml + +} -- cgit v1.2.3 From 99cf339f964218ee0762aa6f95189b2cac3a1240 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 24 Jan 2013 21:20:45 +0100 Subject: mark forgotten EXAMPLE_FILES Change-Id: I83c7706479ea3afd45ab9c97f63f68d416b28f55 Reviewed-by: Alan Alpert --- examples/quick/particles/particles.pro | 1 + examples/quick/window/window/window.pro | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/examples/quick/particles/particles.pro b/examples/quick/particles/particles.pro index 9200113be8..2ea61751fb 100644 --- a/examples/quick/particles/particles.pro +++ b/examples/quick/particles/particles.pro @@ -6,6 +6,7 @@ SUBDIRS += affectors \ system EXAMPLE_FILES = \ + images.qrc \ itemparticle #Install shared images too diff --git a/examples/quick/window/window/window.pro b/examples/quick/window/window/window.pro index e62decb733..3525a893fa 100644 --- a/examples/quick/window/window/window.pro +++ b/examples/quick/window/window/window.pro @@ -4,5 +4,10 @@ QT += qml SOURCES += window.cpp RESOURCES += window.qrc +EXAMPLE_FILES = \ + nogui.qml \ + standalone.qml \ + twowindows.qml + target.path = $$[QT_INSTALL_EXAMPLES]/quick/window/window INSTALLS = target -- cgit v1.2.3 From 8fcecca8d29cfe5946040a12b3fa73432a89ae76 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 24 Jan 2013 21:37:24 +0100 Subject: fix qmltest example install path Change-Id: I267155bb34b8226331fc2951521dc7b8643a014c Reviewed-by: Alan Alpert --- examples/qmltest/qmltest/qmltest.pro | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/qmltest/qmltest/qmltest.pro b/examples/qmltest/qmltest/qmltest.pro index f290fd21e1..b5893c5a1e 100644 --- a/examples/qmltest/qmltest/qmltest.pro +++ b/examples/qmltest/qmltest/qmltest.pro @@ -18,9 +18,9 @@ QT += qml qmltest macx: CONFIG -= app_bundle -target.path = $$[QT_INSTALL_EXAMPLES]/qmltest +target.path = $$[QT_INSTALL_EXAMPLES]/qmltest/qmltest qml.files = tst_basic.qml tst_item.qml -qml.path = $$[QT_INSTALL_EXAMPLES]/qmltest +qml.path = $$[QT_INSTALL_EXAMPLES]/qmltest/qmltest INSTALLS += target qml } -- cgit v1.2.3 From a74a2e913b66bde774a78ed679b08501012c2a53 Mon Sep 17 00:00:00 2001 From: Sze Howe Koh Date: Mon, 28 Jan 2013 08:48:16 +0800 Subject: Doc: Fix "Command '\li' outside of '\list' and '\table'" It doesn't look like any list is meant to be here. All other instances of "down" are italicized in this document, so we follow suit. Change-Id: I2f0c55dba2025b4eef81248a5f650ebaaaa5bb3a Reviewed-by: Jerome Pasion --- src/quick/doc/src/tutorial.qdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/quick/doc/src/tutorial.qdoc b/src/quick/doc/src/tutorial.qdoc index 21a5b8daee..7dbb211cb8 100644 --- a/src/quick/doc/src/tutorial.qdoc +++ b/src/quick/doc/src/tutorial.qdoc @@ -219,7 +219,7 @@ Because we don't want the text to appear at the bottom instantly but rather move we add a transition between our two states. \c from and \c to define the states between which the transition will run. -In this case, we want a transition from the default state to our \li down state. +In this case, we want a transition from the default state to our \e down state. Because we want the same transition to be run in reverse when changing back from the \e down state to the default state, we set \c reversible to \c true. -- cgit v1.2.3 From 394d83e86fa193d0df770f7a94627681ac2f7c1c Mon Sep 17 00:00:00 2001 From: Sze Howe Koh Date: Sun, 27 Jan 2013 16:39:08 +0800 Subject: Fix unterminated comment Change-Id: Ic5bcbac339588fdded265a00515f768058d73870 Reviewed-by: Laszlo Papp Reviewed-by: Jerome Pasion --- src/quick/doc/src/appdevguide/deployment.qdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/quick/doc/src/appdevguide/deployment.qdoc b/src/quick/doc/src/appdevguide/deployment.qdoc index a6a8d88841..bf98902c17 100644 --- a/src/quick/doc/src/appdevguide/deployment.qdoc +++ b/src/quick/doc/src/appdevguide/deployment.qdoc @@ -208,4 +208,4 @@ be used to build the application resources: See \l {The Qt Resource System} for more information. - +*/ -- cgit v1.2.3 From a717da652a767fb276b2bff7c90f53e768933195 Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Mon, 28 Jan 2013 12:17:24 +0100 Subject: Doc: corrected path to snippet Added "quick" to path in imageparticle.qdoc Task-number: QTBUG-29101 Change-Id: If328cde08f46b720defa1953916753ba9d9836a8 Reviewed-by: Jerome Pasion --- examples/quick/particles/imageparticle/doc/src/imageparticle.qdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/quick/particles/imageparticle/doc/src/imageparticle.qdoc b/examples/quick/particles/imageparticle/doc/src/imageparticle.qdoc index 62c1a06839..e72a90349e 100644 --- a/examples/quick/particles/imageparticle/doc/src/imageparticle.qdoc +++ b/examples/quick/particles/imageparticle/doc/src/imageparticle.qdoc @@ -38,7 +38,7 @@ \snippet particles/imageparticle/content/allatonce.qml 0 Colored shows a simple ImageParticle with some color variation. - \snippet particles/imageparticle/content/colored.qml 0 + \snippet quick/particles/imageparticle/content/colored.qml 0 Color Table sets the color over life on the particles to provide a fixed rainbow effect. \snippet particles/imageparticle/content/colortable.qml 0 -- cgit v1.2.3 From f4d4689d3c09cb4eae30be892be426d4fa185ed4 Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Mon, 28 Jan 2013 13:29:36 +0100 Subject: Doc: declarative-colors.png not visible in qmltypereference.qdoc Copied the file from qml image dir to quick image dir Task-number: QTBUG-29101 Change-Id: Iae64763bc38e135a0dbff8566cf540a309e4c42f Reviewed-by: Jerome Pasion --- src/quick/doc/images/declarative-colors.png | Bin 0 -> 4993 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 src/quick/doc/images/declarative-colors.png diff --git a/src/quick/doc/images/declarative-colors.png b/src/quick/doc/images/declarative-colors.png new file mode 100644 index 0000000000..f2eacd889b Binary files /dev/null and b/src/quick/doc/images/declarative-colors.png differ -- cgit v1.2.3 From ca711d7e6878de89ba0ae4fe6ec61d9946199fd9 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Thu, 24 Jan 2013 17:42:20 -0800 Subject: Fix memory leak The cache is filled with dynamically created entries, so clear is not quite enough. Change-Id: I40a49ce5d1a3d6da1b419e85cae95f2f95011a19 Reviewed-by: Laszlo Papp Reviewed-by: Christopher Adams --- src/qml/qml/qqmlimport.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/qml/qml/qqmlimport.cpp b/src/qml/qml/qqmlimport.cpp index f2573895c6..fb4d8c007f 100644 --- a/src/qml/qml/qqmlimport.cpp +++ b/src/qml/qml/qqmlimport.cpp @@ -1344,6 +1344,7 @@ QQmlImportDatabase::QQmlImportDatabase(QQmlEngine *e) QQmlImportDatabase::~QQmlImportDatabase() { + qDeleteAll(qmldirCache); qmldirCache.clear(); } -- cgit v1.2.3 From 6327d2947162b54d0618353c015190a64706c318 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Mon, 28 Jan 2013 12:15:54 +0100 Subject: docfix: Emitter.enabled was documented as Emitter.emitting. Change-Id: I9500c336b9e11f858da95ff4ed783b70876f3fd6 Reviewed-by: Alan Alpert --- src/particles/qquickparticleemitter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/particles/qquickparticleemitter.cpp b/src/particles/qquickparticleemitter.cpp index eeb0aef715..b4e3a82cb2 100644 --- a/src/particles/qquickparticleemitter.cpp +++ b/src/particles/qquickparticleemitter.cpp @@ -88,7 +88,7 @@ QT_BEGIN_NAMESPACE box of the Emitter. */ /*! - \qmlproperty bool QtQuick.Particles2::Emitter::emitting + \qmlproperty bool QtQuick.Particles2::Emitter::enabled If set to false, the emitter will cease emissions until it is set to true. -- cgit v1.2.3 From d005c5c80b6fff835adb350a780d80348549bc64 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Thu, 24 Jan 2013 17:31:41 -0800 Subject: Strengthen reference to var properties during construction Normally var properties are kept alive by a reference to the object they are declared on, but during the construction of that object the GC may not be aware of said object. This change uses a strong reference during GC passes which take place while the object is being constructed. Task-number: QTBUG-29138 Change-Id: Ieecfcc7567aefac0d67cb933728daf16ed3eed0a Reviewed-by: Christopher Adams --- src/qml/qml/v8/qv8engine.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/qml/qml/v8/qv8engine.cpp b/src/qml/qml/v8/qv8engine.cpp index 3fe3d28b67..2619c1a484 100644 --- a/src/qml/qml/v8/qv8engine.cpp +++ b/src/qml/qml/v8/qv8engine.cpp @@ -813,6 +813,12 @@ QDateTime QV8Engine::qtDateTimeFromJsDate(double jsDate) v8::Persistent *QV8Engine::findOwnerAndStrength(QObject *object, bool *shouldBeStrong) { + QQmlData *data = QQmlData::get(object); + if (data && data->rootObjectInCreation) { // When the object is still being created it may not show up to the GC. + *shouldBeStrong = true; + return 0; + } + QObject *parent = object->parent(); if (!parent) { // if the object has JS ownership, the object's v8object owns the lifetime of the persistent value. -- cgit v1.2.3 From 15b232bf694fedf553abac09af077a58ce571f9d Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Wed, 30 Jan 2013 10:43:59 +0100 Subject: Document QQuickItem::itemChange and QQuickItem::window() properly Change-Id: Ic0e50ae8760c0c3050db3a095b0fa86679a0c010 Reviewed-by: Alan Alpert --- src/quick/items/qquickitem.cpp | 90 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 87 insertions(+), 3 deletions(-) diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp index 08f60aeb1e..d72a7b1a1d 100644 --- a/src/quick/items/qquickitem.cpp +++ b/src/quick/items/qquickitem.cpp @@ -1686,14 +1686,90 @@ void QQuickItemPrivate::updateSubFocusItem(QQuickItem *scope, bool focus) /*! \enum QQuickItem::ItemChange - \internal + \brief Used in conjunction with QQuickItem::itemChange() to notify + the item about certain types of changes. + + \value ItemChildAddedChange A child was added. ItemChangeData::item contains + the added child. + + \value ItemChildRemovedChange A child was removed. ItemChangeData::item + contains the removed child. + + \value ItemSceneChange The item was added to or removed from a scene. The + QQuickWindow rendering the scene is specified in using ItemChangeData::window. + The window parameter is null when the item is removed from a scene. + + \value ItemVisibleHasChanged The item's visibility has changed. + ItemChangeData::boolValue contains the new visibility. + + \value ItemParentHasChanged The item's parent has changed. + ItemChangeData::item contains the new parent. + + \value ItemOpacityHasChanged The item's opacity has changed. + ItemChangeData::realValue contains the new opacity. + + \value ItemActiveFocusHasChanged The item's focus has changed. + ItemChangeData::boolValue contains whether the item has focus or not. + + \value ItemRotationHasChanged The item's rotation has changed. + ItemChangeData::realValue contains the new rotation. */ /*! \class QQuickItem::ItemChangeData - \internal + \inmodule QtQuick + \brief Adds supplimentary information to the QQuickItem::itemChange() + function. + + The meaning of each member of this class is defined by the change type. + + \sa QQuickItem::ItemChange */ +/*! + \fn QQuickItem::ItemChangeData::ItemChangeData(QQuickItem *) + \internal + */ + +/*! + \fn QQuickItem::ItemChangeData::ItemChangeData(QQuickWindow *) + \internal + */ + +/*! + \fn QQuickItem::ItemChangeData::ItemChangeData(qreal) + \internal + */ + +/*! + \fn QQuickItem::ItemChangeData::ItemChangeData(bool) + \internal + */ + +/*! + \variable QQuickItem::ItemChangeData::realValue + Contains supplimentary information to the QQuickItem::itemChange() function. + \sa QQuickItem::ItemChange + */ + +/*! + \variable QQuickItem::ItemChangeData::boolValue + Contains supplimentary information to the QQuickItem::itemChange() function. + \sa QQuickItem::ItemChange + */ + +/*! + \variable QQuickItem::ItemChangeData::item + Contains supplimentary information to the QQuickItem::itemChange() function. + \sa QQuickItem::ItemChange + */ + +/*! + \variable QQuickItem::ItemChangeData::window + Contains supplimentary information to the QQuickItem::itemChange() function. + \sa QQuickItem::ItemChange + */ + /*! \enum QQuickItem::TransformOrigin @@ -2141,6 +2217,11 @@ void QQuickItem::stackAfter(const QQuickItem *sibling) /*! Returns the window in which this item is rendered. + + The item does not have a window until it has been assigned into a scene. To + get notification about this, reimplement the itemChange() function and + listen for the ItemSceneChange change. The itemChange() function is called + both when the item is entered into a scene and when it is removed from a scene. */ QQuickWindow *QQuickItem::window() const { @@ -4170,7 +4251,10 @@ void QQuickItemPrivate::deliverDragEvent(QEvent *e) #endif // QT_NO_DRAGANDDROP /*! - \internal + Called when \a change occurs for this item. + + \a value contains extra information relating to the change, when + applicable. */ void QQuickItem::itemChange(ItemChange change, const ItemChangeData &value) { -- cgit v1.2.3 From 561ab99ad65711b61c47df9bd78ea928de525a53 Mon Sep 17 00:00:00 2001 From: Andrew den Exter Date: Wed, 19 Dec 2012 17:12:58 +1000 Subject: Ensure the cursorRectangle is updated as the width of the text changes. Outside of when of a monospace font is used, if the text changes the visual position of the cursor will have most likely changed as well even when the cursor index hasn't. Task-number: QTBUG-28677 Change-Id: If8077772d8541a677d5875976e6cd9fc453731df Reviewed-by: Alan Alpert --- src/quick/items/qquicktextinput.cpp | 4 +++- tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp | 8 ++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/quick/items/qquicktextinput.cpp b/src/quick/items/qquicktextinput.cpp index 906758903d..b305ad116a 100644 --- a/src/quick/items/qquicktextinput.cpp +++ b/src/quick/items/qquicktextinput.cpp @@ -3275,6 +3275,7 @@ bool QQuickTextInputPrivate::finishChange(int validateFromState, bool update, bo bool inputMethodAttributesChanged = m_textDirty || m_selDirty; #endif bool alignmentChanged = false; + bool textChanged = false; if (m_textDirty) { // do validation @@ -3309,6 +3310,7 @@ bool QQuickTextInputPrivate::finishChange(int validateFromState, bool update, bo } if (m_textDirty) { + textChanged = true; m_textDirty = false; #ifndef QT_NO_IM m_preeditDirty = false; @@ -3344,7 +3346,7 @@ bool QQuickTextInputPrivate::finishChange(int validateFromState, bool update, bo #endif emitUndoRedoChanged(); - if (!emitCursorPositionChanged() && alignmentChanged) + if (!emitCursorPositionChanged() && (alignmentChanged || textChanged)) q->updateCursorRectangle(); return true; diff --git a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp index 3b1c5eb31c..86a05c3d3b 100644 --- a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp +++ b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp @@ -3087,6 +3087,14 @@ void tst_qquicktextinput::cursorRectangle() input.setHAlign(leftToRight ? QQuickTextInput::AlignRight : QQuickTextInput::AlignLeft); r = input.cursorRectangle(); QCOMPARE(r.left(), leftToRight ? input.width() : 0); + + QSignalSpy cursorRectangleSpy(&input, SIGNAL(cursorRectangleChanged())); + + QString widerText = shortText; + widerText[1] = 'W'; // Assumes shortText is at least two characters long. + input.setText(widerText); + + QCOMPARE(cursorRectangleSpy.count(), 1); } void tst_qquicktextinput::readOnly() -- cgit v1.2.3 From 0288131796e53bce19062b162b1b818120619e94 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Fri, 1 Feb 2013 11:23:10 -0800 Subject: Add next.png to shared qrc files Otherwise the executable versions of the examples print errors instead of loading it. Change-Id: I7d370ce3ee172491c004668847cdb6d5967f2b24 Reviewed-by: Laszlo Papp Reviewed-by: Jens Bache-Wiig Reviewed-by: Kai Koehne --- examples/quick/shared/quick_shared.qrc | 1 + examples/quick/shared/shared.qrc | 1 + 2 files changed, 2 insertions(+) diff --git a/examples/quick/shared/quick_shared.qrc b/examples/quick/shared/quick_shared.qrc index 9fc114dc89..74a964e5ef 100644 --- a/examples/quick/shared/quick_shared.qrc +++ b/examples/quick/shared/quick_shared.qrc @@ -4,5 +4,6 @@ SimpleLauncherDelegate.qml Button.qml images/back.png + images/next.png diff --git a/examples/quick/shared/shared.qrc b/examples/quick/shared/shared.qrc index 4ac856e66b..0c9f39e7b0 100644 --- a/examples/quick/shared/shared.qrc +++ b/examples/quick/shared/shared.qrc @@ -4,5 +4,6 @@ SimpleLauncherDelegate.qml Button.qml images/back.png + images/next.png -- cgit v1.2.3 From c0c0340e4d6a6cc143299c8b10765b5f4f4cc754 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 4 Feb 2013 16:39:22 +0100 Subject: Fix lupdate-warnings. qqmlcomponent.cpp:667: Cannot invoke tr() like this qqmltypeloader.cpp:2292: Cannot invoke tr() like this qquickloader.cpp:944: Cannot invoke tr() like this Change-Id: Ifdd1a7b958b6af88f251e7df27eb4d4018301914 Reviewed-by: Alan Alpert (Personal) <416365416c@gmail.com> --- src/qml/qml/qqmlcomponent.cpp | 2 +- src/qml/qml/qqmltypeloader.cpp | 2 +- src/quick/items/qquickloader.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/qml/qml/qqmlcomponent.cpp b/src/qml/qml/qqmlcomponent.cpp index 1928bcb4b5..b335d6f402 100644 --- a/src/qml/qml/qqmlcomponent.cpp +++ b/src/qml/qml/qqmlcomponent.cpp @@ -664,7 +664,7 @@ void QQmlComponentPrivate::loadUrl(const QUrl &newUrl, QQmlComponent::Compilatio if (newUrl.isEmpty()) { QQmlError error; - error.setDescription(q->tr("Invalid empty URL")); + error.setDescription(QQmlComponent::tr("Invalid empty URL")); state.errors << error; return; } diff --git a/src/qml/qml/qqmltypeloader.cpp b/src/qml/qml/qqmltypeloader.cpp index dc63db1dea..aa7a2d95c7 100644 --- a/src/qml/qml/qqmltypeloader.cpp +++ b/src/qml/qml/qqmltypeloader.cpp @@ -2289,7 +2289,7 @@ void QQmlScriptBlob::done() error.setUrl(finalUrl()); error.setLine(script.location.line); error.setColumn(script.location.column); - error.setDescription(typeLoader()->tr("Script %1 unavailable").arg(script.script->url().toString())); + error.setDescription(QQmlTypeLoader::tr("Script %1 unavailable").arg(script.script->url().toString())); errors.prepend(error); setError(errors); } diff --git a/src/quick/items/qquickloader.cpp b/src/quick/items/qquickloader.cpp index 210132effc..61f9a27d3b 100644 --- a/src/quick/items/qquickloader.cpp +++ b/src/quick/items/qquickloader.cpp @@ -941,7 +941,7 @@ v8::Handle QQuickLoaderPrivate::extractInitialPropertyValues(QQmlV8F v8::Local v = (*args)[1]; if (!v->IsObject() || v->IsArray()) { *error = true; - qmlInfo(loader) << loader->tr("setSource: value is not an object"); + qmlInfo(loader) << QQuickLoader::tr("setSource: value is not an object"); } else { *error = false; valuemap = v8::Local::Cast(v); -- cgit v1.2.3 From 06fad3e877530eadb33d20dbf3f88c2b18c2851f Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 4 Feb 2013 16:41:17 +0100 Subject: Fix lupdate-warnings in qqmlimport.cpp. qqmlimport.cpp:738: Class 'QQmlImportsPrivate' lacks Q_OBJECT Remove tr()-function and use QQmlImportDatabase::tr() directly. Change-Id: I3a1561c57a6ee90d271a6043b0175e17a7828666 Reviewed-by: Alan Alpert (Personal) <416365416c@gmail.com> --- src/qml/qml/qqmlimport.cpp | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/src/qml/qml/qqmlimport.cpp b/src/qml/qml/qqmlimport.cpp index fb4d8c007f..52d07b23ec 100644 --- a/src/qml/qml/qqmlimport.cpp +++ b/src/qml/qml/qqmlimport.cpp @@ -208,10 +208,6 @@ public: QQmlTypeLoader *typeLoader; - static inline QString tr(const char *str) { - return QQmlImportDatabase::tr(str); - } - static bool locateQmldir(const QString &uri, int vmaj, int vmin, QQmlImportDatabase *database, QString *outQmldirFilePath, QString *outUrl); @@ -735,7 +731,7 @@ bool QQmlImportsPrivate::importExtension(const QString &qmldirFilePath, // The reason is that the lower level may add url and line/column numbering information. QQmlError poppedError = errors->takeFirst(); QQmlError error; - error.setDescription(tr("plugin cannot be loaded for module \"%1\": %2").arg(uri).arg(poppedError.description())); + error.setDescription(QQmlImportDatabase::tr("plugin cannot be loaded for module \"%1\": %2").arg(uri).arg(poppedError.description())); error.setUrl(QUrl::fromLocalFile(qmldirFilePath)); errors->prepend(error); } @@ -744,7 +740,7 @@ bool QQmlImportsPrivate::importExtension(const QString &qmldirFilePath, } else { if (errors) { QQmlError error; - error.setDescription(tr("module \"%1\" plugin \"%2\" not found").arg(uri).arg(plugin.name)); + error.setDescription(QQmlImportDatabase::tr("module \"%1\" plugin \"%2\" not found").arg(uri).arg(plugin.name)); error.setUrl(QUrl::fromLocalFile(qmldirFilePath)); errors->prepend(error); } @@ -1035,9 +1031,9 @@ bool QQmlImportsPrivate::addLibraryImport(const QString& uri, const QString &pre if (inserted->qmlDirComponents.isEmpty() && inserted->qmlDirScripts.isEmpty()) { QQmlError error; if (QQmlMetaType::isAnyModule(uri)) - error.setDescription(tr("module \"%1\" version %2.%3 is not installed").arg(uri).arg(vmaj).arg(vmin)); + error.setDescription(QQmlImportDatabase::tr("module \"%1\" version %2.%3 is not installed").arg(uri).arg(vmaj).arg(vmin)); else - error.setDescription(tr("module \"%1\" is not installed").arg(uri)); + error.setDescription(QQmlImportDatabase::tr("module \"%1\" is not installed").arg(uri)); errors->prepend(error); return false; } else if ((vmaj >= 0) && (vmin >= 0) && qmldir) { @@ -1082,7 +1078,7 @@ bool QQmlImportsPrivate::addFileImport(const QString& uri, const QString &prefix if (!QQmlFile::bundleDirectoryExists(dir, typeLoader->engine())) { if (!isImplicitImport) { QQmlError error; - error.setDescription(tr("\"%1\": no such directory").arg(uri)); + error.setDescription(QQmlImportDatabase::tr("\"%1\": no such directory").arg(uri)); error.setUrl(QUrl(qmldirUrl)); errors->prepend(error); } @@ -1107,7 +1103,7 @@ bool QQmlImportsPrivate::addFileImport(const QString& uri, const QString &prefix if (!typeLoader->directoryExists(dir)) { if (!isImplicitImport) { QQmlError error; - error.setDescription(tr("\"%1\": no such directory").arg(uri)); + error.setDescription(QQmlImportDatabase::tr("\"%1\": no such directory").arg(uri)); error.setUrl(QUrl(qmldirUrl)); errors->prepend(error); } @@ -1127,7 +1123,7 @@ bool QQmlImportsPrivate::addFileImport(const QString& uri, const QString &prefix if (!isImplicitImport) { QQmlError error; - error.setDescription(tr("import \"%1\" has no qmldir and no namespace").arg(importUri)); + error.setDescription(QQmlImportDatabase::tr("import \"%1\" has no qmldir and no namespace").arg(importUri)); error.setUrl(QUrl(qmldirUrl)); errors->prepend(error); } @@ -1187,9 +1183,9 @@ bool QQmlImportsPrivate::updateQmldirContent(const QString &uri, const QString & if (uri != QLatin1String(".")) { QQmlError error; if (QQmlMetaType::isAnyModule(uri)) - error.setDescription(tr("module \"%1\" version %2.%3 is not installed").arg(uri).arg(vmaj).arg(vmin)); + error.setDescription(QQmlImportDatabase::tr("module \"%1\" version %2.%3 is not installed").arg(uri).arg(vmaj).arg(vmin)); else - error.setDescription(tr("module \"%1\" is not installed").arg(uri)); + error.setDescription(QQmlImportDatabase::tr("module \"%1\" is not installed").arg(uri)); errors->prepend(error); return false; } -- cgit v1.2.3 From c0ec84946d13e4693160e859c947696e92ef615b Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 4 Feb 2013 16:43:23 +0100 Subject: Fix lupdate-warning in qqmlrewrite.cpp. Class 'QQmlRewrite' lacks Q_OBJECT macro. Replace global-static strings by message functions. Change-Id: I67a6fbe67575533d3ce5750d72c9d7eff06e7efa Reviewed-by: Alan Alpert (Personal) <416365416c@gmail.com> --- src/qml/qml/qqmlrewrite.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/qml/qml/qqmlrewrite.cpp b/src/qml/qml/qqmlrewrite.cpp index 0913a8c224..0e281428ed 100644 --- a/src/qml/qml/qqmlrewrite.cpp +++ b/src/qml/qml/qqmlrewrite.cpp @@ -44,6 +44,7 @@ #include #include +#include QT_BEGIN_NAMESPACE @@ -513,8 +514,15 @@ bool RewriteSignalHandler::visit(AST::IdentifierExpression *e) return false; } -static QString unnamed_error_string(QLatin1String(QT_TR_NOOP("Signal uses unnamed parameter followed by named parameter."))); -static QString global_error_string(QLatin1String(QT_TR_NOOP("Signal parameter \"%1\" hides global variable."))); +static inline QString msgUnnamedErrorString() +{ + return QCoreApplication::translate("QQmlRewrite", "Signal uses unnamed parameter followed by named parameter."); +} + +static inline QString msgGlobalErrorString(const QString &p) +{ + return QCoreApplication::translate("QQmlRewrite", "Signal parameter \"%1\" hides global variable.").arg(p); +} #define EXIT_ON_ERROR(error) \ { \ @@ -543,9 +551,9 @@ QString RewriteSignalHandler::createParameterString(const QList & if (param.isEmpty()) unnamedParam = true; else if (unnamedParam) - EXIT_ON_ERROR(unnamed_error_string) + EXIT_ON_ERROR(msgUnnamedErrorString()) else if (illegalNames.contains(param)) - EXIT_ON_ERROR(global_error_string.arg(param)) + EXIT_ON_ERROR(msgGlobalErrorString(param)) ++_parameterCountForJS; parameters += param; if (i < parameterNameList.count()-1) -- cgit v1.2.3 From 34c679bc32ae98067cd1cca5564e03f629a0f3b8 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 30 Jan 2013 17:36:45 +0100 Subject: substitute fixed version numbers in qdocconf files with variables Change-Id: If28446d2d14dde62ff662ffdd366dc6384c95326 Reviewed-by: Jerome Pasion --- src/qml/doc/qtqml.qdocconf | 12 ++++++------ src/quick/doc/qtquick.qdocconf | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/qml/doc/qtqml.qdocconf b/src/qml/doc/qtqml.qdocconf index 5a289767ba..61d7e706ec 100644 --- a/src/qml/doc/qtqml.qdocconf +++ b/src/qml/doc/qtqml.qdocconf @@ -2,20 +2,20 @@ include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf) project = QtQml description = Qt QML Reference Documentation -url = http://qt-project.org/doc/qt-5.0/qtqml -version = 5.0.1 +url = http://qt-project.org/doc/qt-$QT_VER/qtqml +version = $QT_VERSION qhp.projects = QtQml qhp.QtQml.file = qtqml.qhp -qhp.QtQml.namespace = org.qt-project.qtqml.501 +qhp.QtQml.namespace = org.qt-project.qtqml.$QT_VERSION_TAG qhp.QtQml.virtualFolder = qtqml qhp.QtQml.indexTitle = Qt QML qhp.QtQml.indexRoot = -qhp.QtQml.filterAttributes = qtqml 5.0.1 qtrefdoc -qhp.QtQml.customFilters.Qt.name = QtQml 5.0.1 -qhp.QtQml.customFilters.Qt.filterAttributes = qtqml 5.0.1 +qhp.QtQml.filterAttributes = qtqml $QT_VERSION qtrefdoc +qhp.QtQml.customFilters.Qt.name = QtQml $QT_VERSION +qhp.QtQml.customFilters.Qt.filterAttributes = qtqml $QT_VERSION qhp.QtQml.subprojects = classes examples qhp.QtQml.subprojects.classes.title = C++ Classes qhp.QtQml.subprojects.classes.indexTitle = Qt QML Module C++ Classes diff --git a/src/quick/doc/qtquick.qdocconf b/src/quick/doc/qtquick.qdocconf index 6af5a1281c..7fba78da10 100644 --- a/src/quick/doc/qtquick.qdocconf +++ b/src/quick/doc/qtquick.qdocconf @@ -2,21 +2,21 @@ include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf) project = QtQuick description = Qt Quick Reference Documentation -url = http://qt-project.org/doc/qt-5.0/qtquick-index.html -version = 5.0.1 +url = http://qt-project.org/doc/qt-$QT_VER/qtquick-index.html +version = $QT_VERSION qhp.projects = QtQuick qhp.QtQuick.file = qtquick.qhp -qhp.QtQuick.namespace = org.qt-project.qtquick.501 +qhp.QtQuick.namespace = org.qt-project.qtquick.$QT_VERSION_TAG qhp.QtQuick.virtualFolder = qtquick qhp.QtQuick.indexTitle = Qt Quick qhp.QtQuick.indexRoot = -qhp.QtQuick.filterAttributes = qtquick 5.0.1 qtrefdoc -qhp.QtQuick.customFilters.Qt.name = QtQuick 5.0.1 -qhp.QtQuick.customFilters.Qt.filterAttributes = qtquick 5.0.1 +qhp.QtQuick.filterAttributes = qtquick $QT_VERSION qtrefdoc +qhp.QtQuick.customFilters.Qt.name = QtQuick $QT_VERSION +qhp.QtQuick.customFilters.Qt.filterAttributes = qtquick $QT_VERSION qhp.QtQuick.subprojects = qmltypes classes examples qhp.QtQuick.subprojects.qmltypes.title = QML Types qhp.QtQuick.subprojects.qmltypes.indexTitle = Qt Quick QML Types -- cgit v1.2.3 From fc454c16c84d159767273a21019fbd65572f3bad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Wed, 6 Feb 2013 09:18:19 +0100 Subject: Fixed Canvas ImageData pixel values not being settable to 0. Someone probably figured "since the data is all initialized to 0 to begin with, we can skip 0 values". However, it's possible to temporarily set a value to other than 0 and then back to 0, a fully valid use case that we need to support. Task-number: QTBUG-29065 Change-Id: Ia9f0803743d696ca8b9cca89c666ccba80a3abd0 Reviewed-by: Paul Olav Tvete Reviewed-by: Gunnar Sletta --- src/quick/items/context2d/qquickcontext2d.cpp | 2 +- tests/auto/quick/qquickcanvasitem/data/tst_pixel.qml | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/quick/items/context2d/qquickcontext2d.cpp b/src/quick/items/context2d/qquickcontext2d.cpp index a46cd6ab70..2f37c7f109 100644 --- a/src/quick/items/context2d/qquickcontext2d.cpp +++ b/src/quick/items/context2d/qquickcontext2d.cpp @@ -2513,7 +2513,7 @@ v8::Handle ctx2d_pixelArray_indexed_set(uint32_t index, v8::Local(info.This()); const int v = value->Uint32Value(); - if (r && index < static_cast(r->image.width() * r->image.height() * 4) && v > 0 && v <= 255) { + if (r && index < static_cast(r->image.width() * r->image.height() * 4) && v >= 0 && v <= 255) { const quint32 w = r->image.width(); const quint32 row = (index / 4) / w; const quint32 col = (index / 4) % w; diff --git a/tests/auto/quick/qquickcanvasitem/data/tst_pixel.qml b/tests/auto/quick/qquickcanvasitem/data/tst_pixel.qml index 469ff2398d..487f7dc903 100644 --- a/tests/auto/quick/qquickcanvasitem/data/tst_pixel.qml +++ b/tests/auto/quick/qquickcanvasitem/data/tst_pixel.qml @@ -1,4 +1,5 @@ import QtQuick 2.0 +import QtTest 1.0 CanvasTestCase { id:testCase @@ -7,6 +8,13 @@ CanvasTestCase { function test_createImageData(row) { var canvas = createCanvasObject(row); var ctx = canvas.getContext('2d'); + var imageData = ctx.createImageData(1, 1); + var imageDataValues = imageData.data; + imageDataValues[0] = 255; + imageDataValues[0] = 0; + if (imageDataValues[0] != 0) + qtest_fail('ImageData value access fail, expecting 0, got ' + imageDataValues[0]); + ctx.reset(); canvas.destroy() } -- cgit v1.2.3 From 1d29d8edf8e4e709ca2f27791cdf8672c15488f3 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Thu, 7 Feb 2013 14:30:48 +0100 Subject: Stabilize resizemodeitem test. Resizing can take time. Instead of qWait(50) use QTRY_COMPARE to make sure we give enough time. Change-Id: I484eca1f4d49381913dc82f405c73de653608493 Reviewed-by: Shawn Rutledge Reviewed-by: David Faure (KDE) Reviewed-by: Friedemann Kleint --- tests/auto/quick/qquickview/tst_qquickview.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/auto/quick/qquickview/tst_qquickview.cpp b/tests/auto/quick/qquickview/tst_qquickview.cpp index 64b108cbec..e2e20a6516 100644 --- a/tests/auto/quick/qquickview/tst_qquickview.cpp +++ b/tests/auto/quick/qquickview/tst_qquickview.cpp @@ -153,8 +153,7 @@ void tst_QQuickView::resizemodeitem() // size update from view view->resize(QSize(200,300)); - QTest::qWait(50); - QCOMPARE(item->width(), 200.0); + QTRY_COMPARE(item->width(), 200.0); QCOMPARE(item->height(), 300.0); QCOMPARE(view->size(), QSize(200, 300)); QCOMPARE(view->size(), view->sizeHint()); -- cgit v1.2.3