From 7d1227e166d97399b00a5e188dca14ceb1702884 Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Wed, 14 Apr 2010 13:36:42 +1000 Subject: Fix qdeclarativeloader test on Windows --- .../declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp b/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp index ca850a6..e6553dd 100644 --- a/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp +++ b/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp @@ -412,7 +412,7 @@ void tst_QDeclarativeLoader::networkRequestUrl() server.serveDirectory(SRCDIR "/data"); QDeclarativeComponent component(&engine); - component.setData(QByteArray("import Qt 4.6\nLoader { source: \"http://127.0.0.1:14450/Rect120x60.qml\" }"), QUrl(SRCDIR "/dummy.qml")); + component.setData(QByteArray("import Qt 4.6\nLoader { source: \"http://127.0.0.1:14450/Rect120x60.qml\" }"), QUrl::fromLocalFile(SRCDIR "/dummy.qml")); if (component.isError()) qDebug() << component.errors(); QDeclarativeLoader *loader = qobject_cast(component.create()); @@ -468,7 +468,7 @@ void tst_QDeclarativeLoader::failNetworkRequest() QTest::ignoreMessage(QtWarningMsg, "(:-1: Network error for URL http://127.0.0.1:14450/IDontExist.qml) "); QDeclarativeComponent component(&engine); - component.setData(QByteArray("import Qt 4.6\nLoader { source: \"http://127.0.0.1:14450/IDontExist.qml\" }"), QUrl("http://127.0.0.1:14450/dummy.qml")); + component.setData(QByteArray("import Qt 4.6\nLoader { source: \"http://127.0.0.1:14450/IDontExist.qml\" }"), QUrl::fromLocalFile("http://127.0.0.1:14450/dummy.qml")); QDeclarativeLoader *loader = qobject_cast(component.create()); QVERIFY(loader != 0); @@ -518,8 +518,9 @@ void tst_QDeclarativeLoader::nonItem() void tst_QDeclarativeLoader::vmeErrors() { QDeclarativeComponent component(&engine, TEST_FILE("vmeErrors.qml")); - QString err = QString("(") + QUrl::fromLocalFile(SRCDIR).toString() + QString("/data/VmeError.qml:6: Cannot assign object type QObject with no default method\n onSomethingHappened: QtObject {}) "); - QTest::ignoreMessage(QtWarningMsg, err.toLatin1().constData()); + //ignore message for now + //QString err = QUrl::fromLocalFile(SRCDIR "/data/VmeError.qml:6: Cannot assign object type QObject with no default method\n onSomethingHappened: QtObject {}) "); + //QTest::ignoreMessage(QtWarningMsg, err.toLatin1().constData()); QDeclarativeLoader *loader = qobject_cast(component.create()); QVERIFY(loader); QVERIFY(loader->item() == 0); -- cgit v0.12 From 974eac3542604d174d7955e15072750f1e852263 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Wed, 14 Apr 2010 13:58:26 +1000 Subject: Improve test failure message --- tests/auto/declarative/examples/tst_examples.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/auto/declarative/examples/tst_examples.cpp b/tests/auto/declarative/examples/tst_examples.cpp index abb2b93..67b29dd 100644 --- a/tests/auto/declarative/examples/tst_examples.cpp +++ b/tests/auto/declarative/examples/tst_examples.cpp @@ -296,7 +296,8 @@ void tst_examples::examples() for (int ii = 0; ii < tests.count(); ++ii) { if (tests.at(ii).result != Example::Pass) qWarning() << tests.at(ii).file << ":failed"; - QVERIFY(tests.at(ii).result == Example::Pass); + if (tests.at(ii).result != Example::Pass) + QFAIL(qPrintable(tests.at(ii).file)); } #else -- cgit v0.12 From c6ce84640b7bebab4d6dc571ab549a085703ed16 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Wed, 14 Apr 2010 14:05:16 +1000 Subject: Remove double fail message --- tests/auto/declarative/examples/tst_examples.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/auto/declarative/examples/tst_examples.cpp b/tests/auto/declarative/examples/tst_examples.cpp index 67b29dd..ee8111e 100644 --- a/tests/auto/declarative/examples/tst_examples.cpp +++ b/tests/auto/declarative/examples/tst_examples.cpp @@ -294,8 +294,6 @@ void tst_examples::examples() sync.waitForFinished(); for (int ii = 0; ii < tests.count(); ++ii) { - if (tests.at(ii).result != Example::Pass) - qWarning() << tests.at(ii).file << ":failed"; if (tests.at(ii).result != Example::Pass) QFAIL(qPrintable(tests.at(ii).file)); } -- cgit v0.12 From 6fb6bbadfc9cffee3f7e51d4ec7ab2718f26d00d Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Wed, 14 Apr 2010 14:08:51 +1000 Subject: Fix qdeclarativeloader test on windows. --- tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp b/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp index ca850a6..aa82403 100644 --- a/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp +++ b/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp @@ -412,7 +412,7 @@ void tst_QDeclarativeLoader::networkRequestUrl() server.serveDirectory(SRCDIR "/data"); QDeclarativeComponent component(&engine); - component.setData(QByteArray("import Qt 4.6\nLoader { source: \"http://127.0.0.1:14450/Rect120x60.qml\" }"), QUrl(SRCDIR "/dummy.qml")); + component.setData(QByteArray("import Qt 4.6\nLoader { source: \"http://127.0.0.1:14450/Rect120x60.qml\" }"), QUrl::fromLocalFile(SRCDIR "/dummy.qml")); if (component.isError()) qDebug() << component.errors(); QDeclarativeLoader *loader = qobject_cast(component.create()); -- cgit v0.12 From c94c7e6609f117a277862992d13e2ef35bafccd9 Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Wed, 14 Apr 2010 14:20:16 +1000 Subject: Rename remaining import Qt 4.6 lines to import Qt 4.7 Task-number: Reviewed-by: Martin Jones --- .../util/qdeclarativesmoothedfollow.cpp | 2 +- src/imports/multimedia/qdeclarativeaudio.cpp | 2 +- src/imports/multimedia/qdeclarativevideo.cpp | 2 +- src/imports/particles/qdeclarativeparticles.cpp | 2 +- src/multimedia/effects/qsoundeffect.cpp | 2 +- .../declarative/parserstress/tst_parserstress.cpp | 2 +- .../tst_qdeclarativeanchors.cpp | 2 +- .../tst_qdeclarativeanimatedimage.cpp | 2 +- .../tst_qdeclarativeanimations.cpp | 8 +- .../tst_qdeclarativeborderimage.cpp | 20 ++-- .../tst_qdeclarativecontext.cpp | 18 ++-- .../qdeclarativedebug/tst_qdeclarativedebug.cpp | 4 +- .../qdeclarativedom/tst_qdeclarativedom.cpp | 46 ++++----- .../qdeclarativeengine/tst_qdeclarativeengine.cpp | 4 +- .../tst_qdeclarativeflickable.cpp | 8 +- .../tst_qdeclarativefontloader.cpp | 14 +-- .../tst_qdeclarativegridview.cpp | 4 +- .../qdeclarativeimage/tst_qdeclarativeimage.cpp | 16 ++-- .../tst_qdeclarativeimageprovider.cpp | 4 +- .../qdeclarativeitem/tst_qdeclarativeitem.cpp | 6 +- .../tst_qdeclarativelanguage.cpp | 14 +-- .../tst_qdeclarativelistmodel.cpp | 22 ++--- .../tst_qdeclarativelistview.cpp | 4 +- .../qdeclarativeloader/tst_qdeclarativeloader.cpp | 14 +-- .../tst_qdeclarativepathview.cpp | 2 +- .../tst_qdeclarativepropertymap.cpp | 4 +- .../tst_qdeclarativerepeater.cpp | 2 +- .../tst_qdeclarativesystempalette.cpp | 8 +- .../qdeclarativetext/tst_qdeclarativetext.cpp | 106 ++++++++++----------- .../tst_qdeclarativetextedit.cpp | 60 ++++++------ .../tst_qdeclarativetextinput.cpp | 32 +++---- .../qdeclarativetimer/tst_qdeclarativetimer.cpp | 16 ++-- .../tst_qdeclarativewebview.cpp | 2 +- .../tst_qdeclarativeworkerscript.cpp | 2 +- tests/auto/declarative/sql/tst_sql.cpp | 2 +- 35 files changed, 229 insertions(+), 229 deletions(-) diff --git a/src/declarative/util/qdeclarativesmoothedfollow.cpp b/src/declarative/util/qdeclarativesmoothedfollow.cpp index 63c9618..9f155fc 100644 --- a/src/declarative/util/qdeclarativesmoothedfollow.cpp +++ b/src/declarative/util/qdeclarativesmoothedfollow.cpp @@ -86,7 +86,7 @@ public: The follow example shows one rectangle tracking the position of another. \code -import Qt 4.6 +import Qt 4.7 Rectangle { width: 800; height: 600; color: "blue" diff --git a/src/imports/multimedia/qdeclarativeaudio.cpp b/src/imports/multimedia/qdeclarativeaudio.cpp index 8d2dc61..82d5d89 100644 --- a/src/imports/multimedia/qdeclarativeaudio.cpp +++ b/src/imports/multimedia/qdeclarativeaudio.cpp @@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE This element is part of the \bold{Qt.multimedia 4.7} module. \qml - import Qt 4.6 + import Qt 4.7 import Qt.multimedia 4.7 Audio { source: "audio/song.mp3" } diff --git a/src/imports/multimedia/qdeclarativevideo.cpp b/src/imports/multimedia/qdeclarativevideo.cpp index bf112be..c6ae272 100644 --- a/src/imports/multimedia/qdeclarativevideo.cpp +++ b/src/imports/multimedia/qdeclarativevideo.cpp @@ -76,7 +76,7 @@ void QDeclarativeVideo::_q_error(int errorCode, const QString &errorString) This element is part of the \bold{Qt.multimedia 4.7} module. \qml - import Qt 4.6 + import Qt 4.7 import Qt.multimedia 4.7 Video { source: "video/movie.mpg" } diff --git a/src/imports/particles/qdeclarativeparticles.cpp b/src/imports/particles/qdeclarativeparticles.cpp index ad6a512..d17a8a1 100644 --- a/src/imports/particles/qdeclarativeparticles.cpp +++ b/src/imports/particles/qdeclarativeparticles.cpp @@ -644,7 +644,7 @@ void QDeclarativeParticlesPrivate::updateOpacity(QDeclarativeParticle &p, int ag snow, the lower one has particles expelled up like a fountain. \qml -import Qt 4.6 +import Qt 4.7 import Qt.labs.particles 1.0 Rectangle { diff --git a/src/multimedia/effects/qsoundeffect.cpp b/src/multimedia/effects/qsoundeffect.cpp index 8a38103..d34e532 100644 --- a/src/multimedia/effects/qsoundeffect.cpp +++ b/src/multimedia/effects/qsoundeffect.cpp @@ -61,7 +61,7 @@ QT_BEGIN_NAMESPACE The following example plays a wav file on mouse click. \qml - import Qt 4.6 + import Qt 4.7 import Qt.multimedia 4.7 Item { diff --git a/tests/auto/declarative/parserstress/tst_parserstress.cpp b/tests/auto/declarative/parserstress/tst_parserstress.cpp index ee246fa..41c0a1b 100644 --- a/tests/auto/declarative/parserstress/tst_parserstress.cpp +++ b/tests/auto/declarative/parserstress/tst_parserstress.cpp @@ -113,7 +113,7 @@ void tst_parserstress::ecmascript() QString dataStr = QString::fromUtf8(data); - QString qml = "import Qt 4.6\n"; + QString qml = "import Qt 4.7\n"; qml+= "\n"; qml+= "QtObject {\n"; qml+= " property int test\n"; diff --git a/tests/auto/declarative/qdeclarativeanchors/tst_qdeclarativeanchors.cpp b/tests/auto/declarative/qdeclarativeanchors/tst_qdeclarativeanchors.cpp index 05974aa..01b5bc5 100644 --- a/tests/auto/declarative/qdeclarativeanchors/tst_qdeclarativeanchors.cpp +++ b/tests/auto/declarative/qdeclarativeanchors/tst_qdeclarativeanchors.cpp @@ -297,7 +297,7 @@ void tst_qdeclarativeanchors::illegalSets() QDeclarativeEngine engine; QDeclarativeComponent component(&engine); - component.setData(QByteArray("import Qt 4.6\n" + qml.toUtf8()), QUrl::fromLocalFile("")); + component.setData(QByteArray("import Qt 4.7\n" + qml.toUtf8()), QUrl::fromLocalFile("")); if (!component.isReady()) qWarning() << "Test errors:" << component.errors(); QVERIFY(component.isReady()); diff --git a/tests/auto/declarative/qdeclarativeanimatedimage/tst_qdeclarativeanimatedimage.cpp b/tests/auto/declarative/qdeclarativeanimatedimage/tst_qdeclarativeanimatedimage.cpp index 501debd..0fb080c 100644 --- a/tests/auto/declarative/qdeclarativeanimatedimage/tst_qdeclarativeanimatedimage.cpp +++ b/tests/auto/declarative/qdeclarativeanimatedimage/tst_qdeclarativeanimatedimage.cpp @@ -196,7 +196,7 @@ void tst_qdeclarativeanimatedimage::invalidSource() { QDeclarativeEngine engine; QDeclarativeComponent component(&engine); - component.setData("import Qt 4.6\n AnimatedImage { source: \"no-such-file.gif\" }", QUrl::fromLocalFile("")); + component.setData("import Qt 4.7\n AnimatedImage { source: \"no-such-file.gif\" }", QUrl::fromLocalFile("")); QVERIFY(component.isReady()); QTest::ignoreMessage(QtWarningMsg, "Error Reading Animated Image File QUrl( \"file:no-such-file.gif\" ) "); diff --git a/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp b/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp index f018ce1..959cc19 100644 --- a/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp +++ b/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp @@ -648,7 +648,7 @@ void tst_qdeclarativeanimations::easingProperties() { { QDeclarativeEngine engine; - QString componentStr = "import Qt 4.6\nNumberAnimation { easing.type: \"InOutQuad\" }"; + QString componentStr = "import Qt 4.7\nNumberAnimation { easing.type: \"InOutQuad\" }"; QDeclarativeComponent animationComponent(&engine); animationComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativePropertyAnimation *animObject = qobject_cast(animationComponent.create()); @@ -659,7 +659,7 @@ void tst_qdeclarativeanimations::easingProperties() { QDeclarativeEngine engine; - QString componentStr = "import Qt 4.6\nPropertyAnimation { easing.type: \"OutBounce\"; easing.amplitude: 5.0 }"; + QString componentStr = "import Qt 4.7\nPropertyAnimation { easing.type: \"OutBounce\"; easing.amplitude: 5.0 }"; QDeclarativeComponent animationComponent(&engine); animationComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativePropertyAnimation *animObject = qobject_cast(animationComponent.create()); @@ -671,7 +671,7 @@ void tst_qdeclarativeanimations::easingProperties() { QDeclarativeEngine engine; - QString componentStr = "import Qt 4.6\nPropertyAnimation { easing.type: \"OutElastic\"; easing.amplitude: 5.0; easing.period: 3.0}"; + QString componentStr = "import Qt 4.7\nPropertyAnimation { easing.type: \"OutElastic\"; easing.amplitude: 5.0; easing.period: 3.0}"; QDeclarativeComponent animationComponent(&engine); animationComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativePropertyAnimation *animObject = qobject_cast(animationComponent.create()); @@ -684,7 +684,7 @@ void tst_qdeclarativeanimations::easingProperties() { QDeclarativeEngine engine; - QString componentStr = "import Qt 4.6\nPropertyAnimation { easing.type: \"InOutBack\"; easing.overshoot: 2 }"; + QString componentStr = "import Qt 4.7\nPropertyAnimation { easing.type: \"InOutBack\"; easing.overshoot: 2 }"; QDeclarativeComponent animationComponent(&engine); animationComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativePropertyAnimation *animObject = qobject_cast(animationComponent.create()); diff --git a/tests/auto/declarative/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp b/tests/auto/declarative/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp index 90d2412..0f03527 100644 --- a/tests/auto/declarative/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp +++ b/tests/auto/declarative/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp @@ -99,7 +99,7 @@ tst_qdeclarativeborderimage::tst_qdeclarativeborderimage() void tst_qdeclarativeborderimage::noSource() { - QString componentStr = "import Qt 4.6\nBorderImage { source: \"\" }"; + QString componentStr = "import Qt 4.7\nBorderImage { source: \"\" }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeBorderImage *obj = qobject_cast(component.create()); @@ -143,7 +143,7 @@ void tst_qdeclarativeborderimage::imageSource() if (!error.isEmpty()) QTest::ignoreMessage(QtWarningMsg, error.toUtf8()); - QString componentStr = "import Qt 4.6\nBorderImage { source: \"" + source + "\" }"; + QString componentStr = "import Qt 4.7\nBorderImage { source: \"" + source + "\" }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeBorderImage *obj = qobject_cast(component.create()); @@ -170,7 +170,7 @@ void tst_qdeclarativeborderimage::imageSource() void tst_qdeclarativeborderimage::clearSource() { - QString componentStr = "import Qt 4.6\nBorderImage { source: srcImage }"; + QString componentStr = "import Qt 4.7\nBorderImage { source: srcImage }"; QDeclarativeContext *ctxt = engine.rootContext(); ctxt->setContextProperty("srcImage", QUrl::fromLocalFile(SRCDIR "/data/colors.png")); QDeclarativeComponent component(&engine); @@ -190,7 +190,7 @@ void tst_qdeclarativeborderimage::clearSource() void tst_qdeclarativeborderimage::resized() { - QString componentStr = "import Qt 4.6\nBorderImage { source: \"" + QUrl::fromLocalFile(SRCDIR "/data/colors.png").toString() + "\"; width: 300; height: 300 }"; + QString componentStr = "import Qt 4.7\nBorderImage { source: \"" + QUrl::fromLocalFile(SRCDIR "/data/colors.png").toString() + "\"; width: 300; height: 300 }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeBorderImage *obj = qobject_cast(component.create()); @@ -205,7 +205,7 @@ void tst_qdeclarativeborderimage::resized() void tst_qdeclarativeborderimage::smooth() { - QString componentStr = "import Qt 4.6\nBorderImage { source: \"" SRCDIR "/data/colors.png\"; smooth: true; width: 300; height: 300 }"; + QString componentStr = "import Qt 4.7\nBorderImage { source: \"" SRCDIR "/data/colors.png\"; smooth: true; width: 300; height: 300 }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeBorderImage *obj = qobject_cast(component.create()); @@ -222,7 +222,7 @@ void tst_qdeclarativeborderimage::smooth() void tst_qdeclarativeborderimage::tileModes() { { - QString componentStr = "import Qt 4.6\nBorderImage { source: \"" SRCDIR "/data/colors.png\"; width: 100; height: 300; horizontalTileMode: BorderImage.Repeat; verticalTileMode: BorderImage.Repeat }"; + QString componentStr = "import Qt 4.7\nBorderImage { source: \"" SRCDIR "/data/colors.png\"; width: 100; height: 300; horizontalTileMode: BorderImage.Repeat; verticalTileMode: BorderImage.Repeat }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeBorderImage *obj = qobject_cast(component.create()); @@ -235,7 +235,7 @@ void tst_qdeclarativeborderimage::tileModes() delete obj; } { - QString componentStr = "import Qt 4.6\nBorderImage { source: \"" SRCDIR "/data/colors.png\"; width: 300; height: 150; horizontalTileMode: BorderImage.Round; verticalTileMode: BorderImage.Round }"; + QString componentStr = "import Qt 4.7\nBorderImage { source: \"" SRCDIR "/data/colors.png\"; width: 300; height: 150; horizontalTileMode: BorderImage.Round; verticalTileMode: BorderImage.Round }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeBorderImage *obj = qobject_cast(component.create()); @@ -262,7 +262,7 @@ void tst_qdeclarativeborderimage::sciSource() server->serveDirectory(SRCDIR "/data"); } - QString componentStr = "import Qt 4.6\nBorderImage { source: \"" + source + "\"; width: 300; height: 300 }"; + QString componentStr = "import Qt 4.7\nBorderImage { source: \"" + source + "\"; width: 300; height: 300 }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeBorderImage *obj = qobject_cast(component.create()); @@ -307,7 +307,7 @@ void tst_qdeclarativeborderimage::invalidSciFile() QTest::ignoreMessage(QtWarningMsg, "Unknown tile rule specified. Using Stretch "); // for "Roun" QTest::ignoreMessage(QtWarningMsg, "Unknown tile rule specified. Using Stretch "); // for "Repea" - QString componentStr = "import Qt 4.6\nBorderImage { source: \"" + QUrl::fromLocalFile(SRCDIR "/data/invalid.sci").toString() +"\"; width: 300; height: 300 }"; + QString componentStr = "import Qt 4.7\nBorderImage { source: \"" + QUrl::fromLocalFile(SRCDIR "/data/invalid.sci").toString() +"\"; width: 300; height: 300 }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeBorderImage *obj = qobject_cast(component.create()); @@ -325,7 +325,7 @@ void tst_qdeclarativeborderimage::pendingRemoteRequest() { QFETCH(QString, source); - QString componentStr = "import Qt 4.6\nBorderImage { source: \"" + source + "\" }"; + QString componentStr = "import Qt 4.7\nBorderImage { source: \"" + source + "\" }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeBorderImage *obj = qobject_cast(component.create()); diff --git a/tests/auto/declarative/qdeclarativecontext/tst_qdeclarativecontext.cpp b/tests/auto/declarative/qdeclarativecontext/tst_qdeclarativecontext.cpp index ae62363..35cffdc 100644 --- a/tests/auto/declarative/qdeclarativecontext/tst_qdeclarativecontext.cpp +++ b/tests/auto/declarative/qdeclarativecontext/tst_qdeclarativecontext.cpp @@ -228,7 +228,7 @@ private: #define TEST_CONTEXT_PROPERTY(ctxt, name, value) \ { \ QDeclarativeComponent component(&engine); \ - component.setData("import Qt 4.6; QtObject { property variant test: " #name " }", QUrl()); \ + component.setData("import Qt 4.7; QtObject { property variant test: " #name " }", QUrl()); \ \ QObject *obj = component.create(ctxt); \ \ @@ -278,7 +278,7 @@ void tst_qdeclarativecontext::setContextProperty() // Changes in context properties { QDeclarativeComponent component(&engine); - component.setData("import Qt 4.6; QtObject { property variant test: a }", QUrl()); + component.setData("import Qt 4.7; QtObject { property variant test: a }", QUrl()); QObject *obj = component.create(&ctxt2); @@ -290,7 +290,7 @@ void tst_qdeclarativecontext::setContextProperty() } { QDeclarativeComponent component(&engine); - component.setData("import Qt 4.6; QtObject { property variant test: b }", QUrl()); + component.setData("import Qt 4.7; QtObject { property variant test: b }", QUrl()); QObject *obj = component.create(&ctxt2); @@ -304,7 +304,7 @@ void tst_qdeclarativecontext::setContextProperty() } { QDeclarativeComponent component(&engine); - component.setData("import Qt 4.6; QtObject { property variant test: e.a }", QUrl()); + component.setData("import Qt 4.7; QtObject { property variant test: e.a }", QUrl()); QObject *obj = component.create(&ctxt2); @@ -318,7 +318,7 @@ void tst_qdeclarativecontext::setContextProperty() // New context properties { QDeclarativeComponent component(&engine); - component.setData("import Qt 4.6; QtObject { property variant test: a }", QUrl()); + component.setData("import Qt 4.7; QtObject { property variant test: a }", QUrl()); QObject *obj = component.create(&ctxt2); @@ -332,7 +332,7 @@ void tst_qdeclarativecontext::setContextProperty() // Setting an object-variant context property { QDeclarativeComponent component(&engine); - component.setData("import Qt 4.6; QtObject { id: root; property int a: 10; property int test: ctxtProp.a; property variant obj: root; }", QUrl()); + component.setData("import Qt 4.7; QtObject { id: root; property int a: 10; property int test: ctxtProp.a; property variant obj: root; }", QUrl()); QDeclarativeContext ctxt(engine.rootContext()); ctxt.setContextProperty("ctxtProp", QVariant()); @@ -380,7 +380,7 @@ void tst_qdeclarativecontext::setContextObject() // Changes in context properties { QDeclarativeComponent component(&engine); - component.setData("import Qt 4.6; QtObject { property variant test: a }", QUrl()); + component.setData("import Qt 4.7; QtObject { property variant test: a }", QUrl()); QObject *obj = component.create(&ctxt); @@ -412,7 +412,7 @@ void tst_qdeclarativecontext::destruction() void tst_qdeclarativecontext::idAsContextProperty() { QDeclarativeComponent component(&engine); - component.setData("import Qt 4.6; QtObject { property variant a; a: QtObject { id: myObject } }", QUrl()); + component.setData("import Qt 4.7; QtObject { property variant a; a: QtObject { id: myObject } }", QUrl()); QObject *obj = component.create(); QVERIFY(obj); @@ -432,7 +432,7 @@ void tst_qdeclarativecontext::idAsContextProperty() void tst_qdeclarativecontext::readOnlyContexts() { QDeclarativeComponent component(&engine); - component.setData("import Qt 4.6; QtObject { id: me }", QUrl()); + component.setData("import Qt 4.7; QtObject { id: me }", QUrl()); QObject *obj = component.create(); QVERIFY(obj); diff --git a/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp b/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp index d0eb90e..133dcb8 100644 --- a/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp +++ b/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp @@ -822,7 +822,7 @@ int main(int argc, char *argv[]) QApplication app(argc, argv); QList qml; - qml << "import Qt 4.6\n" + qml << "import Qt 4.7\n" "Item {" "width: 10; height: 20; scale: blueRect.scale;" "Rectangle { id: blueRect; width: 500; height: 600; color: \"blue\"; }" @@ -832,7 +832,7 @@ int main(int argc, char *argv[]) "}" "}"; // add second component to test multiple root contexts - qml << "import Qt 4.6\n" + qml << "import Qt 4.7\n" "Item {}"; tst_QDeclarativeDebug_Factory factory; return QDeclarativeDebugTest::runTests(&factory, qml); diff --git a/tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp b/tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp index d391941..36a15fa 100644 --- a/tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp +++ b/tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp @@ -81,7 +81,7 @@ private: void tst_qdeclarativedom::loadSimple() { - QByteArray qml = "import Qt 4.6\n" + QByteArray qml = "import Qt 4.7\n" "Item {}"; QDeclarativeDomDocument document; @@ -100,7 +100,7 @@ void tst_qdeclarativedom::loadSimple() // Test regular properties void tst_qdeclarativedom::loadProperties() { - QByteArray qml = "import Qt 4.6\n" + QByteArray qml = "import Qt 4.7\n" "Item { id : item; x : 300; visible : true }"; QDeclarativeDomDocument document; @@ -134,7 +134,7 @@ void tst_qdeclarativedom::loadProperties() void tst_qdeclarativedom::loadGroupedProperties() { { - QByteArray qml = "import Qt 4.6\n" + QByteArray qml = "import Qt 4.7\n" "Item { anchors.left: parent.left; anchors.right: parent.right }"; QDeclarativeDomDocument document; @@ -177,7 +177,7 @@ void tst_qdeclarativedom::loadGroupedProperties() } { - QByteArray qml = "import Qt 4.6\n" + QByteArray qml = "import Qt 4.7\n" "Item { \n" " anchors {\n" " left: parent.left\n" @@ -228,7 +228,7 @@ void tst_qdeclarativedom::loadGroupedProperties() void tst_qdeclarativedom::loadChildObject() { - QByteArray qml = "import Qt 4.6\n" + QByteArray qml = "import Qt 4.7\n" "Item { Item {} }"; QDeclarativeDomDocument document; @@ -273,7 +273,7 @@ void tst_qdeclarativedom::loadComposite() void tst_qdeclarativedom::testValueSource() { - QByteArray qml = "import Qt 4.6\n" + QByteArray qml = "import Qt 4.7\n" "Rectangle { SpringFollow on height { spring: 1.4; damping: .15; to: Math.min(Math.max(-130, value*2.2 - 130), 133); }}"; QDeclarativeEngine freshEngine; @@ -305,7 +305,7 @@ void tst_qdeclarativedom::testValueSource() void tst_qdeclarativedom::testValueInterceptor() { - QByteArray qml = "import Qt 4.6\n" + QByteArray qml = "import Qt 4.7\n" "Rectangle { Behavior on height { NumberAnimation { duration: 100 } } }"; QDeclarativeEngine freshEngine; @@ -332,7 +332,7 @@ void tst_qdeclarativedom::testValueInterceptor() // Test QDeclarativeDomDocument::imports() void tst_qdeclarativedom::loadImports() { - QByteArray qml = "import Qt 4.6\n" + QByteArray qml = "import Qt 4.7\n" "import importlib.sublib 1.1\n" "import importlib.sublib 1.0 as NewFoo\n" "import 'import'\n" @@ -380,7 +380,7 @@ void tst_qdeclarativedom::loadImports() // Test loading a file with errors void tst_qdeclarativedom::loadErrors() { - QByteArray qml = "import Qt 4.6\n" + QByteArray qml = "import Qt 4.7\n" "Item {\n" " foo: 12\n" "}"; @@ -400,7 +400,7 @@ void tst_qdeclarativedom::loadErrors() // Test loading a file with syntax errors void tst_qdeclarativedom::loadSyntaxErrors() { - QByteArray qml = "import Qt 4.6\n" + QByteArray qml = "import Qt 4.7\n" "asdf"; QDeclarativeDomDocument document; @@ -418,7 +418,7 @@ void tst_qdeclarativedom::loadSyntaxErrors() // Test attempting to load a file with remote references void tst_qdeclarativedom::loadRemoteErrors() { - QByteArray qml = "import Qt 4.6\n" + QByteArray qml = "import Qt 4.7\n" "Item {\n" " Script {\n" " source: \"http://localhost/exampleQmlScript.js\"" @@ -440,7 +440,7 @@ void tst_qdeclarativedom::loadRemoteErrors() void tst_qdeclarativedom::loadDynamicProperty() { { - QByteArray qml = "import Qt 4.6\n" + QByteArray qml = "import Qt 4.7\n" "Item {\n" " property int a\n" " property bool b\n" @@ -488,7 +488,7 @@ void tst_qdeclarativedom::loadDynamicProperty() } { - QByteArray qml = "import Qt 4.6\n" + QByteArray qml = "import Qt 4.7\n" "Item {\n" " property int a: 12\n" " property int b: a + 6\n" @@ -532,7 +532,7 @@ void tst_qdeclarativedom::loadComponent() { // Explicit component { - QByteArray qml = "import Qt 4.6\n" + QByteArray qml = "import Qt 4.7\n" "Item {\n" " Component {\n" " id: myComponent\n" @@ -580,7 +580,7 @@ void tst_qdeclarativedom::loadComponent() // Implicit component { - QByteArray qml = "import Qt 4.6\n" + QByteArray qml = "import Qt 4.7\n" "ListView {\n" " delegate: Item {}\n" "}"; @@ -630,7 +630,7 @@ void tst_qdeclarativedom::object_dynamicProperty() // Valid object, no dynamic properties { - QByteArray qml = "import Qt 4.6\n" + QByteArray qml = "import Qt 4.7\n" "Item {}"; QDeclarativeDomDocument document; @@ -645,7 +645,7 @@ void tst_qdeclarativedom::object_dynamicProperty() // Valid object, dynamic properties { - QByteArray qml = "import Qt 4.6\n" + QByteArray qml = "import Qt 4.7\n" "Item {\n" " property int a\n" "}"; @@ -683,7 +683,7 @@ void tst_qdeclarativedom::object_property() // Valid object - no default { - QByteArray qml = "import Qt 4.6\n" + QByteArray qml = "import Qt 4.7\n" "Item {\n" " x: 10\n" " y: 12\n" @@ -723,7 +723,7 @@ void tst_qdeclarativedom::object_property() // Valid object - with default { - QByteArray qml = "import Qt 4.6\n" + QByteArray qml = "import Qt 4.7\n" "Item {\n" " x: 10\n" " y: 12\n" @@ -784,7 +784,7 @@ void tst_qdeclarativedom::object_url() // Valid builtin object { - QByteArray qml = "import Qt 4.6\n" + QByteArray qml = "import Qt 4.7\n" "Item {}"; QDeclarativeDomDocument document; @@ -797,7 +797,7 @@ void tst_qdeclarativedom::object_url() // Valid composite object { - QByteArray qml = "import Qt 4.6\n" + QByteArray qml = "import Qt 4.7\n" "MyItem {}"; QUrl myUrl = QUrl::fromLocalFile(SRCDIR "/data/main.qml"); @@ -815,7 +815,7 @@ void tst_qdeclarativedom::object_url() // Test copy constructors and operators void tst_qdeclarativedom::copy() { - QByteArray qml = "import Qt 4.6\n" + QByteArray qml = "import Qt 4.7\n" "MyItem {\n" " id: myItem\n" " property int a: 10\n" @@ -1190,7 +1190,7 @@ void tst_qdeclarativedom::copy() // Tests the position/length of various elements void tst_qdeclarativedom::position() { - QByteArray qml = "import Qt 4.6\n" + QByteArray qml = "import Qt 4.7\n" "Item {\n" " id: myItem\n" " property int a: 10\n" diff --git a/tests/auto/declarative/qdeclarativeengine/tst_qdeclarativeengine.cpp b/tests/auto/declarative/qdeclarativeengine/tst_qdeclarativeengine.cpp index 5dc5f19..5d8a52d 100644 --- a/tests/auto/declarative/qdeclarativeengine/tst_qdeclarativeengine.cpp +++ b/tests/auto/declarative/qdeclarativeengine/tst_qdeclarativeengine.cpp @@ -192,7 +192,7 @@ void tst_qdeclarativeengine::clearComponentCache() { QFile file("temp.qml"); QVERIFY(file.open(QIODevice::WriteOnly)); - file.write("import Qt 4.6\nQtObject {\nproperty int test: 10\n}\n"); + file.write("import Qt 4.7\nQtObject {\nproperty int test: 10\n}\n"); file.close(); } @@ -209,7 +209,7 @@ void tst_qdeclarativeengine::clearComponentCache() { QFile file("temp.qml"); QVERIFY(file.open(QIODevice::WriteOnly)); - file.write("import Qt 4.6\nQtObject {\nproperty int test: 11\n}\n"); + file.write("import Qt 4.7\nQtObject {\nproperty int test: 11\n}\n"); file.close(); } diff --git a/tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp b/tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp index cb87977..a345a60 100644 --- a/tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp +++ b/tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp @@ -147,7 +147,7 @@ void tst_qdeclarativeflickable::properties() void tst_qdeclarativeflickable::overShoot() { QDeclarativeComponent component(&engine); - component.setData("import Qt 4.6; Flickable { overShoot: false; }", QUrl::fromLocalFile("")); + component.setData("import Qt 4.7; Flickable { overShoot: false; }", QUrl::fromLocalFile("")); QDeclarativeFlickable *flickable = qobject_cast(component.create()); QSignalSpy spy(flickable, SIGNAL(overShootChanged())); @@ -170,7 +170,7 @@ void tst_qdeclarativeflickable::overShoot() void tst_qdeclarativeflickable::maximumFlickVelocity() { QDeclarativeComponent component(&engine); - component.setData("import Qt 4.6; Flickable { maximumFlickVelocity: 1.0; }", QUrl::fromLocalFile("")); + component.setData("import Qt 4.7; Flickable { maximumFlickVelocity: 1.0; }", QUrl::fromLocalFile("")); QDeclarativeFlickable *flickable = qobject_cast(component.create()); QSignalSpy spy(flickable, SIGNAL(maximumFlickVelocityChanged())); @@ -187,7 +187,7 @@ void tst_qdeclarativeflickable::maximumFlickVelocity() void tst_qdeclarativeflickable::flickDeceleration() { QDeclarativeComponent component(&engine); - component.setData("import Qt 4.6; Flickable { flickDeceleration: 1.0; }", QUrl::fromLocalFile("")); + component.setData("import Qt 4.7; Flickable { flickDeceleration: 1.0; }", QUrl::fromLocalFile("")); QDeclarativeFlickable *flickable = qobject_cast(component.create()); QSignalSpy spy(flickable, SIGNAL(flickDecelerationChanged())); @@ -204,7 +204,7 @@ void tst_qdeclarativeflickable::flickDeceleration() void tst_qdeclarativeflickable::pressDelay() { QDeclarativeComponent component(&engine); - component.setData("import Qt 4.6; Flickable { pressDelay: 100; }", QUrl::fromLocalFile("")); + component.setData("import Qt 4.7; Flickable { pressDelay: 100; }", QUrl::fromLocalFile("")); QDeclarativeFlickable *flickable = qobject_cast(component.create()); QSignalSpy spy(flickable, SIGNAL(pressDelayChanged())); diff --git a/tests/auto/declarative/qdeclarativefontloader/tst_qdeclarativefontloader.cpp b/tests/auto/declarative/qdeclarativefontloader/tst_qdeclarativefontloader.cpp index 859da46..5cdc96c 100644 --- a/tests/auto/declarative/qdeclarativefontloader/tst_qdeclarativefontloader.cpp +++ b/tests/auto/declarative/qdeclarativefontloader/tst_qdeclarativefontloader.cpp @@ -79,7 +79,7 @@ tst_qdeclarativefontloader::tst_qdeclarativefontloader() : void tst_qdeclarativefontloader::noFont() { - QString componentStr = "import Qt 4.6\nFontLoader { }"; + QString componentStr = "import Qt 4.7\nFontLoader { }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeFontLoader *fontObject = qobject_cast(component.create()); @@ -94,7 +94,7 @@ void tst_qdeclarativefontloader::noFont() void tst_qdeclarativefontloader::namedFont() { - QString componentStr = "import Qt 4.6\nFontLoader { name: \"Helvetica\" }"; + QString componentStr = "import Qt 4.7\nFontLoader { name: \"Helvetica\" }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeFontLoader *fontObject = qobject_cast(component.create()); @@ -107,7 +107,7 @@ void tst_qdeclarativefontloader::namedFont() void tst_qdeclarativefontloader::localFont() { - QString componentStr = "import Qt 4.6\nFontLoader { source: \"" SRCDIR "/data/tarzeau_ocr_a.ttf\" }"; + QString componentStr = "import Qt 4.7\nFontLoader { source: \"" SRCDIR "/data/tarzeau_ocr_a.ttf\" }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeFontLoader *fontObject = qobject_cast(component.create()); @@ -120,7 +120,7 @@ void tst_qdeclarativefontloader::localFont() void tst_qdeclarativefontloader::failLocalFont() { - QString componentStr = "import Qt 4.6\nFontLoader { source: \"" + QUrl::fromLocalFile(SRCDIR "/data/dummy.ttf").toString() + "\" }"; + QString componentStr = "import Qt 4.7\nFontLoader { source: \"" + QUrl::fromLocalFile(SRCDIR "/data/dummy.ttf").toString() + "\" }"; QTest::ignoreMessage(QtWarningMsg, QString("Cannot load font: QUrl( \"" + QUrl::fromLocalFile(SRCDIR "/data/dummy.ttf").toString() + "\" ) ").toUtf8().constData()); QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); @@ -134,7 +134,7 @@ void tst_qdeclarativefontloader::failLocalFont() void tst_qdeclarativefontloader::webFont() { - QString componentStr = "import Qt 4.6\nFontLoader { source: \"http://localhost:14448/tarzeau_ocr_a.ttf\" }"; + QString componentStr = "import Qt 4.7\nFontLoader { source: \"http://localhost:14448/tarzeau_ocr_a.ttf\" }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); @@ -150,7 +150,7 @@ void tst_qdeclarativefontloader::redirWebFont() { server.addRedirect("olddir/oldname.ttf","../tarzeau_ocr_a.ttf"); - QString componentStr = "import Qt 4.6\nFontLoader { source: \"http://localhost:14448/olddir/oldname.ttf\" }"; + QString componentStr = "import Qt 4.7\nFontLoader { source: \"http://localhost:14448/olddir/oldname.ttf\" }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); @@ -164,7 +164,7 @@ void tst_qdeclarativefontloader::redirWebFont() void tst_qdeclarativefontloader::failWebFont() { - QString componentStr = "import Qt 4.6\nFontLoader { source: \"http://localhost:14448/nonexist.ttf\" }"; + QString componentStr = "import Qt 4.7\nFontLoader { source: \"http://localhost:14448/nonexist.ttf\" }"; QTest::ignoreMessage(QtWarningMsg, "Cannot load font: QUrl( \"http://localhost:14448/nonexist.ttf\" ) "); QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); diff --git a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp index 07fc3aa..89be151 100644 --- a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp +++ b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp @@ -825,10 +825,10 @@ void tst_QDeclarativeGridView::componentChanges() QTRY_VERIFY(gridView); QDeclarativeComponent component(canvas->engine()); - component.setData("import Qt 4.6; Rectangle { color: \"blue\"; }", QUrl::fromLocalFile("")); + component.setData("import Qt 4.7; Rectangle { color: \"blue\"; }", QUrl::fromLocalFile("")); QDeclarativeComponent delegateComponent(canvas->engine()); - delegateComponent.setData("import Qt 4.6; Text { text: 'Name: ' + name }", QUrl::fromLocalFile("")); + delegateComponent.setData("import Qt 4.7; Text { text: 'Name: ' + name }", QUrl::fromLocalFile("")); QSignalSpy highlightSpy(gridView, SIGNAL(highlightChanged())); QSignalSpy delegateSpy(gridView, SIGNAL(delegateChanged())); diff --git a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp index ecbcfc3..52d7c16 100644 --- a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp +++ b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp @@ -95,7 +95,7 @@ tst_qdeclarativeimage::tst_qdeclarativeimage() void tst_qdeclarativeimage::noSource() { - QString componentStr = "import Qt 4.6\nImage { source: \"\" }"; + QString componentStr = "import Qt 4.7\nImage { source: \"\" }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeImage *obj = qobject_cast(component.create()); @@ -149,7 +149,7 @@ void tst_qdeclarativeimage::imageSource() if (!error.isEmpty()) QTest::ignoreMessage(QtWarningMsg, error.toUtf8()); - QString componentStr = "import Qt 4.6\nImage { source: \"" + source + "\"; asynchronous: " + QString componentStr = "import Qt 4.7\nImage { source: \"" + source + "\"; asynchronous: " + (async ? QLatin1String("true") : QLatin1String("false")) + " }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); @@ -179,7 +179,7 @@ void tst_qdeclarativeimage::imageSource() void tst_qdeclarativeimage::clearSource() { - QString componentStr = "import Qt 4.6\nImage { source: srcImage }"; + QString componentStr = "import Qt 4.7\nImage { source: srcImage }"; QDeclarativeContext *ctxt = engine.rootContext(); ctxt->setContextProperty("srcImage", QUrl::fromLocalFile(SRCDIR "/data/colors.png")); QDeclarativeComponent component(&engine); @@ -201,7 +201,7 @@ void tst_qdeclarativeimage::clearSource() void tst_qdeclarativeimage::resized() { - QString componentStr = "import Qt 4.6\nImage { source: \"" SRCDIR "/data/colors.png\"; width: 300; height: 300 }"; + QString componentStr = "import Qt 4.7\nImage { source: \"" SRCDIR "/data/colors.png\"; width: 300; height: 300 }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeImage *obj = qobject_cast(component.create()); @@ -215,7 +215,7 @@ void tst_qdeclarativeimage::resized() void tst_qdeclarativeimage::smooth() { - QString componentStr = "import Qt 4.6\nImage { source: \"" SRCDIR "/data/colors.png\"; smooth: true; width: 300; height: 300 }"; + QString componentStr = "import Qt 4.7\nImage { source: \"" SRCDIR "/data/colors.png\"; smooth: true; width: 300; height: 300 }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeImage *obj = qobject_cast(component.create()); @@ -230,7 +230,7 @@ void tst_qdeclarativeimage::smooth() void tst_qdeclarativeimage::pixmap() { - QString componentStr = "import Qt 4.6\nImage { pixmap: testPixmap }"; + QString componentStr = "import Qt 4.7\nImage { pixmap: testPixmap }"; QPixmap pixmap; QDeclarativeContext *ctxt = engine.rootContext(); @@ -261,7 +261,7 @@ void tst_qdeclarativeimage::pixmap() void tst_qdeclarativeimage::svg() { QString src = QUrl::fromLocalFile(SRCDIR "/data/heart.svg").toString(); - QString componentStr = "import Qt 4.6\nImage { source: \"" + src + "\"; sourceSize.width: 300; sourceSize.height: 300 }"; + QString componentStr = "import Qt 4.7\nImage { source: \"" + src + "\"; sourceSize.width: 300; sourceSize.height: 300 }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeImage *obj = qobject_cast(component.create()); @@ -300,7 +300,7 @@ void tst_qdeclarativeimage::big() // have to build a 400 MB image. That would be a bug in the JPEG loader. QString src = QUrl::fromLocalFile(SRCDIR "/data/big.jpeg").toString(); - QString componentStr = "import Qt 4.6\nImage { source: \"" + src + "\"; sourceSize.width: 256; sourceSize.height: 256 }"; + QString componentStr = "import Qt 4.7\nImage { source: \"" + src + "\"; sourceSize.width: 256; sourceSize.height: 256 }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); diff --git a/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp b/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp index fe5f5a2..162c266 100644 --- a/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp +++ b/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp @@ -114,7 +114,7 @@ void tst_qdeclarativeimageprovider::imageSource() engine.addImageProvider("test", new TestProvider); QVERIFY(engine.imageProvider("test") != 0); - QString componentStr = "import Qt 4.6\nImage { source: \"" + source + "\"; " + properties + " }"; + QString componentStr = "import Qt 4.7\nImage { source: \"" + source + "\"; " + properties + " }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeImage *obj = qobject_cast(component.create()); @@ -145,7 +145,7 @@ void tst_qdeclarativeimageprovider::removeProvider() QVERIFY(engine.imageProvider("test2") != 0); // add provider, confirm it works - QString componentStr = "import Qt 4.6\nImage { source: \"image://test2/exists1.png\" }"; + QString componentStr = "import Qt 4.7\nImage { source: \"image://test2/exists1.png\" }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeImage *obj = qobject_cast(component.create()); diff --git a/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp b/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp index a6171ae..4400116 100644 --- a/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp +++ b/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp @@ -293,7 +293,7 @@ void tst_QDeclarativeItem::keyNavigation() void tst_QDeclarativeItem::smooth() { QDeclarativeComponent component(&engine); - component.setData("import Qt 4.6; Item { smooth: false; }", QUrl::fromLocalFile("")); + component.setData("import Qt 4.7; Item { smooth: false; }", QUrl::fromLocalFile("")); QDeclarativeItem *item = qobject_cast(component.create()); QSignalSpy spy(item, SIGNAL(smoothChanged(bool))); @@ -322,7 +322,7 @@ void tst_QDeclarativeItem::smooth() void tst_QDeclarativeItem::clip() { QDeclarativeComponent component(&engine); - component.setData("import Qt 4.6\nItem { clip: false\n }", QUrl::fromLocalFile("")); + component.setData("import Qt 4.7\nItem { clip: false\n }", QUrl::fromLocalFile("")); QDeclarativeItem *item = qobject_cast(component.create()); QSignalSpy spy(item, SIGNAL(clipChanged(bool))); @@ -426,7 +426,7 @@ void tst_QDeclarativeItem::transforms() QFETCH(QByteArray, qml); QFETCH(QMatrix, matrix); QDeclarativeComponent component(&engine); - component.setData("import Qt 4.6\nItem { transform: "+qml+"}", QUrl::fromLocalFile("")); + component.setData("import Qt 4.7\nItem { transform: "+qml+"}", QUrl::fromLocalFile("")); QDeclarativeItem *item = qobject_cast(component.create()); QVERIFY(item); QCOMPARE(item->sceneMatrix(), matrix); diff --git a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp index 373842b..7c327c2 100644 --- a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp +++ b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp @@ -1257,12 +1257,12 @@ void tst_qdeclarativelanguage::importsLocal_data() << "QDeclarativeRectangle" << ""; QTest::newRow("local import second") - << "import Qt 4.6\nimport \"subdir\"\n" + << "import Qt 4.7\nimport \"subdir\"\n" "Test {}" << "QDeclarativeRectangle" << ""; QTest::newRow("local import subsubdir") - << "import Qt 4.6\nimport \"subdir/subsubdir\"\n" + << "import Qt 4.7\nimport \"subdir/subsubdir\"\n" "SubTest {}" << "QDeclarativeRectangle" << ""; @@ -1465,24 +1465,24 @@ void tst_qdeclarativelanguage::importsOrder_data() QTest::newRow("installed import versus builtin 1") << "import com.nokia.installedtest 1.5\n" - "import Qt 4.6\n" + "import Qt 4.7\n" "Rectangle {}" << "QDeclarativeRectangle" << ""; QTest::newRow("installed import versus builtin 2") << - "import Qt 4.6\n" + "import Qt 4.7\n" "import com.nokia.installedtest 1.5\n" "Rectangle {}" << "QDeclarativeText" << ""; QTest::newRow("namespaces cannot be overridden by types 1") << - "import Qt 4.6 as Rectangle\n" + "import Qt 4.7 as Rectangle\n" "import com.nokia.installedtest 1.5\n" "Rectangle {}" << "" << "Namespace Rectangle cannot be used as a type"; QTest::newRow("namespaces cannot be overridden by types 2") << - "import Qt 4.6 as Rectangle\n" + "import Qt 4.7 as Rectangle\n" "import com.nokia.installedtest 1.5\n" "Rectangle.Image {}" << "QDeclarativeImage" @@ -1537,7 +1537,7 @@ void tst_qdeclarativelanguage::qmlAttachedPropertiesObjectMethod() void tst_qdeclarativelanguage::crash1() { QDeclarativeComponent component(&engine); - component.setData("import Qt 4.6\nComponent {}", QUrl()); + component.setData("import Qt 4.7\nComponent {}", QUrl()); } void tst_qdeclarativelanguage::crash2() diff --git a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp index 5962a42..9d61ad0 100644 --- a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp +++ b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp @@ -118,7 +118,7 @@ void tst_QDeclarativeListModel::waitForWorker(QDeclarativeItem *item) void tst_QDeclarativeListModel::static_i18n() { QString expect = QString::fromUtf8("na\303\257ve"); - QString componentStr = "import Qt 4.6\nListModel { ListElement { prop1: \""+expect+"\" } }"; + QString componentStr = "import Qt 4.7\nListModel { ListElement { prop1: \""+expect+"\" } }"; QDeclarativeEngine engine; QDeclarativeComponent component(&engine); component.setData(componentStr.toUtf8(), QUrl::fromLocalFile("")); @@ -139,7 +139,7 @@ void tst_QDeclarativeListModel::static_nestedElements() QString elementsStr = elements.join(",\n") + "\n"; QString componentStr = - "import Qt 4.6\n" + "import Qt 4.7\n" "ListModel {\n" " ListElement {\n" " attributes: [\n"; @@ -468,7 +468,7 @@ void tst_QDeclarativeListModel::static_types() QFETCH(QString, qml); QFETCH(QVariant, value); - qml = "import Qt 4.6\nListModel { " + qml + " }"; + qml = "import Qt 4.7\nListModel { " + qml + " }"; QDeclarativeEngine engine; QDeclarativeComponent component(&engine); @@ -500,35 +500,35 @@ void tst_QDeclarativeListModel::error_data() QTest::addColumn("error"); QTest::newRow("id not allowed in ListElement") - << "import Qt 4.6\nListModel { ListElement { id: fred } }" + << "import Qt 4.7\nListModel { ListElement { id: fred } }" << "ListElement: cannot use reserved \"id\" property"; QTest::newRow("id allowed in ListModel") - << "import Qt 4.6\nListModel { id:model }" + << "import Qt 4.7\nListModel { id:model }" << ""; QTest::newRow("random properties not allowed in ListModel") - << "import Qt 4.6\nListModel { foo:123 }" + << "import Qt 4.7\nListModel { foo:123 }" << "ListModel: undefined property 'foo'"; QTest::newRow("random properties allowed in ListElement") - << "import Qt 4.6\nListModel { ListElement { foo:123 } }" + << "import Qt 4.7\nListModel { ListElement { foo:123 } }" << ""; QTest::newRow("bindings not allowed in ListElement") - << "import Qt 4.6\nRectangle { id: rect; ListModel { ListElement { foo: rect.color } } }" + << "import Qt 4.7\nRectangle { id: rect; ListModel { ListElement { foo: rect.color } } }" << "ListElement: cannot use script for property value"; QTest::newRow("random object list properties allowed in ListElement") - << "import Qt 4.6\nListModel { ListElement { foo: [ ListElement { bar: 123 } ] } }" + << "import Qt 4.7\nListModel { ListElement { foo: [ ListElement { bar: 123 } ] } }" << ""; QTest::newRow("default properties not allowed in ListElement") - << "import Qt 4.6\nListModel { ListElement { Item { } } }" + << "import Qt 4.7\nListModel { ListElement { Item { } } }" << "ListElement: cannot contain nested elements"; QTest::newRow("QML elements not allowed in ListElement") - << "import Qt 4.6\nListModel { ListElement { a: Item { } } }" + << "import Qt 4.7\nListModel { ListElement { a: Item { } } }" << "ListElement: cannot contain nested elements"; } diff --git a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp index 46d90aa..6b7a361 100644 --- a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp +++ b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp @@ -1361,10 +1361,10 @@ void tst_QDeclarativeListView::componentChanges() QTRY_VERIFY(listView); QDeclarativeComponent component(canvas->engine()); - component.setData("import Qt 4.6; Rectangle { color: \"blue\"; }", QUrl::fromLocalFile("")); + component.setData("import Qt 4.7; Rectangle { color: \"blue\"; }", QUrl::fromLocalFile("")); QDeclarativeComponent delegateComponent(canvas->engine()); - delegateComponent.setData("import Qt 4.6; Text { text: 'Name: ' + name }", QUrl::fromLocalFile("")); + delegateComponent.setData("import Qt 4.7; Text { text: 'Name: ' + name }", QUrl::fromLocalFile("")); QSignalSpy highlightSpy(listView, SIGNAL(highlightChanged())); QSignalSpy delegateSpy(listView, SIGNAL(delegateChanged())); diff --git a/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp b/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp index e6553dd..4a82b50 100644 --- a/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp +++ b/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp @@ -104,7 +104,7 @@ tst_QDeclarativeLoader::tst_QDeclarativeLoader() void tst_QDeclarativeLoader::url() { QDeclarativeComponent component(&engine); - component.setData(QByteArray("import Qt 4.6\nLoader { source: \"Rect120x60.qml\" }"), TEST_FILE("")); + component.setData(QByteArray("import Qt 4.7\nLoader { source: \"Rect120x60.qml\" }"), TEST_FILE("")); QDeclarativeLoader *loader = qobject_cast(component.create()); QVERIFY(loader != 0); QVERIFY(loader->item()); @@ -141,7 +141,7 @@ void tst_QDeclarativeLoader::invalidUrl() QTest::ignoreMessage(QtWarningMsg, QString("(:-1: File error for URL " + QUrl::fromLocalFile(SRCDIR "/data/IDontExist.qml").toString() + ") ").toUtf8().constData()); QDeclarativeComponent component(&engine); - component.setData(QByteArray("import Qt 4.6\nLoader { source: \"IDontExist.qml\" }"), TEST_FILE("")); + component.setData(QByteArray("import Qt 4.7\nLoader { source: \"IDontExist.qml\" }"), TEST_FILE("")); QDeclarativeLoader *loader = qobject_cast(component.create()); QVERIFY(loader != 0); QVERIFY(loader->item() == 0); @@ -157,7 +157,7 @@ void tst_QDeclarativeLoader::clear() { QDeclarativeComponent component(&engine); component.setData(QByteArray( - "import Qt 4.6\n" + "import Qt 4.7\n" " Loader { id: loader\n" " source: 'Rect120x60.qml'\n" " Timer { interval: 200; running: true; onTriggered: loader.source = '' }\n" @@ -203,7 +203,7 @@ void tst_QDeclarativeLoader::clear() void tst_QDeclarativeLoader::urlToComponent() { QDeclarativeComponent component(&engine); - component.setData(QByteArray("import Qt 4.6\n" + component.setData(QByteArray("import Qt 4.7\n" "Loader {\n" " id: loader\n" " Component { id: myComp; Rectangle { width: 10; height: 10 } }\n" @@ -412,7 +412,7 @@ void tst_QDeclarativeLoader::networkRequestUrl() server.serveDirectory(SRCDIR "/data"); QDeclarativeComponent component(&engine); - component.setData(QByteArray("import Qt 4.6\nLoader { source: \"http://127.0.0.1:14450/Rect120x60.qml\" }"), QUrl::fromLocalFile(SRCDIR "/dummy.qml")); + component.setData(QByteArray("import Qt 4.7\nLoader { source: \"http://127.0.0.1:14450/Rect120x60.qml\" }"), QUrl::fromLocalFile(SRCDIR "/dummy.qml")); if (component.isError()) qDebug() << component.errors(); QDeclarativeLoader *loader = qobject_cast(component.create()); @@ -436,7 +436,7 @@ void tst_QDeclarativeLoader::networkComponent() QDeclarativeComponent component(&engine); component.setData(QByteArray( - "import Qt 4.6\n" + "import Qt 4.7\n" "import \"http://127.0.0.1:14450/\" as NW\n" "Item {\n" " Component { id: comp; NW.SlowRect {} }\n" @@ -468,7 +468,7 @@ void tst_QDeclarativeLoader::failNetworkRequest() QTest::ignoreMessage(QtWarningMsg, "(:-1: Network error for URL http://127.0.0.1:14450/IDontExist.qml) "); QDeclarativeComponent component(&engine); - component.setData(QByteArray("import Qt 4.6\nLoader { source: \"http://127.0.0.1:14450/IDontExist.qml\" }"), QUrl::fromLocalFile("http://127.0.0.1:14450/dummy.qml")); + component.setData(QByteArray("import Qt 4.7\nLoader { source: \"http://127.0.0.1:14450/IDontExist.qml\" }"), QUrl::fromLocalFile("http://127.0.0.1:14450/dummy.qml")); QDeclarativeLoader *loader = qobject_cast(component.create()); QVERIFY(loader != 0); diff --git a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp index 4d43c68..df7c511 100644 --- a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp +++ b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp @@ -632,7 +632,7 @@ void tst_QDeclarativePathView::componentChanges() QVERIFY(pathView); QDeclarativeComponent delegateComponent(canvas->engine()); - delegateComponent.setData("import Qt 4.6; Text { text: 'Name: ' + name }", QUrl::fromLocalFile("")); + delegateComponent.setData("import Qt 4.7; Text { text: 'Name: ' + name }", QUrl::fromLocalFile("")); QSignalSpy delegateSpy(pathView, SIGNAL(delegateChanged())); diff --git a/tests/auto/declarative/qdeclarativepropertymap/tst_qdeclarativepropertymap.cpp b/tests/auto/declarative/qdeclarativepropertymap/tst_qdeclarativepropertymap.cpp index c996a14..f1d3bf0 100644 --- a/tests/auto/declarative/qdeclarativepropertymap/tst_qdeclarativepropertymap.cpp +++ b/tests/auto/declarative/qdeclarativepropertymap/tst_qdeclarativepropertymap.cpp @@ -138,7 +138,7 @@ void tst_QDeclarativePropertyMap::changed() QDeclarativeContext *ctxt = engine.rootContext(); ctxt->setContextProperty(QLatin1String("testdata"), &map); QDeclarativeComponent component(&engine); - component.setData("import Qt 4.6\nText { text: { testdata.key1 = 'Hello World'; 'X' } }", + component.setData("import Qt 4.7\nText { text: { testdata.key1 = 'Hello World'; 'X' } }", QUrl::fromLocalFile("")); QVERIFY(component.isReady()); QDeclarativeText *txt = qobject_cast(component.create()); @@ -179,7 +179,7 @@ void tst_QDeclarativePropertyMap::crashBug() context.setContextProperty("map", &map); QDeclarativeComponent c(&engine); - c.setData("import Qt 4.6\nBinding { target: map; property: \"myProp\"; value: 10 + 23 }",QUrl()); + c.setData("import Qt 4.7\nBinding { target: map; property: \"myProp\"; value: 10 + 23 }",QUrl()); QObject *obj = c.create(&context); delete obj; } diff --git a/tests/auto/declarative/qdeclarativerepeater/tst_qdeclarativerepeater.cpp b/tests/auto/declarative/qdeclarativerepeater/tst_qdeclarativerepeater.cpp index 419f5ea..8be7d80 100644 --- a/tests/auto/declarative/qdeclarativerepeater/tst_qdeclarativerepeater.cpp +++ b/tests/auto/declarative/qdeclarativerepeater/tst_qdeclarativerepeater.cpp @@ -354,7 +354,7 @@ void tst_QDeclarativeRepeater::properties() QSignalSpy delegateSpy(repeater, SIGNAL(delegateChanged())); QDeclarativeComponent rectComponent(&engine); - rectComponent.setData("import Qt 4.6; Rectangle {}", QUrl::fromLocalFile("")); + rectComponent.setData("import Qt 4.7; Rectangle {}", QUrl::fromLocalFile("")); repeater->setDelegate(&rectComponent); QCOMPARE(delegateSpy.count(),1); diff --git a/tests/auto/declarative/qdeclarativesystempalette/tst_qdeclarativesystempalette.cpp b/tests/auto/declarative/qdeclarativesystempalette/tst_qdeclarativesystempalette.cpp index 5c93952..7927d97 100644 --- a/tests/auto/declarative/qdeclarativesystempalette/tst_qdeclarativesystempalette.cpp +++ b/tests/auto/declarative/qdeclarativesystempalette/tst_qdeclarativesystempalette.cpp @@ -70,7 +70,7 @@ tst_qdeclarativesystempalette::tst_qdeclarativesystempalette() void tst_qdeclarativesystempalette::activePalette() { - QString componentStr = "import Qt 4.6\nSystemPalette { }"; + QString componentStr = "import Qt 4.7\nSystemPalette { }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeSystemPalette *object = qobject_cast(component.create()); @@ -99,7 +99,7 @@ void tst_qdeclarativesystempalette::activePalette() void tst_qdeclarativesystempalette::inactivePalette() { - QString componentStr = "import Qt 4.6\nSystemPalette { colorGroup: SystemPalette.Inactive }"; + QString componentStr = "import Qt 4.7\nSystemPalette { colorGroup: SystemPalette.Inactive }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeSystemPalette *object = qobject_cast(component.create()); @@ -129,7 +129,7 @@ void tst_qdeclarativesystempalette::inactivePalette() void tst_qdeclarativesystempalette::disabledPalette() { - QString componentStr = "import Qt 4.6\nSystemPalette { colorGroup: SystemPalette.Disabled }"; + QString componentStr = "import Qt 4.7\nSystemPalette { colorGroup: SystemPalette.Disabled }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeSystemPalette *object = qobject_cast(component.create()); @@ -159,7 +159,7 @@ void tst_qdeclarativesystempalette::disabledPalette() void tst_qdeclarativesystempalette::paletteChanged() { - QString componentStr = "import Qt 4.6\nSystemPalette { }"; + QString componentStr = "import Qt 4.7\nSystemPalette { }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeSystemPalette *object = qobject_cast(component.create()); diff --git a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp index bf7d110..2d10756 100644 --- a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp +++ b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp @@ -156,7 +156,7 @@ void tst_qdeclarativetext::text() { { QDeclarativeComponent textComponent(&engine); - textComponent.setData("import Qt 4.6\nText { text: \"\" }", QUrl::fromLocalFile("")); + textComponent.setData("import Qt 4.7\nText { text: \"\" }", QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); QVERIFY(textObject != 0); @@ -168,7 +168,7 @@ void tst_qdeclarativetext::text() for (int i = 0; i < standard.size(); i++) { - QString componentStr = "import Qt 4.6\nText { text: \"" + standard.at(i) + "\" }"; + QString componentStr = "import Qt 4.7\nText { text: \"" + standard.at(i) + "\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); @@ -181,7 +181,7 @@ void tst_qdeclarativetext::text() for (int i = 0; i < richText.size(); i++) { - QString componentStr = "import Qt 4.6\nText { text: \"" + richText.at(i) + "\" }"; + QString componentStr = "import Qt 4.7\nText { text: \"" + richText.at(i) + "\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -198,7 +198,7 @@ void tst_qdeclarativetext::width() // uses Font metrics to find the width for standard and document to find the width for rich { QDeclarativeComponent textComponent(&engine); - textComponent.setData("import Qt 4.6\nText { text: \"\" }", QUrl::fromLocalFile("")); + textComponent.setData("import Qt 4.7\nText { text: \"\" }", QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); QVERIFY(textObject != 0); @@ -214,7 +214,7 @@ void tst_qdeclarativetext::width() qreal metricWidth = fm.size(Qt::TextExpandTabs && Qt::TextShowMnemonic, standard.at(i)).width(); metricWidth = qCeil(metricWidth); - QString componentStr = "import Qt 4.6\nText { text: \"" + standard.at(i) + "\" }"; + QString componentStr = "import Qt 4.7\nText { text: \"" + standard.at(i) + "\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -234,7 +234,7 @@ void tst_qdeclarativetext::width() int documentWidth = document.idealWidth(); - QString componentStr = "import Qt 4.6\nText { text: \"" + richText.at(i) + "\" }"; + QString componentStr = "import Qt 4.7\nText { text: \"" + richText.at(i) + "\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -251,7 +251,7 @@ void tst_qdeclarativetext::wrap() // for specified width and wrap set true { QDeclarativeComponent textComponent(&engine); - textComponent.setData("import Qt 4.6\nText { text: \"Hello\"; wrapMode: Text.WordWrap; width: 300 }", QUrl::fromLocalFile("")); + textComponent.setData("import Qt 4.7\nText { text: \"Hello\"; wrapMode: Text.WordWrap; width: 300 }", QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); textHeight = textObject->height(); @@ -262,7 +262,7 @@ void tst_qdeclarativetext::wrap() for (int i = 0; i < standard.size(); i++) { - QString componentStr = "import Qt 4.6\nText { wrapMode: Text.WordWrap; width: 30; text: \"" + standard.at(i) + "\" }"; + QString componentStr = "import Qt 4.7\nText { wrapMode: Text.WordWrap; width: 30; text: \"" + standard.at(i) + "\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -278,7 +278,7 @@ void tst_qdeclarativetext::wrap() for (int i = 0; i < richText.size(); i++) { - QString componentStr = "import Qt 4.6\nText { wrapMode: Text.WordWrap; width: 30; text: \"" + richText.at(i) + "\" }"; + QString componentStr = "import Qt 4.7\nText { wrapMode: Text.WordWrap; width: 30; text: \"" + richText.at(i) + "\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -300,7 +300,7 @@ void tst_qdeclarativetext::elide() { QDeclarativeComponent textComponent(&engine); - textComponent.setData(("import Qt 4.6\nText { text: \"\"; "+elide+" width: 100 }").toLatin1(), QUrl::fromLocalFile("")); + textComponent.setData(("import Qt 4.7\nText { text: \"\"; "+elide+" width: 100 }").toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); QCOMPARE(textObject->elideMode(), m); @@ -309,7 +309,7 @@ void tst_qdeclarativetext::elide() for (int i = 0; i < standard.size(); i++) { - QString componentStr = "import Qt 4.6\nText { "+elide+" width: 100; text: \"" + standard.at(i) + "\" }"; + QString componentStr = "import Qt 4.7\nText { "+elide+" width: 100; text: \"" + standard.at(i) + "\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -321,7 +321,7 @@ void tst_qdeclarativetext::elide() // richtext - does nothing for (int i = 0; i < richText.size(); i++) { - QString componentStr = "import Qt 4.6\nText { "+elide+" width: 100; text: \"" + richText.at(i) + "\" }"; + QString componentStr = "import Qt 4.7\nText { "+elide+" width: 100; text: \"" + richText.at(i) + "\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -336,7 +336,7 @@ void tst_qdeclarativetext::textFormat() { { QDeclarativeComponent textComponent(&engine); - textComponent.setData("import Qt 4.6\nText { text: \"Hello\"; textFormat: Text.RichText }", QUrl::fromLocalFile("")); + textComponent.setData("import Qt 4.7\nText { text: \"Hello\"; textFormat: Text.RichText }", QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); QVERIFY(textObject != 0); @@ -344,7 +344,7 @@ void tst_qdeclarativetext::textFormat() } { QDeclarativeComponent textComponent(&engine); - textComponent.setData("import Qt 4.6\nText { text: \"Hello\"; textFormat: Text.PlainText }", QUrl::fromLocalFile("")); + textComponent.setData("import Qt 4.7\nText { text: \"Hello\"; textFormat: Text.PlainText }", QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); QVERIFY(textObject != 0); @@ -361,7 +361,7 @@ void tst_qdeclarativetext::horizontalAlignment() { for (int j=0; j < horizontalAlignmentmentStrings.size(); j++) { - QString componentStr = "import Qt 4.6\nText { horizontalAlignment: \"" + horizontalAlignmentmentStrings.at(j) + "\"; text: \"" + standard.at(i) + "\" }"; + QString componentStr = "import Qt 4.7\nText { horizontalAlignment: \"" + horizontalAlignmentmentStrings.at(j) + "\"; text: \"" + standard.at(i) + "\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -374,7 +374,7 @@ void tst_qdeclarativetext::horizontalAlignment() { for (int j=0; j < horizontalAlignmentmentStrings.size(); j++) { - QString componentStr = "import Qt 4.6\nText { horizontalAlignment: \"" + horizontalAlignmentmentStrings.at(j) + "\"; text: \"" + richText.at(i) + "\" }"; + QString componentStr = "import Qt 4.7\nText { horizontalAlignment: \"" + horizontalAlignmentmentStrings.at(j) + "\"; text: \"" + richText.at(i) + "\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -393,7 +393,7 @@ void tst_qdeclarativetext::verticalAlignment() { for (int j=0; j < verticalAlignmentmentStrings.size(); j++) { - QString componentStr = "import Qt 4.6\nText { verticalAlignment: \"" + verticalAlignmentmentStrings.at(j) + "\"; text: \"" + standard.at(i) + "\" }"; + QString componentStr = "import Qt 4.7\nText { verticalAlignment: \"" + verticalAlignmentmentStrings.at(j) + "\"; text: \"" + standard.at(i) + "\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -407,7 +407,7 @@ void tst_qdeclarativetext::verticalAlignment() { for (int j=0; j < verticalAlignmentmentStrings.size(); j++) { - QString componentStr = "import Qt 4.6\nText { verticalAlignment: \"" + verticalAlignmentmentStrings.at(j) + "\"; text: \"" + richText.at(i) + "\" }"; + QString componentStr = "import Qt 4.7\nText { verticalAlignment: \"" + verticalAlignmentmentStrings.at(j) + "\"; text: \"" + richText.at(i) + "\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -423,7 +423,7 @@ void tst_qdeclarativetext::font() { //test size, then bold, then italic, then family { - QString componentStr = "import Qt 4.6\nText { font.pointSize: 40; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nText { font.pointSize: 40; text: \"Hello World\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -434,7 +434,7 @@ void tst_qdeclarativetext::font() } { - QString componentStr = "import Qt 4.6\nText { font.pixelSize: 40; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nText { font.pixelSize: 40; text: \"Hello World\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -445,7 +445,7 @@ void tst_qdeclarativetext::font() } { - QString componentStr = "import Qt 4.6\nText { font.bold: true; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nText { font.bold: true; text: \"Hello World\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -455,7 +455,7 @@ void tst_qdeclarativetext::font() } { - QString componentStr = "import Qt 4.6\nText { font.italic: true; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nText { font.italic: true; text: \"Hello World\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -465,7 +465,7 @@ void tst_qdeclarativetext::font() } { - QString componentStr = "import Qt 4.6\nText { font.family: \"Helvetica\"; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nText { font.family: \"Helvetica\"; text: \"Hello World\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -476,7 +476,7 @@ void tst_qdeclarativetext::font() } { - QString componentStr = "import Qt 4.6\nText { font.family: \"\"; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nText { font.family: \"\"; text: \"Hello World\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -490,7 +490,7 @@ void tst_qdeclarativetext::style() //test style for (int i = 0; i < styles.size(); i++) { - QString componentStr = "import Qt 4.6\nText { style: \"" + styleStrings.at(i) + "\"; styleColor: \"white\"; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nText { style: \"" + styleStrings.at(i) + "\"; styleColor: \"white\"; text: \"Hello World\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -505,7 +505,7 @@ void tst_qdeclarativetext::color() //test style for (int i = 0; i < colorStrings.size(); i++) { - QString componentStr = "import Qt 4.6\nText { color: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nText { color: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -516,7 +516,7 @@ void tst_qdeclarativetext::color() for (int i = 0; i < colorStrings.size(); i++) { - QString componentStr = "import Qt 4.6\nText { styleColor: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nText { styleColor: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -530,7 +530,7 @@ void tst_qdeclarativetext::color() { for (int j = 0; j < colorStrings.size(); j++) { - QString componentStr = "import Qt 4.6\nText { color: \"" + colorStrings.at(i) + "\"; styleColor: \"" + colorStrings.at(j) + "\"; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nText { color: \"" + colorStrings.at(i) + "\"; styleColor: \"" + colorStrings.at(j) + "\"; text: \"Hello World\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -544,7 +544,7 @@ void tst_qdeclarativetext::color() QColor testColor("#001234"); testColor.setAlpha(170); - QString componentStr = "import Qt 4.6\nText { color: \"" + colorStr + "\"; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nText { color: \"" + colorStr + "\"; text: \"Hello World\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -558,14 +558,14 @@ void tst_qdeclarativetext::smooth() for (int i = 0; i < standard.size(); i++) { { - QString componentStr = "import Qt 4.6\nText { smooth: true; text: \"" + standard.at(i) + "\" }"; + QString componentStr = "import Qt 4.7\nText { smooth: true; text: \"" + standard.at(i) + "\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); QCOMPARE(textObject->smooth(), true); } { - QString componentStr = "import Qt 4.6\nText { text: \"" + standard.at(i) + "\" }"; + QString componentStr = "import Qt 4.7\nText { text: \"" + standard.at(i) + "\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -575,14 +575,14 @@ void tst_qdeclarativetext::smooth() for (int i = 0; i < richText.size(); i++) { { - QString componentStr = "import Qt 4.6\nText { smooth: true; text: \"" + richText.at(i) + "\" }"; + QString componentStr = "import Qt 4.7\nText { smooth: true; text: \"" + richText.at(i) + "\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); QCOMPARE(textObject->smooth(), true); } { - QString componentStr = "import Qt 4.6\nText { text: \"" + richText.at(i) + "\" }"; + QString componentStr = "import Qt 4.7\nText { text: \"" + richText.at(i) + "\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -594,7 +594,7 @@ void tst_qdeclarativetext::smooth() void tst_qdeclarativetext::weight() { { - QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\" }"; + QString componentStr = "import Qt 4.7\nText { text: \"Hello world!\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -603,7 +603,7 @@ void tst_qdeclarativetext::weight() QCOMPARE((int)textObject->font().weight(), (int)QDeclarativeFontValueType::Normal); } { - QString componentStr = "import Qt 4.6\nText { font.weight: \"Bold\"; text: \"Hello world!\" }"; + QString componentStr = "import Qt 4.7\nText { font.weight: \"Bold\"; text: \"Hello world!\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -616,7 +616,7 @@ void tst_qdeclarativetext::weight() void tst_qdeclarativetext::underline() { { - QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\" }"; + QString componentStr = "import Qt 4.7\nText { text: \"Hello world!\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -625,7 +625,7 @@ void tst_qdeclarativetext::underline() QCOMPARE(textObject->font().underline(), false); } { - QString componentStr = "import Qt 4.6\nText { font.underline: true; text: \"Hello world!\" }"; + QString componentStr = "import Qt 4.7\nText { font.underline: true; text: \"Hello world!\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -638,7 +638,7 @@ void tst_qdeclarativetext::underline() void tst_qdeclarativetext::overline() { { - QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\" }"; + QString componentStr = "import Qt 4.7\nText { text: \"Hello world!\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -647,7 +647,7 @@ void tst_qdeclarativetext::overline() QCOMPARE(textObject->font().overline(), false); } { - QString componentStr = "import Qt 4.6\nText { font.overline: true; text: \"Hello world!\" }"; + QString componentStr = "import Qt 4.7\nText { font.overline: true; text: \"Hello world!\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -660,7 +660,7 @@ void tst_qdeclarativetext::overline() void tst_qdeclarativetext::strikeout() { { - QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\" }"; + QString componentStr = "import Qt 4.7\nText { text: \"Hello world!\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -669,7 +669,7 @@ void tst_qdeclarativetext::strikeout() QCOMPARE(textObject->font().strikeOut(), false); } { - QString componentStr = "import Qt 4.6\nText { font.strikeout: true; text: \"Hello world!\" }"; + QString componentStr = "import Qt 4.7\nText { font.strikeout: true; text: \"Hello world!\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -682,7 +682,7 @@ void tst_qdeclarativetext::strikeout() void tst_qdeclarativetext::capitalization() { { - QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\" }"; + QString componentStr = "import Qt 4.7\nText { text: \"Hello world!\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -691,7 +691,7 @@ void tst_qdeclarativetext::capitalization() QCOMPARE((int)textObject->font().capitalization(), (int)QDeclarativeFontValueType::MixedCase); } { - QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\"; font.capitalization: \"AllUppercase\" }"; + QString componentStr = "import Qt 4.7\nText { text: \"Hello world!\"; font.capitalization: \"AllUppercase\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -700,7 +700,7 @@ void tst_qdeclarativetext::capitalization() QCOMPARE((int)textObject->font().capitalization(), (int)QDeclarativeFontValueType::AllUppercase); } { - QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\"; font.capitalization: \"AllLowercase\" }"; + QString componentStr = "import Qt 4.7\nText { text: \"Hello world!\"; font.capitalization: \"AllLowercase\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -709,7 +709,7 @@ void tst_qdeclarativetext::capitalization() QCOMPARE((int)textObject->font().capitalization(), (int)QDeclarativeFontValueType::AllLowercase); } { - QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\"; font.capitalization: \"SmallCaps\" }"; + QString componentStr = "import Qt 4.7\nText { text: \"Hello world!\"; font.capitalization: \"SmallCaps\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -718,7 +718,7 @@ void tst_qdeclarativetext::capitalization() QCOMPARE((int)textObject->font().capitalization(), (int)QDeclarativeFontValueType::SmallCaps); } { - QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\"; font.capitalization: \"Capitalize\" }"; + QString componentStr = "import Qt 4.7\nText { text: \"Hello world!\"; font.capitalization: \"Capitalize\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -731,7 +731,7 @@ void tst_qdeclarativetext::capitalization() void tst_qdeclarativetext::letterSpacing() { { - QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\" }"; + QString componentStr = "import Qt 4.7\nText { text: \"Hello world!\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -740,7 +740,7 @@ void tst_qdeclarativetext::letterSpacing() QCOMPARE(textObject->font().letterSpacing(), 0.0); } { - QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\"; font.letterSpacing: -50 }"; + QString componentStr = "import Qt 4.7\nText { text: \"Hello world!\"; font.letterSpacing: -50 }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -749,7 +749,7 @@ void tst_qdeclarativetext::letterSpacing() QCOMPARE(textObject->font().letterSpacing(), -50.); } { - QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\"; font.letterSpacing: 200 }"; + QString componentStr = "import Qt 4.7\nText { text: \"Hello world!\"; font.letterSpacing: 200 }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -762,7 +762,7 @@ void tst_qdeclarativetext::letterSpacing() void tst_qdeclarativetext::wordSpacing() { { - QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\" }"; + QString componentStr = "import Qt 4.7\nText { text: \"Hello world!\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -771,7 +771,7 @@ void tst_qdeclarativetext::wordSpacing() QCOMPARE(textObject->font().wordSpacing(), 0.0); } { - QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\"; font.wordSpacing: -50 }"; + QString componentStr = "import Qt 4.7\nText { text: \"Hello world!\"; font.wordSpacing: -50 }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -780,7 +780,7 @@ void tst_qdeclarativetext::wordSpacing() QCOMPARE(textObject->font().wordSpacing(), -50.); } { - QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\"; font.wordSpacing: 200 }"; + QString componentStr = "import Qt 4.7\nText { text: \"Hello world!\"; font.wordSpacing: 200 }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -811,7 +811,7 @@ public slots: void tst_qdeclarativetext::clickLink() { { - QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\" }"; + QString componentStr = "import Qt 4.7\nText { text: \"Hello world!\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp index 6ef1f9f..25101ba 100644 --- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp +++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp @@ -150,7 +150,7 @@ void tst_qdeclarativetextedit::text() { { QDeclarativeComponent texteditComponent(&engine); - texteditComponent.setData("import Qt 4.6\nTextEdit { text: \"\" }", QUrl()); + texteditComponent.setData("import Qt 4.7\nTextEdit { text: \"\" }", QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast(texteditComponent.create()); QVERIFY(textEditObject != 0); @@ -159,7 +159,7 @@ void tst_qdeclarativetextedit::text() for (int i = 0; i < standard.size(); i++) { - QString componentStr = "import Qt 4.6\nTextEdit { text: \"" + standard.at(i) + "\" }"; + QString componentStr = "import Qt 4.7\nTextEdit { text: \"" + standard.at(i) + "\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast(texteditComponent.create()); @@ -170,7 +170,7 @@ void tst_qdeclarativetextedit::text() for (int i = 0; i < richText.size(); i++) { - QString componentStr = "import Qt 4.6\nTextEdit { text: \"" + richText.at(i) + "\" }"; + QString componentStr = "import Qt 4.7\nTextEdit { text: \"" + richText.at(i) + "\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast(texteditComponent.create()); @@ -190,7 +190,7 @@ void tst_qdeclarativetextedit::width() // uses Font metrics to find the width for standard and document to find the width for rich { QDeclarativeComponent texteditComponent(&engine); - texteditComponent.setData("import Qt 4.6\nTextEdit { text: \"\" }", QUrl()); + texteditComponent.setData("import Qt 4.7\nTextEdit { text: \"\" }", QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast(texteditComponent.create()); QVERIFY(textEditObject != 0); @@ -204,7 +204,7 @@ void tst_qdeclarativetextedit::width() qreal metricWidth = fm.size(Qt::TextExpandTabs && Qt::TextShowMnemonic, standard.at(i)).width(); metricWidth = floor(metricWidth); - QString componentStr = "import Qt 4.6\nTextEdit { text: \"" + standard.at(i) + "\" }"; + QString componentStr = "import Qt 4.7\nTextEdit { text: \"" + standard.at(i) + "\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast(texteditComponent.create()); @@ -221,7 +221,7 @@ void tst_qdeclarativetextedit::width() int documentWidth = document.idealWidth(); - QString componentStr = "import Qt 4.6\nTextEdit { text: \"" + richText.at(i) + "\" }"; + QString componentStr = "import Qt 4.7\nTextEdit { text: \"" + richText.at(i) + "\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast(texteditComponent.create()); @@ -236,7 +236,7 @@ void tst_qdeclarativetextedit::wrap() // for specified width and wrap set true { QDeclarativeComponent texteditComponent(&engine); - texteditComponent.setData("import Qt 4.6\nTextEdit { text: \"\"; wrapMode: TextEdit.WordWrap; width: 300 }", QUrl()); + texteditComponent.setData("import Qt 4.7\nTextEdit { text: \"\"; wrapMode: TextEdit.WordWrap; width: 300 }", QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast(texteditComponent.create()); QVERIFY(textEditObject != 0); @@ -245,7 +245,7 @@ void tst_qdeclarativetextedit::wrap() for (int i = 0; i < standard.size(); i++) { - QString componentStr = "import Qt 4.6\nTextEdit { wrapMode: TextEdit.WordWrap; width: 300; text: \"" + standard.at(i) + "\" }"; + QString componentStr = "import Qt 4.7\nTextEdit { wrapMode: TextEdit.WordWrap; width: 300; text: \"" + standard.at(i) + "\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast(texteditComponent.create()); @@ -256,7 +256,7 @@ void tst_qdeclarativetextedit::wrap() for (int i = 0; i < richText.size(); i++) { - QString componentStr = "import Qt 4.6\nTextEdit { wrapMode: TextEdit.WordWrap; width: 300; text: \"" + richText.at(i) + "\" }"; + QString componentStr = "import Qt 4.7\nTextEdit { wrapMode: TextEdit.WordWrap; width: 300; text: \"" + richText.at(i) + "\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast(texteditComponent.create()); @@ -271,7 +271,7 @@ void tst_qdeclarativetextedit::textFormat() { { QDeclarativeComponent textComponent(&engine); - textComponent.setData("import Qt 4.6\nTextEdit { text: \"Hello\"; textFormat: Text.RichText }", QUrl::fromLocalFile("")); + textComponent.setData("import Qt 4.7\nTextEdit { text: \"Hello\"; textFormat: Text.RichText }", QUrl::fromLocalFile("")); QDeclarativeTextEdit *textObject = qobject_cast(textComponent.create()); QVERIFY(textObject != 0); @@ -279,7 +279,7 @@ void tst_qdeclarativetextedit::textFormat() } { QDeclarativeComponent textComponent(&engine); - textComponent.setData("import Qt 4.6\nTextEdit { text: \"Hello\"; textFormat: Text.PlainText }", QUrl::fromLocalFile("")); + textComponent.setData("import Qt 4.7\nTextEdit { text: \"Hello\"; textFormat: Text.PlainText }", QUrl::fromLocalFile("")); QDeclarativeTextEdit *textObject = qobject_cast(textComponent.create()); QVERIFY(textObject != 0); @@ -296,7 +296,7 @@ void tst_qdeclarativetextedit::hAlign() { for (int j=0; j < hAlignmentStrings.size(); j++) { - QString componentStr = "import Qt 4.6\nTextEdit { horizontalAlignment: \"" + hAlignmentStrings.at(j) + "\"; text: \"" + standard.at(i) + "\" }"; + QString componentStr = "import Qt 4.7\nTextEdit { horizontalAlignment: \"" + hAlignmentStrings.at(j) + "\"; text: \"" + standard.at(i) + "\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast(texteditComponent.create()); @@ -310,7 +310,7 @@ void tst_qdeclarativetextedit::hAlign() { for (int j=0; j < hAlignmentStrings.size(); j++) { - QString componentStr = "import Qt 4.6\nTextEdit { horizontalAlignment: \"" + hAlignmentStrings.at(j) + "\"; text: \"" + richText.at(i) + "\" }"; + QString componentStr = "import Qt 4.7\nTextEdit { horizontalAlignment: \"" + hAlignmentStrings.at(j) + "\"; text: \"" + richText.at(i) + "\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast(texteditComponent.create()); @@ -330,7 +330,7 @@ void tst_qdeclarativetextedit::vAlign() { for (int j=0; j < vAlignmentStrings.size(); j++) { - QString componentStr = "import Qt 4.6\nTextEdit { verticalAlignment: \"" + vAlignmentStrings.at(j) + "\"; text: \"" + standard.at(i) + "\" }"; + QString componentStr = "import Qt 4.7\nTextEdit { verticalAlignment: \"" + vAlignmentStrings.at(j) + "\"; text: \"" + standard.at(i) + "\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast(texteditComponent.create()); @@ -344,7 +344,7 @@ void tst_qdeclarativetextedit::vAlign() { for (int j=0; j < vAlignmentStrings.size(); j++) { - QString componentStr = "import Qt 4.6\nTextEdit { verticalAlignment: \"" + vAlignmentStrings.at(j) + "\"; text: \"" + richText.at(i) + "\" }"; + QString componentStr = "import Qt 4.7\nTextEdit { verticalAlignment: \"" + vAlignmentStrings.at(j) + "\"; text: \"" + richText.at(i) + "\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast(texteditComponent.create()); @@ -360,7 +360,7 @@ void tst_qdeclarativetextedit::font() { //test size, then bold, then italic, then family { - QString componentStr = "import Qt 4.6\nTextEdit { font.pointSize: 40; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nTextEdit { font.pointSize: 40; text: \"Hello World\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast(texteditComponent.create()); @@ -372,7 +372,7 @@ void tst_qdeclarativetextedit::font() } { - QString componentStr = "import Qt 4.6\nTextEdit { font.bold: true; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nTextEdit { font.bold: true; text: \"Hello World\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast(texteditComponent.create()); @@ -383,7 +383,7 @@ void tst_qdeclarativetextedit::font() } { - QString componentStr = "import Qt 4.6\nTextEdit { font.italic: true; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nTextEdit { font.italic: true; text: \"Hello World\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast(texteditComponent.create()); @@ -394,7 +394,7 @@ void tst_qdeclarativetextedit::font() } { - QString componentStr = "import Qt 4.6\nTextEdit { font.family: \"Helvetica\"; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nTextEdit { font.family: \"Helvetica\"; text: \"Hello World\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast(texteditComponent.create()); @@ -406,7 +406,7 @@ void tst_qdeclarativetextedit::font() } { - QString componentStr = "import Qt 4.6\nTextEdit { font.family: \"\"; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nTextEdit { font.family: \"\"; text: \"Hello World\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast(texteditComponent.create()); @@ -421,7 +421,7 @@ void tst_qdeclarativetextedit::color() //test normal for (int i = 0; i < colorStrings.size(); i++) { - QString componentStr = "import Qt 4.6\nTextEdit { color: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nTextEdit { color: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast(texteditComponent.create()); @@ -433,7 +433,7 @@ void tst_qdeclarativetextedit::color() //test selection for (int i = 0; i < colorStrings.size(); i++) { - QString componentStr = "import Qt 4.6\nTextEdit { selectionColor: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nTextEdit { selectionColor: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast(texteditComponent.create()); @@ -444,7 +444,7 @@ void tst_qdeclarativetextedit::color() //test selected text for (int i = 0; i < colorStrings.size(); i++) { - QString componentStr = "import Qt 4.6\nTextEdit { selectedTextColor: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nTextEdit { selectedTextColor: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast(texteditComponent.create()); @@ -457,7 +457,7 @@ void tst_qdeclarativetextedit::color() QColor testColor("#001234"); testColor.setAlpha(170); - QString componentStr = "import Qt 4.6\nTextEdit { color: \"" + colorStr + "\"; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nTextEdit { color: \"" + colorStr + "\"; text: \"Hello World\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast(texteditComponent.create()); @@ -470,7 +470,7 @@ void tst_qdeclarativetextedit::color() void tst_qdeclarativetextedit::textMargin() { for(qreal i=0; i<=10; i+=0.3){ - QString componentStr = "import Qt 4.6\nTextEdit { textMargin: " + QString::number(i) + "; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nTextEdit { textMargin: " + QString::number(i) + "; text: \"Hello World\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast(texteditComponent.create()); @@ -482,7 +482,7 @@ void tst_qdeclarativetextedit::textMargin() void tst_qdeclarativetextedit::persistentSelection() { { - QString componentStr = "import Qt 4.6\nTextEdit { persistentSelection: true; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nTextEdit { persistentSelection: true; text: \"Hello World\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast(texteditComponent.create()); @@ -491,7 +491,7 @@ void tst_qdeclarativetextedit::persistentSelection() } { - QString componentStr = "import Qt 4.6\nTextEdit { persistentSelection: false; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nTextEdit { persistentSelection: false; text: \"Hello World\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast(texteditComponent.create()); @@ -503,7 +503,7 @@ void tst_qdeclarativetextedit::persistentSelection() void tst_qdeclarativetextedit::focusOnPress() { { - QString componentStr = "import Qt 4.6\nTextEdit { focusOnPress: true; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nTextEdit { focusOnPress: true; text: \"Hello World\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast(texteditComponent.create()); @@ -512,7 +512,7 @@ void tst_qdeclarativetextedit::focusOnPress() } { - QString componentStr = "import Qt 4.6\nTextEdit { focusOnPress: false; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nTextEdit { focusOnPress: false; text: \"Hello World\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast(texteditComponent.create()); @@ -524,7 +524,7 @@ void tst_qdeclarativetextedit::focusOnPress() void tst_qdeclarativetextedit::selection() { QString testStr = standard[0];//TODO: What should happen for multiline/rich text? - QString componentStr = "import Qt 4.6\nTextEdit { text: \""+ testStr +"\"; }"; + QString componentStr = "import Qt 4.7\nTextEdit { text: \""+ testStr +"\"; }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast(texteditComponent.create()); diff --git a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp index 9a66a36..fcd7527 100644 --- a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp +++ b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp @@ -109,7 +109,7 @@ void tst_qdeclarativetextinput::text() { { QDeclarativeComponent textinputComponent(&engine); - textinputComponent.setData("import Qt 4.6\nTextInput { text: \"\" }", QUrl()); + textinputComponent.setData("import Qt 4.7\nTextInput { text: \"\" }", QUrl()); QDeclarativeTextInput *textinputObject = qobject_cast(textinputComponent.create()); QVERIFY(textinputObject != 0); @@ -120,7 +120,7 @@ void tst_qdeclarativetextinput::text() for (int i = 0; i < standard.size(); i++) { - QString componentStr = "import Qt 4.6\nTextInput { text: \"" + standard.at(i) + "\" }"; + QString componentStr = "import Qt 4.7\nTextInput { text: \"" + standard.at(i) + "\" }"; QDeclarativeComponent textinputComponent(&engine); textinputComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextInput *textinputObject = qobject_cast(textinputComponent.create()); @@ -138,7 +138,7 @@ void tst_qdeclarativetextinput::width() // uses Font metrics to find the width for standard { QDeclarativeComponent textinputComponent(&engine); - textinputComponent.setData("import Qt 4.6\nTextInput { text: \"\" }", QUrl()); + textinputComponent.setData("import Qt 4.7\nTextInput { text: \"\" }", QUrl()); QDeclarativeTextInput *textinputObject = qobject_cast(textinputComponent.create()); QVERIFY(textinputObject != 0); @@ -153,7 +153,7 @@ void tst_qdeclarativetextinput::width() QFontMetricsF fm(f); qreal metricWidth = fm.width(standard.at(i)); - QString componentStr = "import Qt 4.6\nTextInput { text: \"" + standard.at(i) + "\" }"; + QString componentStr = "import Qt 4.7\nTextInput { text: \"" + standard.at(i) + "\" }"; QDeclarativeComponent textinputComponent(&engine); textinputComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextInput *textinputObject = qobject_cast(textinputComponent.create()); @@ -169,7 +169,7 @@ void tst_qdeclarativetextinput::font() { //test size, then bold, then italic, then family { - QString componentStr = "import Qt 4.6\nTextInput { font.pointSize: 40; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nTextInput { font.pointSize: 40; text: \"Hello World\" }"; QDeclarativeComponent textinputComponent(&engine); textinputComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextInput *textinputObject = qobject_cast(textinputComponent.create()); @@ -183,7 +183,7 @@ void tst_qdeclarativetextinput::font() } { - QString componentStr = "import Qt 4.6\nTextInput { font.bold: true; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nTextInput { font.bold: true; text: \"Hello World\" }"; QDeclarativeComponent textinputComponent(&engine); textinputComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextInput *textinputObject = qobject_cast(textinputComponent.create()); @@ -196,7 +196,7 @@ void tst_qdeclarativetextinput::font() } { - QString componentStr = "import Qt 4.6\nTextInput { font.italic: true; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nTextInput { font.italic: true; text: \"Hello World\" }"; QDeclarativeComponent textinputComponent(&engine); textinputComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextInput *textinputObject = qobject_cast(textinputComponent.create()); @@ -209,7 +209,7 @@ void tst_qdeclarativetextinput::font() } { - QString componentStr = "import Qt 4.6\nTextInput { font.family: \"Helvetica\"; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nTextInput { font.family: \"Helvetica\"; text: \"Hello World\" }"; QDeclarativeComponent textinputComponent(&engine); textinputComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextInput *textinputObject = qobject_cast(textinputComponent.create()); @@ -223,7 +223,7 @@ void tst_qdeclarativetextinput::font() } { - QString componentStr = "import Qt 4.6\nTextInput { font.family: \"\"; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nTextInput { font.family: \"\"; text: \"Hello World\" }"; QDeclarativeComponent textinputComponent(&engine); textinputComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextInput *textinputObject = qobject_cast(textinputComponent.create()); @@ -240,7 +240,7 @@ void tst_qdeclarativetextinput::color() //test color for (int i = 0; i < colorStrings.size(); i++) { - QString componentStr = "import Qt 4.6\nTextInput { color: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nTextInput { color: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; QDeclarativeComponent textinputComponent(&engine); textinputComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextInput *textinputObject = qobject_cast(textinputComponent.create()); @@ -253,7 +253,7 @@ void tst_qdeclarativetextinput::color() //test selection color for (int i = 0; i < colorStrings.size(); i++) { - QString componentStr = "import Qt 4.6\nTextInput { selectionColor: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nTextInput { selectionColor: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; QDeclarativeComponent textinputComponent(&engine); textinputComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextInput *textinputObject = qobject_cast(textinputComponent.create()); @@ -266,7 +266,7 @@ void tst_qdeclarativetextinput::color() //test selected text color for (int i = 0; i < colorStrings.size(); i++) { - QString componentStr = "import Qt 4.6\nTextInput { selectedTextColor: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nTextInput { selectedTextColor: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; QDeclarativeComponent textinputComponent(&engine); textinputComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextInput *textinputObject = qobject_cast(textinputComponent.create()); @@ -281,7 +281,7 @@ void tst_qdeclarativetextinput::color() QColor testColor("#001234"); testColor.setAlpha(170); - QString componentStr = "import Qt 4.6\nTextInput { color: \"" + colorStr + "\"; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nTextInput { color: \"" + colorStr + "\"; text: \"Hello World\" }"; QDeclarativeComponent textinputComponent(&engine); textinputComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextInput *textinputObject = qobject_cast(textinputComponent.create()); @@ -296,7 +296,7 @@ void tst_qdeclarativetextinput::color() void tst_qdeclarativetextinput::selection() { QString testStr = standard[0]; - QString componentStr = "import Qt 4.6\nTextInput { text: \""+ testStr +"\"; }"; + QString componentStr = "import Qt 4.7\nTextInput { text: \""+ testStr +"\"; }"; QDeclarativeComponent textinputComponent(&engine); textinputComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextInput *textinputObject = qobject_cast(textinputComponent.create()); @@ -378,7 +378,7 @@ void tst_qdeclarativetextinput::selection() void tst_qdeclarativetextinput::maxLength() { - //QString componentStr = "import Qt 4.6\nTextInput { maximumLength: 10; }"; + //QString componentStr = "import Qt 4.7\nTextInput { maximumLength: 10; }"; QDeclarativeView *canvas = createView(SRCDIR "/data/maxLength.qml"); canvas->show(); canvas->setFocus(); @@ -408,7 +408,7 @@ void tst_qdeclarativetextinput::maxLength() void tst_qdeclarativetextinput::masks() { //Not a comprehensive test of the possible masks, that's done elsewhere (QLineEdit) - //QString componentStr = "import Qt 4.6\nTextInput { inputMask: 'HHHHhhhh'; }"; + //QString componentStr = "import Qt 4.7\nTextInput { inputMask: 'HHHHhhhh'; }"; QDeclarativeView *canvas = createView(SRCDIR "/data/masks.qml"); canvas->show(); canvas->setFocus(); diff --git a/tests/auto/declarative/qdeclarativetimer/tst_qdeclarativetimer.cpp b/tests/auto/declarative/qdeclarativetimer/tst_qdeclarativetimer.cpp index 1dfec50..a08a91c 100644 --- a/tests/auto/declarative/qdeclarativetimer/tst_qdeclarativetimer.cpp +++ b/tests/auto/declarative/qdeclarativetimer/tst_qdeclarativetimer.cpp @@ -93,7 +93,7 @@ void tst_qdeclarativetimer::notRepeating() { QDeclarativeEngine engine; QDeclarativeComponent component(&engine); - component.setData(QByteArray("import Qt 4.6\nTimer { interval: 100; running: true }"), QUrl::fromLocalFile("")); + component.setData(QByteArray("import Qt 4.7\nTimer { interval: 100; running: true }"), QUrl::fromLocalFile("")); QDeclarativeTimer *timer = qobject_cast(component.create()); QVERIFY(timer != 0); QVERIFY(timer->isRunning()); @@ -114,7 +114,7 @@ void tst_qdeclarativetimer::notRepeatingStart() { QDeclarativeEngine engine; QDeclarativeComponent component(&engine); - component.setData(QByteArray("import Qt 4.6\nTimer { interval: 100 }"), QUrl::fromLocalFile("")); + component.setData(QByteArray("import Qt 4.7\nTimer { interval: 100 }"), QUrl::fromLocalFile("")); QDeclarativeTimer *timer = qobject_cast(component.create()); QVERIFY(timer != 0); QVERIFY(!timer->isRunning()); @@ -139,7 +139,7 @@ void tst_qdeclarativetimer::repeat() { QDeclarativeEngine engine; QDeclarativeComponent component(&engine); - component.setData(QByteArray("import Qt 4.6\nTimer { interval: 100; repeat: true; running: true }"), QUrl::fromLocalFile("")); + component.setData(QByteArray("import Qt 4.7\nTimer { interval: 100; repeat: true; running: true }"), QUrl::fromLocalFile("")); QDeclarativeTimer *timer = qobject_cast(component.create()); QVERIFY(timer != 0); @@ -181,7 +181,7 @@ void tst_qdeclarativetimer::triggeredOnStart() { QDeclarativeEngine engine; QDeclarativeComponent component(&engine); - component.setData(QByteArray("import Qt 4.6\nTimer { interval: 100; running: true; triggeredOnStart: true }"), QUrl::fromLocalFile("")); + component.setData(QByteArray("import Qt 4.7\nTimer { interval: 100; running: true; triggeredOnStart: true }"), QUrl::fromLocalFile("")); QDeclarativeTimer *timer = qobject_cast(component.create()); QVERIFY(timer != 0); QVERIFY(timer->triggeredOnStart()); @@ -216,7 +216,7 @@ void tst_qdeclarativetimer::triggeredOnStartRepeat() { QDeclarativeEngine engine; QDeclarativeComponent component(&engine); - component.setData(QByteArray("import Qt 4.6\nTimer { interval: 100; running: true; triggeredOnStart: true; repeat: true }"), QUrl::fromLocalFile("")); + component.setData(QByteArray("import Qt 4.7\nTimer { interval: 100; running: true; triggeredOnStart: true; repeat: true }"), QUrl::fromLocalFile("")); QDeclarativeTimer *timer = qobject_cast(component.create()); QVERIFY(timer != 0); @@ -240,7 +240,7 @@ void tst_qdeclarativetimer::noTriggerIfNotRunning() QDeclarativeEngine engine; QDeclarativeComponent component(&engine); component.setData(QByteArray( - "import Qt 4.6\n" + "import Qt 4.7\n" "Item { property bool ok: true\n" "Timer { id: t1; interval: 100; repeat: true; running: true; onTriggered: if (!running) ok=false }" "Timer { interval: 10; running: true; onTriggered: t1.running=false }" @@ -258,7 +258,7 @@ void tst_qdeclarativetimer::changeDuration() { QDeclarativeEngine engine; QDeclarativeComponent component(&engine); - component.setData(QByteArray("import Qt 4.6\nTimer { interval: 200; repeat: true; running: true }"), QUrl::fromLocalFile("")); + component.setData(QByteArray("import Qt 4.7\nTimer { interval: 200; repeat: true; running: true }"), QUrl::fromLocalFile("")); QDeclarativeTimer *timer = qobject_cast(component.create()); QVERIFY(timer != 0); @@ -294,7 +294,7 @@ void tst_qdeclarativetimer::restart() { QDeclarativeEngine engine; QDeclarativeComponent component(&engine); - component.setData(QByteArray("import Qt 4.6\nTimer { interval: 500; repeat: true; running: true }"), QUrl::fromLocalFile("")); + component.setData(QByteArray("import Qt 4.7\nTimer { interval: 500; repeat: true; running: true }"), QUrl::fromLocalFile("")); QDeclarativeTimer *timer = qobject_cast(component.create()); QVERIFY(timer != 0); diff --git a/tests/auto/declarative/qdeclarativewebview/tst_qdeclarativewebview.cpp b/tests/auto/declarative/qdeclarativewebview/tst_qdeclarativewebview.cpp index ce389f3..beabf86 100644 --- a/tests/auto/declarative/qdeclarativewebview/tst_qdeclarativewebview.cpp +++ b/tests/auto/declarative/qdeclarativewebview/tst_qdeclarativewebview.cpp @@ -453,7 +453,7 @@ void tst_qdeclarativewebview::newWindowComponent() QTRY_COMPARE(wv->property("progress").toDouble(), 1.0); QDeclarativeComponent substituteComponent(&engine); - substituteComponent.setData("import Qt 4.6; WebView { objectName: 'newWebView'; url: 'basic.html'; }", QUrl::fromLocalFile("")); + substituteComponent.setData("import Qt 4.7; WebView { objectName: 'newWebView'; url: 'basic.html'; }", QUrl::fromLocalFile("")); QSignalSpy newWindowComponentSpy(wv, SIGNAL(newWindowComponentChanged())); wv->setProperty("newWindowComponent", QVariant::fromValue(&substituteComponent)); diff --git a/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp b/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp index fe2dac2..a1dae24 100644 --- a/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp +++ b/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp @@ -85,7 +85,7 @@ void tst_QDeclarativeWorkerScript::source() QUrl source = QUrl::fromLocalFile(SRCDIR "/data/worker.qml"); QDeclarativeComponent component(&m_engine); - component.setData("import Qt 4.6\nWorkerScript { source: '" + source.toString().toUtf8() + "'; }", QUrl()); + component.setData("import Qt 4.7\nWorkerScript { source: '" + source.toString().toUtf8() + "'; }", QUrl()); QDeclarativeWorkerScript *item = qobject_cast(component.create()); QVERIFY(item != 0); diff --git a/tests/auto/declarative/sql/tst_sql.cpp b/tests/auto/declarative/sql/tst_sql.cpp index 1bab2d2..c8b8dc3 100644 --- a/tests/auto/declarative/sql/tst_sql.cpp +++ b/tests/auto/declarative/sql/tst_sql.cpp @@ -196,7 +196,7 @@ void tst_sql::testQml() QFETCH(QString, jsfile); QString qml= - "import Qt 4.6\n" + "import Qt 4.7\n" "import \""+jsfile+"\" as JS\n" "Text { text: JS.test() }"; -- cgit v0.12 From e36c3f700280ecca2d6333987897a3377772d385 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Wed, 14 Apr 2010 14:28:32 +1000 Subject: Doc: more mention of using QUrl::fromLocalFile() for URLs on local filesystem --- src/declarative/qml/qdeclarativecomponent.cpp | 6 ++++++ src/declarative/util/qdeclarativeview.cpp | 8 +++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/declarative/qml/qdeclarativecomponent.cpp b/src/declarative/qml/qdeclarativecomponent.cpp index e180374..d319e8f 100644 --- a/src/declarative/qml/qdeclarativecomponent.cpp +++ b/src/declarative/qml/qdeclarativecomponent.cpp @@ -320,6 +320,9 @@ QDeclarativeComponent::QDeclarativeComponent(QDeclarativeEngine *engine, QObject Create a QDeclarativeComponent from the given \a url and give it the specified \a parent and \a engine. + Ensure that the URL provided is full and correct, in particular, use + \l QUrl::fromLocalFile() when loading a file from the local filesystem. + \sa loadUrl() */ QDeclarativeComponent::QDeclarativeComponent(QDeclarativeEngine *engine, const QUrl &url, QObject *parent) @@ -409,6 +412,9 @@ QDeclarativeContext *QDeclarativeComponent::creationContext() const /*! Load the QDeclarativeComponent from the provided \a url. + + Ensure that the URL provided is full and correct, in particular, use + \l QUrl::fromLocalFile() when loading a file from the local filesystem. */ void QDeclarativeComponent::loadUrl(const QUrl &url) { diff --git a/src/declarative/util/qdeclarativeview.cpp b/src/declarative/util/qdeclarativeview.cpp index 22a7873..c0425ef 100644 --- a/src/declarative/util/qdeclarativeview.cpp +++ b/src/declarative/util/qdeclarativeview.cpp @@ -204,7 +204,7 @@ void QDeclarativeViewPrivate::execute() QDeclarativeView *view = new QDeclarativeView(this); vbox->addWidget(view); - QUrl url(fileName); + QUrl url = QUrl::fromLocalFile(fileName); view->setSource(url); view->show(); \endcode @@ -279,11 +279,17 @@ QDeclarativeView::~QDeclarativeView() \brief The URL of the source of the QML component. Changing this property causes the QML component to be reloaded. + + Ensure that the URL provided is full and correct, in particular, use + \l QUrl::fromLocalFile() when loading a file from the local filesystem. */ /*! Sets the source to the \a url, loads the QML component and instantiates it. + Ensure that the URL provided is full and correct, in particular, use + \l QUrl::fromLocalFile() when loading a file from the local filesystem. + Calling this methods multiple times with the same url will result in the QML being reloaded. */ -- cgit v0.12 From b0960cace004220eb79edc61eefa83e8f1ec12da Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Wed, 14 Apr 2010 14:30:36 +1000 Subject: Further improve failure output Now prints all the failures, not just the first. --- tests/auto/declarative/examples/tst_examples.cpp | 64 +++--------------------- 1 file changed, 7 insertions(+), 57 deletions(-) diff --git a/tests/auto/declarative/examples/tst_examples.cpp b/tests/auto/declarative/examples/tst_examples.cpp index ee8111e..91d2459 100644 --- a/tests/auto/declarative/examples/tst_examples.cpp +++ b/tests/auto/declarative/examples/tst_examples.cpp @@ -43,13 +43,8 @@ #include #include #include - -#define CONCURRENT - -#ifdef CONCURRENT #include #include -#endif class tst_examples : public QObject { @@ -58,9 +53,6 @@ public: tst_examples(); private slots: -#ifndef CONCURRENT - void examples_data(); -#endif void examples(); void namingConvention(); @@ -187,30 +179,6 @@ that they start and exit cleanly. Examples are any .qml files under the examples/ or demos/ directory that start with a lower case letter. */ -#ifndef CONCURRENT -void tst_examples::examples_data() -{ - QTest::addColumn("file"); - - QString examples = QLatin1String(SRCDIR) + "/../../../../demos/declarative/"; - QString demos = QLatin1String(SRCDIR) + "/../../../../examples/declarative/"; - QString snippets = QLatin1String(SRCDIR) + "/../../../../doc/src/snippets/"; - - qWarning() << examples << demos << snippets; - - QStringList files; - files << findQmlFiles(QDir(examples)); - files << findQmlFiles(QDir(demos)); - files << findQmlFiles(QDir(snippets)); - - qWarning() << files; - - foreach (const QString &file, files) - QTest::newRow(file.toLatin1().constData()) << file; -} -#endif - -#ifdef CONCURRENT #define THREADS 5 struct Example { @@ -259,10 +227,8 @@ void Example::run() } } -#endif void tst_examples::examples() { -#ifdef CONCURRENT QThreadPool::globalInstance()->setMaxThreadCount(5); QString examples = QLatin1String(SRCDIR) + "/../../../../demos/declarative/"; @@ -293,35 +259,19 @@ void tst_examples::examples() sync.waitForFinished(); + QStringList failures; for (int ii = 0; ii < tests.count(); ++ii) { if (tests.at(ii).result != Example::Pass) - QFAIL(qPrintable(tests.at(ii).file)); + failures << QDir::cleanPath(tests.at(ii).file); } -#else - - QFETCH(QString, file); + if (failures.count()) { + QString error("Failed examples: "); + error += failures.join(", "); - QFileInfo fi(file); - QFileInfo dir(fi.path()); - QString script = SRCDIR "/data/"+dir.baseName()+"/"+fi.baseName(); - QFileInfo testdata(script+".qml"); - QStringList arguments; - arguments << "-script" << (testdata.exists() ? script : QLatin1String(SRCDIR "/data/dummytest")) - << "-scriptopts" << "play,testerror,exitoncomplete,exitonfailure" - << file; -#ifdef Q_WS_QWS - arguments << "-qws"; -#endif + QFAIL(qPrintable(error)); + } - QProcess p; - p.start(qmlruntime, arguments); - QVERIFY(p.waitForFinished()); - if (p.exitStatus() != QProcess::NormalExit || p.exitCode() != 0) - qWarning() << p.readAllStandardOutput() << p.readAllStandardError(); - QCOMPARE(p.exitStatus(), QProcess::NormalExit); - QCOMPARE(p.exitCode(), 0); -#endif } QTEST_MAIN(tst_examples) -- cgit v0.12 From f04560cb0879a91b52a15afe42a40ab6499f6997 Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Wed, 14 Apr 2010 14:38:11 +1000 Subject: Fix qdeclarativedom test --- .../qdeclarativedom/tst_qdeclarativedom.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp b/tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp index 36a15fa..1f0c47c 100644 --- a/tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp +++ b/tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp @@ -94,7 +94,7 @@ void tst_qdeclarativedom::loadSimple() QVERIFY(!rootObject.isCustomType()); QVERIFY(rootObject.objectType() == "Qt/Item"); QVERIFY(rootObject.objectTypeMajorVersion() == 4); - QVERIFY(rootObject.objectTypeMinorVersion() == 6); + QVERIFY(rootObject.objectTypeMinorVersion() == 7); } // Test regular properties @@ -291,7 +291,7 @@ void tst_qdeclarativedom::testValueSource() QVERIFY(valueSourceObject.isValid()); QVERIFY(valueSourceObject.objectType() == "Qt/SpringFollow"); - + const QDeclarativeDomValue springValue = valueSourceObject.property("spring").value(); QVERIFY(!springValue.isInvalid()); QVERIFY(springValue.isLiteral()); @@ -350,7 +350,7 @@ void tst_qdeclarativedom::loadImports() QCOMPARE(import.type(), QDeclarativeDomImport::Library); QCOMPARE(import.uri(), QLatin1String("Qt")); QCOMPARE(import.qualifier(), QString()); - QCOMPARE(import.version(), QLatin1String("4.6")); + QCOMPARE(import.version(), QLatin1String("4.7")); import = document.imports().at(1); QCOMPARE(import.type(), QDeclarativeDomImport::Library); @@ -415,7 +415,7 @@ void tst_qdeclarativedom::loadSyntaxErrors() QCOMPARE(error.description(), QString("Syntax error")); } -// Test attempting to load a file with remote references +// Test attempting to load a file with remote references void tst_qdeclarativedom::loadRemoteErrors() { QByteArray qml = "import Qt 4.7\n" @@ -502,7 +502,7 @@ void tst_qdeclarativedom::loadDynamicProperty() QVERIFY(rootObject.isValid()); QCOMPARE(rootObject.dynamicProperties().count(), 3); - + { QDeclarativeDomDynamicProperty d = rootObject.dynamicProperties().at(0); QVERIFY(d.isDefaultProperty() == false); @@ -563,7 +563,7 @@ void tst_qdeclarativedom::loadComponent() QVERIFY(component.isValid()); QVERIFY(component.objectType() == "Qt/Component"); QVERIFY(component.objectTypeMajorVersion() == 4); - QVERIFY(component.objectTypeMinorVersion() == 6); + QVERIFY(component.objectTypeMinorVersion() == 7); QVERIFY(component.objectClassName() == "Component"); QVERIFY(component.objectId() == "myComponent"); QVERIFY(component.properties().isEmpty()); @@ -760,7 +760,7 @@ void tst_qdeclarativedom::object_property() QVERIFY(y.value().toLiteral().literal() == "12"); QCOMPARE(y.position(), 35); QCOMPARE(y.length(), 1); - + QDeclarativeDomProperty data = rootObject.property("data"); QVERIFY(data.isValid()); QVERIFY(data.propertyName() == "data"); @@ -782,7 +782,7 @@ void tst_qdeclarativedom::object_url() QCOMPARE(object.url(), QUrl()); } - // Valid builtin object + // Valid builtin object { QByteArray qml = "import Qt 4.7\n" "Item {}"; @@ -1029,7 +1029,7 @@ void tst_qdeclarativedom::copy() QDeclarativeDomObject object = document.rootObject(); QDeclarativeDomProperty property = object.property("data"); QCOMPARE(property.value().toList().values().count(), 1); - QDeclarativeDomComponent component = + QDeclarativeDomComponent component = property.value().toList().values().at(0).toObject().toComponent(); QCOMPARE(component.componentRoot().objectClassName(), QByteArray("Item")); -- cgit v0.12 From 6d4769d09400dbefe3dc05b1b3a214dfecdd737a Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Wed, 14 Apr 2010 14:57:37 +1000 Subject: Temporarily disable tests that require compilation --- tests/auto/declarative/examples/tst_examples.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/auto/declarative/examples/tst_examples.cpp b/tests/auto/declarative/examples/tst_examples.cpp index 91d2459..e62aad2 100644 --- a/tests/auto/declarative/examples/tst_examples.cpp +++ b/tests/auto/declarative/examples/tst_examples.cpp @@ -83,6 +83,9 @@ tst_examples::tst_examples() excludedDirs << "examples/declarative/proxywidgets"; excludedDirs << "examples/declarative/gestures"; + excludedDirs << "examples/declarative/imageprovider"; + excludedDirs << "demos/declarative/minehunt"; + #ifdef QT_NO_WEBKIT excludedDirs << "examples/declarative/webview"; excludedDirs << "demos/declarative/webbrowser"; -- cgit v0.12 From ffd45093795e9481505af0ae9bf5df7b6c704c72 Mon Sep 17 00:00:00 2001 From: Leonardo Sobral Cunha Date: Tue, 13 Apr 2010 17:01:54 +1000 Subject: Add 'runtime' property to the rootContext of DeclarativeViewer The 'runtime' property is a singleton object that contains various info about the execution environment for the qml application. Currently it contains just one property 'isActiveWindow', which tells if the window of the declarative viewer is active or not. Task-number: QTBUG-8902 Reviewed-by: Martin Jones --- tools/qml/qmlruntime.cpp | 44 ++++++++++++++++++++++++++++++++++++++++++++ tools/qml/qmlruntime.h | 1 + 2 files changed, 45 insertions(+) diff --git a/tools/qml/qmlruntime.cpp b/tools/qml/qmlruntime.cpp index c4ebd80..40de100 100644 --- a/tools/qml/qmlruntime.cpp +++ b/tools/qml/qmlruntime.cpp @@ -134,6 +134,38 @@ signals: void orientationChanged(); }; +class Runtime : public QObject +{ + Q_OBJECT + Q_PROPERTY(bool isActiveWindow READ isActiveWindow NOTIFY isActiveWindowChanged) + +public: + static Runtime* instance() + { + static Runtime *instance = 0; + if (!instance) + instance = new Runtime; + return instance; + } + + bool isActiveWindow() const { return activeWindow; } + void setActiveWindow(bool active) + { + if (active == activeWindow) + return; + activeWindow = active; + emit isActiveWindowChanged(); + } + +signals: + void isActiveWindowChanged(); + +private: + Runtime(QObject *parent=0) : QObject(parent), activeWindow(false) {} + + bool activeWindow; +}; + QT_END_NAMESPACE QML_DECLARE_TYPE(Screen) @@ -1048,6 +1080,8 @@ void QDeclarativeViewer::openQml(const QString& file_or_url) ctxt->setContextProperty("qmlViewerFolder", QDir::currentPath()); #endif + ctxt->setContextProperty("runtime", Runtime::instance()); + QString fileName = url.toLocalFile(); if (!fileName.isEmpty()) { QFileInfo fi(fileName); @@ -1249,6 +1283,16 @@ void QDeclarativeViewer::keyPressEvent(QKeyEvent *event) QWidget::keyPressEvent(event); } +bool QDeclarativeViewer::event(QEvent *event) +{ + if (event->type() == QEvent::WindowActivate) { + Runtime::instance()->setActiveWindow(true); + } else if (event->type() == QEvent::WindowDeactivate) { + Runtime::instance()->setActiveWindow(false); + } + return QWidget::event(event); +} + void QDeclarativeViewer::senseImageMagick() { QProcess proc; diff --git a/tools/qml/qmlruntime.h b/tools/qml/qmlruntime.h index b934a70..1ae771a 100644 --- a/tools/qml/qmlruntime.h +++ b/tools/qml/qmlruntime.h @@ -126,6 +126,7 @@ public slots: protected: virtual void keyPressEvent(QKeyEvent *); + virtual bool event(QEvent *); void createMenu(QMenuBar *menu, QMenu *flatmenu); -- cgit v0.12 From 063a2d45de349b4bc9c7bb23197392a92159ddc9 Mon Sep 17 00:00:00 2001 From: Leonardo Sobral Cunha Date: Tue, 13 Apr 2010 17:42:17 +1000 Subject: Merged 'orientation' into 'runtime' context property in qmlruntime Removed the 'Screen' element from DeclarativeViewer, as it was used only for the orientation property. Now access the 'orientation' property like this: 'runtime.orientation' and the enum is accessed as 'Orientation.Landscape', when using the qmlruntime. Updated docs for qmlruntime. Reviewed-by: Martin Jones --- doc/src/declarative/qmlruntime.qdoc | 46 +++++++++++++++++++++++++++++-------- tools/qml/deviceorientation.h | 1 + tools/qml/qmlruntime.cpp | 45 +++++++++++------------------------- 3 files changed, 51 insertions(+), 41 deletions(-) diff --git a/doc/src/declarative/qmlruntime.qdoc b/doc/src/declarative/qmlruntime.qdoc index 8bb3ec7..fbe82c6 100644 --- a/doc/src/declarative/qmlruntime.qdoc +++ b/doc/src/declarative/qmlruntime.qdoc @@ -70,7 +70,7 @@ \code qml myQmlFile.qml \endcode - + Deploying a QML application via the \c qml executable allows for QML only deployments, but can also include custom C++ modules just as easily. Below is an example of how you might structure a complex application deployed via the qml runtime, it is a listing of the files that would @@ -101,7 +101,7 @@ import "MyAppCore" import "OtherModule" 1.0 as Other \endcode - + \section1 \c qml application functionality The \c qml application implements some additional functionality to help it serve the role of a launcher for myriad applications. If you implement your own launcher application, you may also wish to reimplement @@ -134,23 +134,25 @@ Any QML can be used in the dummy data files. You could even animate the fictional data! - \section2 Screen Orientation + \section2 Runtime Object + + All applications using the qmlruntime will have access to the 'runtime' + property on the root context. This property contains several information + about the runtime environment of the application. + + \section3 Screen Orientation A special piece of dummy data which is integrated into the runtime is a simple orientation property. The orientation can be set via the settings menu in the application, or by pressing Ctrl+T to toggle it. - To use this from within your QML file, import QDeclarativeViewer 1.0 and create a - Screen object. This object has a property, orientation, which can be either - Screen.Landscape or Screen.Portrait and which can be bound to in your + To use this from within your QML file, access runtime.orientation, + which can be either Orientation.Landscape or Orientation.Portrait and which can be bound to in your application. An example is below: \code - import QDeclarativeViewer 1.0 as QDeclarativeViewer - Item { - QDeclarativeViewer.Screen { id: screen } - state: (screen.orientation == QDeclarativeViewer.Screen.Landscape) ? 'landscape' : '' + state: (runtime.orientation == Orientation.Landscape) ? 'landscape' : '' } \endcode @@ -158,4 +160,28 @@ will automatically update this on some platforms (currently the N900 only) to match the physical screen's orientation. On other plaforms orientation changes will only happen when explictly asked for. + \section3 Window Active + + The runtime.isActiveWindow property tells whether the main window of the qml runtime is currently active + or not. This is specially useful for embedded devices when you want to pause parts of your application, + including animations, when your application looses focus or goes to the background. + + The example below, stops the animation when the application's window is deactivated and resumes on activation: + +\code + Item { + width: 300; height: 200 + Rectangle { + width: 100; height: 100 + color: "green" + SequentialAnimation on x { + running: runtime.isActiveWindow + loops: Animation.Infinite + NumberAnimation {to: 200} + NumberAnimation {to: 0} + } + } + } +\endcode + */ diff --git a/tools/qml/deviceorientation.h b/tools/qml/deviceorientation.h index c8125cd..d209005 100644 --- a/tools/qml/deviceorientation.h +++ b/tools/qml/deviceorientation.h @@ -50,6 +50,7 @@ class DeviceOrientationPrivate; class DeviceOrientation : public QObject { Q_OBJECT + Q_ENUMS(Orientation) public: enum Orientation { UnknownOrientation, Portrait, Landscape }; virtual Orientation orientation() const = 0; diff --git a/tools/qml/qmlruntime.cpp b/tools/qml/qmlruntime.cpp index 40de100..df29294 100644 --- a/tools/qml/qmlruntime.cpp +++ b/tools/qml/qmlruntime.cpp @@ -112,32 +112,12 @@ QT_BEGIN_NAMESPACE -class Screen : public QObject -{ - Q_OBJECT - - Q_PROPERTY(Orientation orientation READ orientation NOTIFY orientationChanged) - Q_ENUMS(Orientation) - -public: - Screen(QObject *parent=0) : QObject(parent) { - connect(DeviceOrientation::instance(), SIGNAL(orientationChanged()), - this, SIGNAL(orientationChanged())); - } - - enum Orientation { UnknownOrientation = DeviceOrientation::UnknownOrientation, - Portrait = DeviceOrientation::Portrait, - Landscape = DeviceOrientation::Landscape }; - Orientation orientation() const { return Orientation(DeviceOrientation::instance()->orientation()); } - -signals: - void orientationChanged(); -}; - class Runtime : public QObject { Q_OBJECT + Q_PROPERTY(bool isActiveWindow READ isActiveWindow NOTIFY isActiveWindowChanged) + Q_PROPERTY(DeviceOrientation::Orientation orientation READ orientation NOTIFY orientationChanged) public: static Runtime* instance() @@ -157,20 +137,22 @@ public: emit isActiveWindowChanged(); } -signals: + DeviceOrientation::Orientation orientation() const { return DeviceOrientation::instance()->orientation(); } + +Q_SIGNALS: void isActiveWindowChanged(); + void orientationChanged(); private: - Runtime(QObject *parent=0) : QObject(parent), activeWindow(false) {} + Runtime(QObject *parent=0) : QObject(parent), activeWindow(false) + { + connect(DeviceOrientation::instance(), SIGNAL(orientationChanged()), + this, SIGNAL(orientationChanged())); + } bool activeWindow; }; -QT_END_NAMESPACE - -QML_DECLARE_TYPE(Screen) - -QT_BEGIN_NAMESPACE class SizedMenuBar : public QMenuBar { @@ -1067,7 +1049,7 @@ void QDeclarativeViewer::openQml(const QString& file_or_url) url = QUrl(file_or_url); setWindowTitle(tr("%1 - Qt Declarative UI Viewer").arg(file_or_url)); - if (!m_script.isEmpty()) + if (!m_script.isEmpty()) tester = new QDeclarativeTester(m_script, m_scriptOptions, canvas); delete canvas->rootObject(); @@ -1518,7 +1500,8 @@ void QDeclarativeViewer::setUseNativeFileBrowser(bool use) void QDeclarativeViewer::registerTypes() { - qmlRegisterType("QDeclarativeViewer", 1, 0, "Screen"); + // registering only for exposing the DeviceOrientation::Orientation enum + qmlRegisterUncreatableType("Qt",4,6,"Orientation"); } QT_END_NAMESPACE -- cgit v0.12 From e81bccceb3a5fb5a8e5611260b9bc3d5a305b5de Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Wed, 14 Apr 2010 15:12:01 +1000 Subject: Include qvariant.h as a convenience as context properties are commonly set and accessed --- src/declarative/qml/qdeclarativecontext.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/declarative/qml/qdeclarativecontext.h b/src/declarative/qml/qdeclarativecontext.h index a349628..11b4771 100644 --- a/src/declarative/qml/qdeclarativecontext.h +++ b/src/declarative/qml/qdeclarativecontext.h @@ -46,6 +46,7 @@ #include #include #include +#include QT_BEGIN_HEADER -- cgit v0.12 From 7d899f390329d9f9241d446d14ce999bed89b56a Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Wed, 14 Apr 2010 15:12:35 +1000 Subject: Move example code into separate files to make sure they compile and work standalone --- doc/src/declarative/qtbinding.qdoc | 198 ++++----------------- .../contextproperties/contextproperties.pro | 2 + .../snippets/qtbinding/contextproperties/main.cpp | 79 ++++++++ .../snippets/qtbinding/contextproperties/main.qml | 15 ++ .../qtbinding/custompalette/custompalette.h | 80 +++++++++ .../qtbinding/custompalette/custompalette.pro | 3 + .../snippets/qtbinding/custompalette/main.cpp | 62 +++++++ .../snippets/qtbinding/custompalette/main.qml | 22 +++ .../snippets/qtbinding/resources/example.qrc | 10 ++ .../qtbinding/resources/images/background.png | 0 .../snippets/qtbinding/resources/main.cpp | 58 ++++++ .../snippets/qtbinding/resources/main.qml | 7 + .../snippets/qtbinding/resources/resources.pro | 4 + .../snippets/qtbinding/stopwatch/main.cpp | 63 +++++++ .../snippets/qtbinding/stopwatch/main.qml | 18 ++ .../snippets/qtbinding/stopwatch/stopwatch.cpp | 63 +++++++ .../snippets/qtbinding/stopwatch/stopwatch.h | 62 +++++++ .../snippets/qtbinding/stopwatch/stopwatch.pro | 3 + 18 files changed, 586 insertions(+), 163 deletions(-) create mode 100644 doc/src/declarative/snippets/qtbinding/contextproperties/contextproperties.pro create mode 100644 doc/src/declarative/snippets/qtbinding/contextproperties/main.cpp create mode 100644 doc/src/declarative/snippets/qtbinding/contextproperties/main.qml create mode 100644 doc/src/declarative/snippets/qtbinding/custompalette/custompalette.h create mode 100644 doc/src/declarative/snippets/qtbinding/custompalette/custompalette.pro create mode 100644 doc/src/declarative/snippets/qtbinding/custompalette/main.cpp create mode 100644 doc/src/declarative/snippets/qtbinding/custompalette/main.qml create mode 100644 doc/src/declarative/snippets/qtbinding/resources/example.qrc create mode 100644 doc/src/declarative/snippets/qtbinding/resources/images/background.png create mode 100644 doc/src/declarative/snippets/qtbinding/resources/main.cpp create mode 100644 doc/src/declarative/snippets/qtbinding/resources/main.qml create mode 100644 doc/src/declarative/snippets/qtbinding/resources/resources.pro create mode 100644 doc/src/declarative/snippets/qtbinding/stopwatch/main.cpp create mode 100644 doc/src/declarative/snippets/qtbinding/stopwatch/main.qml create mode 100644 doc/src/declarative/snippets/qtbinding/stopwatch/stopwatch.cpp create mode 100644 doc/src/declarative/snippets/qtbinding/stopwatch/stopwatch.h create mode 100644 doc/src/declarative/snippets/qtbinding/stopwatch/stopwatch.pro diff --git a/doc/src/declarative/qtbinding.qdoc b/doc/src/declarative/qtbinding.qdoc index fa0d13c..d024ff2 100644 --- a/doc/src/declarative/qtbinding.qdoc +++ b/doc/src/declarative/qtbinding.qdoc @@ -73,9 +73,9 @@ QML component instances can then be created by calling the QDeclarativeComponent an example of loading a QML document, and creating an object from it. \code -QDeclarativeEngine *engine = new QDeclarativeEngine(parent); -QDeclarativeComponent component(engine, QUrl::fromLocalFile("main.qml")); -QObject *myObject = component.create(); + QDeclarativeEngine *engine = new QDeclarativeEngine(parent); + QDeclarativeComponent component(engine, QUrl::fromLocalFile("main.qml")); + QObject *myObject = component.create(); \endcode \section1 Exposing Data @@ -91,40 +91,28 @@ the root context is available to all object instances. To expose data to a QML component instance, applications set \l {QDeclarativeContext::setContextProperty()} {context properties} which are then accessible by name from QML \l {Property Binding}s and JavaScript. -The following example shows how to expose a background color to a QML file. +The following example shows how to expose a background color to a QML file through QDeclarativeView: \table \row \o -\code -// main.cpp -QDeclarativeContext *windowContext = new QDeclarativeContext(engine->rootContext()); -windowContext->setContextProperty("backgroundColor", - QColor(Qt::lightsteelblue)); +\c {// main.cpp} +\snippet doc/src/declarative/snippets/qtbinding/contextproperties/main.cpp 0 -QDeclarativeComponent component(&engine, "main.qml"); -QObject *window = component.create(windowContext); -\endcode \o -\code -// main.qml -import Qt 4.7 +\c {// main.qml} +\snippet doc/src/declarative/snippets/qtbinding/contextproperties/main.qml 0 -Rectangle { - color: backgroundColor - - Text { - anchors.centerIn: parent - text: "Hello Light Steel Blue World!" - } -} -\endcode \endtable +Or, if you want \c main.cpp to create the component without showing it in a QDeclarativeView, you could create an instance of QDeclarativeContext using QDeclarativeEngine::rootContext() instead: + +\snippet doc/src/declarative/snippets/qtbinding/contextproperties/main.cpp 1 + Context properties work just like normal properties in QML bindings - if the \c backgroundColor -context property in the previous example was changed to red, the component object instances would +context property in this example was changed to red, the component object instances would all be automatically updated. Note that it is the responsibility of the creator to delete any -QDeclarativeContext it constructs. If the \c windowContext in the example above is no longer needed when +QDeclarativeContext it constructs. If the \c windowContext is no longer needed when the \c window component instantiation is destroyed, the \c windowContext must be destroyed explicitly. The simplest way to ensure this is to set \c window as \c windowContext's parent. @@ -147,78 +135,15 @@ allow QML to set values. The following example creates a \c CustomPalette object, and sets it as the \c palette context property. -\code -class CustomPalette : public QObject -{ -Q_OBJECT -Q_PROPERTY(QColor background READ background WRITE setBackground NOTIFY backgroundChanged) -Q_PROPERTY(QColor text READ text WRITE setText NOTIFY textChanged) -public: - CustomPalette() : m_background(Qt::white), m_text(Qt::black) {} - - QColor background() const { return m_background; } - void setBackground(const QColor &c) { - if (c != m_background) { - m_background = c; - emit backgroundChanged(); - } - } - - QColor text() const { return m_text; } - void setText(const QColor &c) { - if (c != m_text) { - m_text = c; - emit textChanged(); - } - } -signals: - void textChanged(); - void backgroundChanged(): - -private: - QColor m_background; - QColor m_text; -}; +\snippet doc/src/declarative/snippets/qtbinding/custompalette/custompalette.h 0 -int main(int argc, char **argv) -{ - // ... - - QDeclarativeContext *windowContext = new QDeclarativeContext(engine->rootContext()); - windowContext->setContextProperty("palette", new CustomPalette); - - QDeclarativeComponent component(&engine, "main.qml"); - QObject *window = component.create(windowContext); -} -\endcode +\snippet doc/src/declarative/snippets/qtbinding/custompalette/main.cpp 0 The QML that follows references the palette object, and its properties, to set the appropriate background and text colors. When the window is clicked, the palette's text color is changed, and the window text will update accordingly. -\code -// main.qml -import Qt 4.7 - -Rectangle { - width: 240 - height: 320 - color: palette.background - - Text { - anchors.centerIn: parent - color: palette.text - text: "Hello Colorful World!" - } - - MouseArea { - anchors.fill: parent - onClicked: { - palette.text = "blue"; - } - } -} -\endcode +\snippet doc/src/declarative/snippets/qtbinding/custompalette/main.qml 0 To detect when a C++ property value - in this case the \c CustomPalette's \c text property - changes, the property must have a corresponding NOTIFY signal. The NOTIFY signal specifies a signal @@ -254,57 +179,23 @@ the following types: \o QVariant \endlist -This example toggles the "LED Blinker" when the MouseArea is clicked: +This example toggles the "Stopwatch" object on/off when the MouseArea is clicked: \table \row \o -\code -// main.cpp -class LEDBlinker : public QObject -{ - Q_OBJECT -public: - LEDBlinker(); - - Q_INVOKABLE bool isRunning(); +\c {// main.cpp} +\snippet doc/src/declarative/snippets/qtbinding/stopwatch/stopwatch.h 0 +\snippet doc/src/declarative/snippets/qtbinding/stopwatch/main.cpp 0 -public slots: - void start(); - void stop(); -}; - -int main(int argc, char **argv) -{ - // ... - - QDeclarativeContext *context = engine->rootContext(); - context->setContextProperty("ledBlinker", new LEDBlinker); - - // ... -} -\endcode \o -\code -// main.qml -import Qt 4.7 +\c {// main.qml} +\snippet doc/src/declarative/snippets/qtbinding/stopwatch/main.qml 0 -Rectangle { - MouseArea { - anchors.fill: parent - onClicked: { - if (ledBlinker.isRunning()) - ledBlinker.stop() - else - ledBlicker.start(); - } - } -} -\endcode \endtable Note that in this particular example a better way to achieve the same result -is to have a "running" property. This leads to much nicer QML code: +is to have a "running" property in \c main.qml. This leads to much nicer QML code: \table \row @@ -316,13 +207,12 @@ import Qt 4.7 Rectangle { MouseArea { anchors.fill: parent - onClicked: ledBlinker.running = !ledBlinker.running + onClicked: stopwatch.running = !stopwatch.running } } \endcode \endtable - Of course, it is also possible to call \l {Adding new methods}{functions declared in QML from C++}. @@ -367,35 +257,17 @@ void MyApplication::continueLoading() QML content can be loaded from \l {The Qt Resource System} using the \e qrc: URL scheme. For example: -\code - - - main.qml - images/background.png - - -\endcode -\code -// main.cpp -MyApplication::MyApplication() -{ - // ... - component = new QDeclarativeComponent(engine, QUrl("qrc:/main.qml")); - if (component->isError()) { - qWarning() << component->errors(); - } else { - QObject *myObject = component->create(); - } -} -\endcode -\code -// main.qml -import Qt 4.7 +\c [project/example.qrc] +\quotefile doc/src/declarative/snippets/qtbinding/resources/example.qrc -Image { - source: "images/background.png" -} -\endcode +\c [project/project.pro] +\quotefile doc/src/declarative/snippets/qtbinding/resources/resources.pro + +\c [project/main.cpp] +\snippet doc/src/declarative/snippets/qtbinding/resources/main.cpp 0 + +\c [project/main.qml] +\snippet doc/src/declarative/snippets/qtbinding/resources/main.qml 0 */ diff --git a/doc/src/declarative/snippets/qtbinding/contextproperties/contextproperties.pro b/doc/src/declarative/snippets/qtbinding/contextproperties/contextproperties.pro new file mode 100644 index 0000000..68eeaf2 --- /dev/null +++ b/doc/src/declarative/snippets/qtbinding/contextproperties/contextproperties.pro @@ -0,0 +1,2 @@ +QT += declarative +SOURCES += main.cpp diff --git a/doc/src/declarative/snippets/qtbinding/contextproperties/main.cpp b/doc/src/declarative/snippets/qtbinding/contextproperties/main.cpp new file mode 100644 index 0000000..15e3d4c --- /dev/null +++ b/doc/src/declarative/snippets/qtbinding/contextproperties/main.cpp @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include + +//![0] +#include +#include +#include + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + QDeclarativeView view; + QDeclarativeContext *context = view.rootContext(); + context->setContextProperty("backgroundColor", + QColor(Qt::yellow)); + + view.setSource(QUrl("main.qml")); + view.show(); + + return app.exec(); +} +//![0] + +static void alternative() +{ + // Alternatively, if we don't actually want to display main.qml: +//![1] + QDeclarativeEngine engine; + QDeclarativeContext *windowContext = new QDeclarativeContext(engine.rootContext()); + windowContext->setContextProperty("backgroundColor", QColor(Qt::yellow)); + + QDeclarativeComponent component(&engine, "main.qml"); + QObject *window = component.create(windowContext); +//![1] +} + + diff --git a/doc/src/declarative/snippets/qtbinding/contextproperties/main.qml b/doc/src/declarative/snippets/qtbinding/contextproperties/main.qml new file mode 100644 index 0000000..1053f73 --- /dev/null +++ b/doc/src/declarative/snippets/qtbinding/contextproperties/main.qml @@ -0,0 +1,15 @@ +//![0] +import Qt 4.7 + +Rectangle { + width: 300 + height: 300 + + color: backgroundColor + + Text { + anchors.centerIn: parent + text: "Hello Yellow World!" + } +} +//![0] diff --git a/doc/src/declarative/snippets/qtbinding/custompalette/custompalette.h b/doc/src/declarative/snippets/qtbinding/custompalette/custompalette.h new file mode 100644 index 0000000..d0d253a --- /dev/null +++ b/doc/src/declarative/snippets/qtbinding/custompalette/custompalette.h @@ -0,0 +1,80 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include + +//![0] +class CustomPalette : public QObject +{ + Q_OBJECT + Q_PROPERTY(QColor background READ background WRITE setBackground NOTIFY backgroundChanged) + Q_PROPERTY(QColor text READ text WRITE setText NOTIFY textChanged) + +public: + CustomPalette() : m_background(Qt::white), m_text(Qt::black) {} + + QColor background() const { return m_background; } + void setBackground(const QColor &c) { + if (c != m_background) { + m_background = c; + emit backgroundChanged(); + } + } + + QColor text() const { return m_text; } + void setText(const QColor &c) { + if (c != m_text) { + m_text = c; + emit textChanged(); + } + } + +signals: + void textChanged(); + void backgroundChanged(); + +private: + QColor m_background; + QColor m_text; +}; + +//![0] diff --git a/doc/src/declarative/snippets/qtbinding/custompalette/custompalette.pro b/doc/src/declarative/snippets/qtbinding/custompalette/custompalette.pro new file mode 100644 index 0000000..e6af0d0 --- /dev/null +++ b/doc/src/declarative/snippets/qtbinding/custompalette/custompalette.pro @@ -0,0 +1,3 @@ +QT += declarative +HEADERS += custompalette.h +SOURCES += main.cpp diff --git a/doc/src/declarative/snippets/qtbinding/custompalette/main.cpp b/doc/src/declarative/snippets/qtbinding/custompalette/main.cpp new file mode 100644 index 0000000..c723688 --- /dev/null +++ b/doc/src/declarative/snippets/qtbinding/custompalette/main.cpp @@ -0,0 +1,62 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include + +#include "custompalette.h" + +//![0] +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + QDeclarativeView view; + view.rootContext()->setContextProperty("palette", new CustomPalette); + + view.setSource(QUrl("main.qml")); + view.show(); + + return app.exec(); +} +//![0] + diff --git a/doc/src/declarative/snippets/qtbinding/custompalette/main.qml b/doc/src/declarative/snippets/qtbinding/custompalette/main.qml new file mode 100644 index 0000000..f1a3b4f --- /dev/null +++ b/doc/src/declarative/snippets/qtbinding/custompalette/main.qml @@ -0,0 +1,22 @@ +//![0] +import Qt 4.7 + +Rectangle { + width: 240 + height: 320 + color: palette.background + + Text { + anchors.centerIn: parent + color: palette.text + text: "Click me to change color!" + } + + MouseArea { + anchors.fill: parent + onClicked: { + palette.text = "blue"; + } + } +} +//![0] diff --git a/doc/src/declarative/snippets/qtbinding/resources/example.qrc b/doc/src/declarative/snippets/qtbinding/resources/example.qrc new file mode 100644 index 0000000..5e49415 --- /dev/null +++ b/doc/src/declarative/snippets/qtbinding/resources/example.qrc @@ -0,0 +1,10 @@ + + + + + main.qml + images/background.png + + + + diff --git a/doc/src/declarative/snippets/qtbinding/resources/images/background.png b/doc/src/declarative/snippets/qtbinding/resources/images/background.png new file mode 100644 index 0000000..e69de29 diff --git a/doc/src/declarative/snippets/qtbinding/resources/main.cpp b/doc/src/declarative/snippets/qtbinding/resources/main.cpp new file mode 100644 index 0000000..5459b9e --- /dev/null +++ b/doc/src/declarative/snippets/qtbinding/resources/main.cpp @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include + +//![0] +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + QDeclarativeView view; + view.setSource(QUrl("qrc:/main.qml")); + view.show(); + + return app.exec(); +} +//![0] + diff --git a/doc/src/declarative/snippets/qtbinding/resources/main.qml b/doc/src/declarative/snippets/qtbinding/resources/main.qml new file mode 100644 index 0000000..dfe923f --- /dev/null +++ b/doc/src/declarative/snippets/qtbinding/resources/main.qml @@ -0,0 +1,7 @@ +//![0] +import Qt 4.7 + +Image { + source: "images/background.png" +} +//![0] diff --git a/doc/src/declarative/snippets/qtbinding/resources/resources.pro b/doc/src/declarative/snippets/qtbinding/resources/resources.pro new file mode 100644 index 0000000..cc01ee1 --- /dev/null +++ b/doc/src/declarative/snippets/qtbinding/resources/resources.pro @@ -0,0 +1,4 @@ +QT += declarative + +SOURCES += main.cpp +RESOURCES += example.qrc diff --git a/doc/src/declarative/snippets/qtbinding/stopwatch/main.cpp b/doc/src/declarative/snippets/qtbinding/stopwatch/main.cpp new file mode 100644 index 0000000..13e3b9f --- /dev/null +++ b/doc/src/declarative/snippets/qtbinding/stopwatch/main.cpp @@ -0,0 +1,63 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "stopwatch.h" + +#include +#include +#include + +//![0] +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + QDeclarativeView view; + view.rootContext()->setContextProperty("stopwatch", + new Stopwatch); + + view.setSource(QUrl("main.qml")); + view.show(); + + return app.exec(); +} +//![0] + diff --git a/doc/src/declarative/snippets/qtbinding/stopwatch/main.qml b/doc/src/declarative/snippets/qtbinding/stopwatch/main.qml new file mode 100644 index 0000000..2efa542 --- /dev/null +++ b/doc/src/declarative/snippets/qtbinding/stopwatch/main.qml @@ -0,0 +1,18 @@ +//![0] +import Qt 4.7 + +Rectangle { + width: 300 + height: 300 + + MouseArea { + anchors.fill: parent + onClicked: { + if (stopwatch.isRunning()) + stopwatch.stop() + else + stopwatch.start(); + } + } +} +//![0] diff --git a/doc/src/declarative/snippets/qtbinding/stopwatch/stopwatch.cpp b/doc/src/declarative/snippets/qtbinding/stopwatch/stopwatch.cpp new file mode 100644 index 0000000..4954a5f --- /dev/null +++ b/doc/src/declarative/snippets/qtbinding/stopwatch/stopwatch.cpp @@ -0,0 +1,63 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "stopwatch.h" + +Stopwatch::Stopwatch() + : m_running(false) +{ +} + +bool Stopwatch::isRunning() const +{ + return m_running; +} + +void Stopwatch::start() +{ + m_running = true; +} + +void Stopwatch::stop() +{ + m_running = false; +} + diff --git a/doc/src/declarative/snippets/qtbinding/stopwatch/stopwatch.h b/doc/src/declarative/snippets/qtbinding/stopwatch/stopwatch.h new file mode 100644 index 0000000..8d17121 --- /dev/null +++ b/doc/src/declarative/snippets/qtbinding/stopwatch/stopwatch.h @@ -0,0 +1,62 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include + +//![0] +class Stopwatch : public QObject +{ + Q_OBJECT +public: + Stopwatch(); + + Q_INVOKABLE bool isRunning() const; + +public slots: + void start(); + void stop(); + +private: + bool m_running; +}; + +//![0] + diff --git a/doc/src/declarative/snippets/qtbinding/stopwatch/stopwatch.pro b/doc/src/declarative/snippets/qtbinding/stopwatch/stopwatch.pro new file mode 100644 index 0000000..d803e6a --- /dev/null +++ b/doc/src/declarative/snippets/qtbinding/stopwatch/stopwatch.pro @@ -0,0 +1,3 @@ +QT += declarative +HEADERS += stopwatch.h +SOURCES += main.cpp stopwatch.cpp -- cgit v0.12 From 51d60cba524a2866385504032c7cd881a6d2d331 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Wed, 14 Apr 2010 15:20:21 +1000 Subject: Update references links --- doc/src/declarative/declarativeui.qdoc | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/src/declarative/declarativeui.qdoc b/doc/src/declarative/declarativeui.qdoc index e84932b..a2a5283 100644 --- a/doc/src/declarative/declarativeui.qdoc +++ b/doc/src/declarative/declarativeui.qdoc @@ -103,6 +103,7 @@ completely new applications. QML is fully \l {Extending QML in C++}{extensible \o \l {QML Elements} \o \l {QML Global Object} \o \l {Extending QML in C++} +\o \l {Integrating QML with existing Qt UI code} \o \l {QML Internationalization} \o \l {QML Security} \o \l {QtDeclarative Module} -- cgit v0.12 From 2bacca7ed7fc2d2cd5c3bfdd2b6b93a840d84341 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Wed, 14 Apr 2010 15:39:18 +1000 Subject: Compiled bindings should not print warnings where normal bindings don't QTBUG-9813 --- src/declarative/qml/qdeclarativecompiledbindings.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/declarative/qml/qdeclarativecompiledbindings.cpp b/src/declarative/qml/qdeclarativecompiledbindings.cpp index 0c824fc..bbce8a6 100644 --- a/src/declarative/qml/qdeclarativecompiledbindings.cpp +++ b/src/declarative/qml/qdeclarativecompiledbindings.cpp @@ -285,10 +285,8 @@ void QDeclarativeCompiledBindingsPrivate::run(Binding *binding, QDeclarativeProp return; QDeclarativeContextData *context = q->QDeclarativeAbstractExpression::context(); - if (!context) { - qWarning("QDeclarativeCompiledBindings: Attempted to evaluate an expression in an invalid context"); + if (!context) return; - } if (!context->engine) return; -- cgit v0.12