From 32cdbb6de84eab0c3619d36f3091e68e93caf3e9 Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Mon, 1 Mar 2010 19:11:41 +1000 Subject: use ParentAnimation --- examples/declarative/package/Delegate.qml | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/examples/declarative/package/Delegate.qml b/examples/declarative/package/Delegate.qml index 4109633..62198d0 100644 --- a/examples/declarative/package/Delegate.qml +++ b/examples/declarative/package/Delegate.qml @@ -2,24 +2,26 @@ import Qt 4.6 //![0] Package { - Text { id: listDelegate; width: 200; height: 25; text: "Empty"; Package.name: "list" } - Text { id: gridDelegate; width: 100; height: 50; text: "Empty"; Package.name: "grid" } + Text { id: listDelegate; width: 200; height: 25; text: 'Empty'; Package.name: 'list' } + Text { id: gridDelegate; width: 100; height: 50; text: 'Empty'; Package.name: 'grid' } Rectangle { id: wrapper width: 200; height: 25 - color: "lightsteelblue" + color: 'lightsteelblue' + Text { text: display; anchors.centerIn: parent } MouseRegion { anchors.fill: parent onClicked: { - if (wrapper.state == "inList") - wrapper.state = "inGrid"; + if (wrapper.state == 'inList') + wrapper.state = 'inGrid'; else - wrapper.state = "inList"; + wrapper.state = 'inList'; } } - state: "inList" + + state: 'inList' states: [ State { name: 'inList' @@ -27,15 +29,17 @@ Package { }, State { name: 'inGrid' - ParentChange { target: wrapper; parent: gridDelegate } - PropertyChanges { target: wrapper; x: 0; y: 0; width: gridDelegate.width; height: gridDelegate.height } + ParentChange { + target: wrapper; parent: gridDelegate + x: 0; y: 0; width: gridDelegate.width; height: gridDelegate.height + } } ] + transitions: [ Transition { - SequentialAnimation { - ParentAction { target: wrapper } - NumberAnimation { targets: wrapper; properties: 'x,y,width,height'; duration: 300 } + ParentAnimation { + NumberAnimation { properties: 'x,y,width,height'; duration: 300 } } } ] -- cgit v0.12 From cab1428311067872b811679e72e0ad457d76a24f Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Tue, 2 Mar 2010 01:01:58 +1000 Subject: Document TextEdit::textMargin --- src/declarative/graphicsitems/qdeclarativetextedit.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp index 8e44b26..be73b39 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp @@ -613,6 +613,11 @@ void QDeclarativeTextEdit::setPersistentSelection(bool on) emit persistentSelectionChanged(d->persistentSelection); } +/* + \qmlproperty number TextEdit::textMargin + + The margin, in pixels, around the text in the TextEdit. +*/ qreal QDeclarativeTextEdit::textMargin() const { Q_D(const QDeclarativeTextEdit); -- cgit v0.12 From e1aa5c3641ba3945e2e6a7b4c37c394eece53dd0 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Tue, 2 Mar 2010 09:11:13 +1000 Subject: Setting the same source again causes reload. Task-number: QTBUG-8623 --- src/declarative/util/qdeclarativeview.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/declarative/util/qdeclarativeview.cpp b/src/declarative/util/qdeclarativeview.cpp index 6fe5bf3..a3c372d 100644 --- a/src/declarative/util/qdeclarativeview.cpp +++ b/src/declarative/util/qdeclarativeview.cpp @@ -282,13 +282,14 @@ QDeclarativeView::~QDeclarativeView() /*! Sets the source to the \a url, loads the QML component and instantiates it. + + Calling this methods multiple times with the same url will result + in the QML being reloaded. */ void QDeclarativeView::setSource(const QUrl& url) { - if (url != d->source) { - d->source = url; - d->execute(); - } + d->source = url; + d->execute(); } /*! -- cgit v0.12 From 001d1a2eac5b0fe63ae9809c4c69065b7ae14f38 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Tue, 2 Mar 2010 09:33:27 +1000 Subject: Reapply "Some animation cleanup/refactoring." This reverts commit 543c4b82e6d6cc4a396b1c105d7321643b6ef4c6. Conflicts: src/declarative/util/qdeclarativeanimation.cpp --- src/declarative/util/qdeclarativeanimation.cpp | 11 ++++++----- src/declarative/util/qdeclarativeanimation_p_p.h | 21 ++++++++++++++------- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/src/declarative/util/qdeclarativeanimation.cpp b/src/declarative/util/qdeclarativeanimation.cpp index 10230d3..ebf1a20 100644 --- a/src/declarative/util/qdeclarativeanimation.cpp +++ b/src/declarative/util/qdeclarativeanimation.cpp @@ -1573,7 +1573,8 @@ QDeclarativeSequentialAnimation::QDeclarativeSequentialAnimation(QObject *parent QDeclarativeAnimationGroup(parent) { Q_D(QDeclarativeAnimationGroup); - d->ag = new QSequentialAnimationGroup(this); + d->ag = new QSequentialAnimationGroup; + QDeclarative_setParent_noEvent(d->ag, this); } QDeclarativeSequentialAnimation::~QDeclarativeSequentialAnimation() @@ -1638,7 +1639,8 @@ QDeclarativeParallelAnimation::QDeclarativeParallelAnimation(QObject *parent) : QDeclarativeAnimationGroup(parent) { Q_D(QDeclarativeAnimationGroup); - d->ag = new QParallelAnimationGroup(this); + d->ag = new QParallelAnimationGroup; + QDeclarative_setParent_noEvent(d->ag, this); } QDeclarativeParallelAnimation::~QDeclarativeParallelAnimation() @@ -1797,7 +1799,7 @@ QDeclarativePropertyAnimation::~QDeclarativePropertyAnimation() void QDeclarativePropertyAnimationPrivate::init() { Q_Q(QDeclarativePropertyAnimation); - va = new QDeclarativeTimeLineValueAnimator; + va = new QDeclarativeBulkValueAnimator; QDeclarative_setParent_noEvent(va, q); } @@ -2213,7 +2215,7 @@ QAbstractAnimation *QDeclarativePropertyAnimation::qtAnimation() return d->va; } -struct PropertyUpdater : public QDeclarativeTimeLineValue +struct PropertyUpdater : public QDeclarativeBulkValueUpdater { QDeclarativeStateActions actions; int interpolatorType; //for Number/ColorAnimation @@ -2231,7 +2233,6 @@ struct PropertyUpdater : public QDeclarativeTimeLineValue wasDeleted = &deleted; if (reverse) //QVariantAnimation sends us 1->0 when reversed, but we are expecting 0->1 v = 1 - v; - QDeclarativeTimeLineValue::setValue(v); for (int ii = 0; ii < actions.count(); ++ii) { QDeclarativeAction &action = actions[ii]; diff --git a/src/declarative/util/qdeclarativeanimation_p_p.h b/src/declarative/util/qdeclarativeanimation_p_p.h index e582066..ae82a90 100644 --- a/src/declarative/util/qdeclarativeanimation_p_p.h +++ b/src/declarative/util/qdeclarativeanimation_p_p.h @@ -149,14 +149,21 @@ private: bool running; }; -//animates QDeclarativeTimeLineValue (assumes start and end values will be reals or compatible) -class QDeclarativeTimeLineValueAnimator : public QVariantAnimation +class QDeclarativeBulkValueUpdater +{ +public: + virtual ~QDeclarativeBulkValueUpdater() {} + virtual void setValue(qreal value) = 0; +}; + +//animates QDeclarativeBulkValueUpdater (assumes start and end values will be reals or compatible) +class QDeclarativeBulkValueAnimator : public QVariantAnimation { Q_OBJECT public: - QDeclarativeTimeLineValueAnimator(QObject *parent = 0) : QVariantAnimation(parent), animValue(0), fromSourced(0), policy(KeepWhenStopped) {} - ~QDeclarativeTimeLineValueAnimator() { if (policy == DeleteWhenStopped) { delete animValue; animValue = 0; } } - void setAnimValue(QDeclarativeTimeLineValue *value, DeletionPolicy p) + QDeclarativeBulkValueAnimator(QObject *parent = 0) : QVariantAnimation(parent), animValue(0), fromSourced(0), policy(KeepWhenStopped) {} + ~QDeclarativeBulkValueAnimator() { if (policy == DeleteWhenStopped) { delete animValue; animValue = 0; } } + void setAnimValue(QDeclarativeBulkValueUpdater *value, DeletionPolicy p) { if (state() == Running) stop(); @@ -193,7 +200,7 @@ protected: } private: - QDeclarativeTimeLineValue *animValue; + QDeclarativeBulkValueUpdater *animValue; bool *fromSourced; DeletionPolicy policy; }; @@ -352,7 +359,7 @@ public: int interpolatorType; QVariantAnimation::Interpolator interpolator; - QDeclarativeTimeLineValueAnimator *va; + QDeclarativeBulkValueAnimator *va; static QVariant interpolateVariant(const QVariant &from, const QVariant &to, qreal progress); static void convertVariant(QVariant &variant, int type); -- cgit v0.12 From d943ce63bd962763205796cfb5bf960e1228a0b3 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Tue, 2 Mar 2010 09:49:27 +1000 Subject: Replace remaining QGuard usage with QDeclarativeGuard. --- src/declarative/graphicsitems/qdeclarativegridview.cpp | 3 ++- src/declarative/graphicsitems/qdeclarativelistview.cpp | 3 ++- src/declarative/graphicsitems/qdeclarativepathview_p_p.h | 3 ++- src/declarative/util/qdeclarativeview.cpp | 5 +++-- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp index b43b30b..8d778f8 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview.cpp +++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp @@ -45,6 +45,7 @@ #include "qdeclarativeflickable_p_p.h" #include +#include #include #include @@ -251,7 +252,7 @@ public: } } - QGuard model; + QDeclarativeGuard model; QVariant modelVariant; QList visibleItems; QHash unrequestedItems; diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index 03303a0..02a8493 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -47,6 +47,7 @@ #include #include #include +#include #include #include @@ -429,7 +430,7 @@ public: virtual void flickX(qreal velocity); virtual void flickY(qreal velocity); - QGuard model; + QDeclarativeGuard model; QVariant modelVariant; QList visibleItems; QHash unrequestedItems; diff --git a/src/declarative/graphicsitems/qdeclarativepathview_p_p.h b/src/declarative/graphicsitems/qdeclarativepathview_p_p.h index ca50910..6344a8a 100644 --- a/src/declarative/graphicsitems/qdeclarativepathview_p_p.h +++ b/src/declarative/graphicsitems/qdeclarativepathview_p_p.h @@ -60,6 +60,7 @@ #include #include +#include #include @@ -132,7 +133,7 @@ public: int pathOffset; int requestedIndex; QList items; - QGuard model; + QDeclarativeGuard model; QVariant modelVariant; enum MovementReason { Other, Key, Mouse }; MovementReason moveReason; diff --git a/src/declarative/util/qdeclarativeview.cpp b/src/declarative/util/qdeclarativeview.cpp index a3c372d..f08e634 100644 --- a/src/declarative/util/qdeclarativeview.cpp +++ b/src/declarative/util/qdeclarativeview.cpp @@ -51,6 +51,7 @@ #include #include #include +#include #include #include @@ -136,8 +137,8 @@ public: QDeclarativeView *q; - QGuard root; - QGuard qmlRoot; + QDeclarativeGuard root; + QDeclarativeGuard qmlRoot; QUrl source; -- cgit v0.12 From 759888f3074deace6550a8b878d8464903dcfa09 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Tue, 2 Mar 2010 09:58:50 +1000 Subject: Test GridView.onAdd & GridView.onRemove. Reduce wait()s --- .../qdeclarativegridview/data/gridview.qml | 6 +++ .../tst_qdeclarativegridview.cpp | 59 ++++++++++++---------- 2 files changed, 39 insertions(+), 26 deletions(-) diff --git a/tests/auto/declarative/qdeclarativegridview/data/gridview.qml b/tests/auto/declarative/qdeclarativegridview/data/gridview.qml index 344b4b5..ba6b807 100644 --- a/tests/auto/declarative/qdeclarativegridview/data/gridview.qml +++ b/tests/auto/declarative/qdeclarativegridview/data/gridview.qml @@ -1,6 +1,10 @@ import Qt 4.6 Rectangle { + id: root + property int added: -1 + property var removed + width: 240 height: 320 color: "#ffffff" @@ -33,6 +37,8 @@ Rectangle { text: number } color: GridView.isCurrentItem ? "lightsteelblue" : "white" + GridView.onAdd: root.added = index + GridView.onRemove: root.removed = name } } ] diff --git a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp index 2a60fee..7a6a060 100644 --- a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp +++ b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp @@ -47,6 +47,7 @@ #include #include #include +#include #include #include @@ -253,7 +254,7 @@ void tst_QDeclarativeGridView::inserted() model.insertItem(1, "Will", "9876"); // let transitions settle. - QTest::qWait(300); + QTest::qWait(100); QCOMPARE(viewport->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item @@ -264,6 +265,10 @@ void tst_QDeclarativeGridView::inserted() QVERIFY(number != 0); QCOMPARE(number->text(), model.number(1)); + // Checks that onAdd is called + int added = canvas->rootObject()->property("added").toInt(); + QCOMPARE(added, 1); + // Confirm items positioned correctly for (int i = 0; i < model.count(); ++i) { QDeclarativeItem *item = findItem(viewport, "wrapper", i); @@ -274,7 +279,7 @@ void tst_QDeclarativeGridView::inserted() model.insertItem(0, "Foo", "1111"); // zero index, and current item // let transitions settle. - QTest::qWait(300); + QTest::qWait(100); QCOMPARE(viewport->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item @@ -296,14 +301,14 @@ void tst_QDeclarativeGridView::inserted() for (int i = model.count(); i < 30; ++i) model.insertItem(i, "Hello", QString::number(i)); - QTest::qWait(300); + QTest::qWait(100); gridview->setContentY(120); - QTest::qWait(300); + QTest::qWait(100); // Insert item outside visible area model.insertItem(1, "Hello", "1324"); - QTest::qWait(300); + QTest::qWait(100); QVERIFY(gridview->contentY() == 120); @@ -334,7 +339,7 @@ void tst_QDeclarativeGridView::removed() model.removeItem(1); // let transitions settle. - QTest::qWait(300); + QTest::qWait(100); QDeclarativeText *name = findItem(viewport, "textName", 1); QVERIFY(name != 0); @@ -343,6 +348,10 @@ void tst_QDeclarativeGridView::removed() QVERIFY(number != 0); QCOMPARE(number->text(), model.number(1)); + // Checks that onRemove is called + QString removed = canvas->rootObject()->property("removed").toString(); + QCOMPARE(removed, QString("Item1")); + // Confirm items positioned correctly int itemCount = findItems(viewport, "wrapper").count(); for (int i = 0; i < model.count() && i < itemCount; ++i) { @@ -357,7 +366,7 @@ void tst_QDeclarativeGridView::removed() model.removeItem(0); // let transitions settle. - QTest::qWait(300); + QTest::qWait(100); name = findItem(viewport, "textName", 0); QVERIFY(name != 0); @@ -379,7 +388,7 @@ void tst_QDeclarativeGridView::removed() // Remove items not visible model.removeItem(25); // let transitions settle. - QTest::qWait(300); + QTest::qWait(100); // Confirm items positioned correctly itemCount = findItems(viewport, "wrapper").count(); @@ -393,11 +402,11 @@ void tst_QDeclarativeGridView::removed() // Remove items before visible gridview->setContentY(120); - QTest::qWait(500); + QTest::qWait(100); gridview->setCurrentIndex(10); // let transitions settle. - QTest::qWait(300); + QTest::qWait(100); // Setting currentIndex above shouldn't cause view to scroll QCOMPARE(gridview->contentY(), 120.0); @@ -405,7 +414,7 @@ void tst_QDeclarativeGridView::removed() model.removeItem(1); // let transitions settle. - QTest::qWait(300); + QTest::qWait(100); // Confirm items positioned correctly for (int i = 6; i < 18; ++i) { @@ -419,14 +428,14 @@ void tst_QDeclarativeGridView::removed() // Remove currentIndex QDeclarativeItem *oldCurrent = gridview->currentItem(); model.removeItem(9); - QTest::qWait(500); + QTest::qWait(100); QCOMPARE(gridview->currentIndex(), 9); QVERIFY(gridview->currentItem() != oldCurrent); gridview->setContentY(0); // let transitions settle. - QTest::qWait(300); + QTest::qWait(100); // Confirm items positioned correctly itemCount = findItems(viewport, "wrapper").count(); @@ -440,7 +449,7 @@ void tst_QDeclarativeGridView::removed() // remove item outside current view. gridview->setCurrentIndex(32); - QTest::qWait(500); + QTest::qWait(100); gridview->setContentY(240); model.removeItem(30); @@ -448,21 +457,21 @@ void tst_QDeclarativeGridView::removed() // remove current item beyond visible items. gridview->setCurrentIndex(20); - QTest::qWait(500); + QTest::qWait(100); gridview->setContentY(0); model.removeItem(20); - QTest::qWait(500); + QTest::qWait(100); QCOMPARE(gridview->currentIndex(), 20); QVERIFY(gridview->currentItem() != 0); // remove item before current, but visible gridview->setCurrentIndex(8); - QTest::qWait(500); + QTest::qWait(100); gridview->setContentY(240); oldCurrent = gridview->currentItem(); model.removeItem(6); - QTest::qWait(500); + QTest::qWait(100); QCOMPARE(gridview->currentIndex(), 7); QVERIFY(gridview->currentItem() == oldCurrent); @@ -494,7 +503,7 @@ void tst_QDeclarativeGridView::moved() model.moveItem(1, 8); // let transitions settle. - QTest::qWait(300); + QTest::qWait(100); QDeclarativeText *name = findItem(viewport, "textName", 1); QVERIFY(name != 0); @@ -526,7 +535,7 @@ void tst_QDeclarativeGridView::moved() model.moveItem(1, 25); // let transitions settle. - QTest::qWait(300); + QTest::qWait(100); // Confirm items positioned correctly and indexes correct itemCount = findItems(viewport, "wrapper").count()-1; @@ -548,7 +557,7 @@ void tst_QDeclarativeGridView::moved() model.moveItem(28, 8); // let transitions settle. - QTest::qWait(300); + QTest::qWait(100); // Confirm items positioned correctly and indexes correct for (int i = 6; i < model.count()-6 && i < itemCount+6; ++i) { @@ -591,7 +600,7 @@ void tst_QDeclarativeGridView::currentIndex() QDeclarativeItem *viewport = gridview->viewport(); QVERIFY(viewport != 0); - QTest::qWait(500); + QTest::qWait(300); // current item should be third item QCOMPARE(gridview->currentIndex(), 5); @@ -618,7 +627,7 @@ void tst_QDeclarativeGridView::currentIndex() QCOMPARE(gridview->currentIndex(), 0); gridview->setCurrentIndex(model.count()-1); - QTest::qWait(500); + QTest::qWait(100); QCOMPARE(gridview->currentIndex(), model.count()-1); gridview->moveCurrentIndexRight(); @@ -677,8 +686,6 @@ void tst_QDeclarativeGridView::currentIndex() // turn off auto highlight gridview->setHighlightFollowsCurrentItem(false); QVERIFY(gridview->highlightFollowsCurrentItem() == false); - - QTest::qWait(500); QVERIFY(gridview->highlightItem()); qreal hlPosX = gridview->highlightItem()->x(); qreal hlPosY = gridview->highlightItem()->y(); @@ -729,7 +736,7 @@ void tst_QDeclarativeGridView::changeFlow() } ctxt->setContextProperty("testTopToBottom", QVariant(true)); - QTest::qWait(500); + QTest::qWait(100); // Confirm items positioned correctly and indexes correct itemCount = findItems(viewport, "wrapper").count(); -- cgit v0.12 From 7ac4de570aa37d4b6a30e2e935ebab3642415f74 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Tue, 2 Mar 2010 10:36:47 +1000 Subject: Minor optimization. --- src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp index cd72ef9..47ba917 100644 --- a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp +++ b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp @@ -53,6 +53,7 @@ #include #include #include +#include #include #include @@ -984,8 +985,8 @@ QDeclarativeItem *QDeclarativeVisualDataModel::item(int index, const QByteArray if (complete) d->m_delegate->completeCreate(); if (nobj) { - ctxt->setParent(nobj); - data->setParent(nobj); + QDeclarative_setParent_noEvent(ctxt, nobj); + QDeclarative_setParent_noEvent(data, nobj); d->m_cache.insertItem(index, nobj); if (QDeclarativePackage *package = qobject_cast(nobj)) emit createdPackage(index, package); -- cgit v0.12 From 21c15c9efb1b34df6b990c69479979a336267d1b Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Tue, 2 Mar 2010 10:37:17 +1000 Subject: Fix warning. --- src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp index 47ba917..59d6db8 100644 --- a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp +++ b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp @@ -1269,7 +1269,6 @@ void QDeclarativeVisualDataModel::_q_dataChanged(const QModelIndex &begin, const void QDeclarativeVisualDataModel::_q_modelReset() { - Q_D(QDeclarativeVisualDataModel); emit modelReset(); } -- cgit v0.12 From 2790cb59f6877c1027c833578b72e168c912758a Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Tue, 2 Mar 2010 10:47:10 +1000 Subject: Make "on" syntax mandatory for value sources and interceptors Where you would have written x: NumberAnimation {} y: Behavior {} you now must write NumberAnimation on x {} Behavior on y {} This change also makes the parser more strict with respect to multiple assignments to a single property - they're no longer allowed. For example this x: 10 x: 11 is now an error. --- demos/declarative/flickr/common/Loading.qml | 2 +- demos/declarative/flickr/mobile/GridDelegate.qml | 2 +- demos/declarative/flickr/mobile/ImageDetails.qml | 2 +- demos/declarative/flickr/mobile/ListDelegate.qml | 4 +- demos/declarative/minehunt/main.cpp | 5 +- demos/declarative/minehunt/minehunt.qml | 2 +- demos/declarative/samegame/content/BoomBlock.qml | 6 +- demos/declarative/samegame/content/Dialog.qml | 2 +- demos/declarative/samegame/samegame.qml | 2 +- demos/declarative/snake/content/Cookie.qml | 2 +- demos/declarative/snake/content/Link.qml | 8 +- demos/declarative/snake/content/Skull.qml | 6 +- demos/declarative/snake/content/snake.js | 4 +- demos/declarative/snake/snake.qml | 6 +- demos/declarative/twitter/content/FatDelegate.qml | 2 +- demos/declarative/twitter/content/Loading.qml | 2 +- demos/declarative/twitter/twitter.qml | 2 +- .../declarative/animations/color-animation.qml | 10 +- .../declarative/animations/property-animation.qml | 2 +- .../declarative/aspectratio/face_fit_animated.qml | 2 +- examples/declarative/behaviours/behavior.qml | 6 +- examples/declarative/behaviours/test.qml | 102 ---------- .../border-image/content/MyBorderImage.qml | 4 +- examples/declarative/clocks/content/Clock.qml | 6 +- examples/declarative/connections/connections.qml | 2 +- examples/declarative/dial/content/Dial.qml | 2 +- examples/declarative/effects/effects.qml | 4 +- examples/declarative/fillmode/fillmode.qml | 2 +- examples/declarative/fonts/banner.qml | 2 +- examples/declarative/fonts/hello.qml | 4 +- examples/declarative/layouts/positioners.qml | 20 +- .../listview/content/ClickAutoRepeating.qml | 2 +- examples/declarative/listview/highlight.qml | 2 +- examples/declarative/parallax/qml/Smiley.qml | 2 +- .../progressbar/content/ProgressBar.qml | 2 +- examples/declarative/progressbar/progressbars.qml | 6 +- examples/declarative/snow/ImageBatch.qml | 72 ------- examples/declarative/snow/Loading.qml | 8 - examples/declarative/snow/create.js | 12 -- examples/declarative/snow/pics/loading.png | Bin 761 -> 0 bytes examples/declarative/snow/snow.qml | 69 ------- .../tutorials/samegame/samegame3/Dialog.qml | 2 +- .../samegame/samegame4/content/BoomBlock.qml | 6 +- .../samegame/samegame4/content/Dialog.qml | 2 +- examples/declarative/tvtennis/tvtennis.qml | 8 +- examples/declarative/velocity/Day.qml | 2 +- src/declarative/qml/qdeclarativecompiler.cpp | 209 ++++++++++++--------- src/declarative/qml/qdeclarativecompiler_p.h | 5 + src/declarative/qml/qdeclarativedom.cpp | 14 +- src/declarative/qml/qdeclarativeparser.cpp | 9 +- src/declarative/qml/qdeclarativeparser_p.h | 3 + src/declarative/qml/qdeclarativescriptparser.cpp | 66 +++++-- tests/auto/declarative/examples/tst_examples.cpp | 1 - .../qdeclarativeanimations/data/badtype1.qml | 2 +- .../qdeclarativeanimations/data/badtype2.qml | 2 +- .../qdeclarativeanimations/data/badtype3.qml | 2 +- .../qdeclarativeanimations/data/dontAutoStart.qml | 2 +- .../qdeclarativeanimations/data/dontStart.qml | 2 +- .../qdeclarativeanimations/data/properties.qml | 2 +- .../qdeclarativeanimations/data/properties2.qml | 2 +- .../qdeclarativeanimations/data/properties3.qml | 2 +- .../qdeclarativeanimations/data/properties4.qml | 2 +- .../qdeclarativeanimations/data/properties5.qml | 2 +- .../qdeclarativeanimations/data/valuesource.qml | 2 +- .../qdeclarativeanimations/data/valuesource2.qml | 2 +- .../qdeclarativebehaviors/data/binding.qml | 2 +- .../qdeclarativebehaviors/data/color.qml | 2 +- .../qdeclarativebehaviors/data/cpptrigger.qml | 2 +- .../qdeclarativebehaviors/data/disabled.qml | 2 +- .../qdeclarativebehaviors/data/dontStart.qml | 2 +- .../qdeclarativebehaviors/data/empty.qml | 2 +- .../qdeclarativebehaviors/data/explicit.qml | 2 +- .../qdeclarativebehaviors/data/groupProperty.qml | 2 +- .../qdeclarativebehaviors/data/groupProperty2.qml | 2 +- .../qdeclarativebehaviors/data/loop.qml | 2 +- .../qdeclarativebehaviors/data/nonSelecting2.qml | 2 +- .../qdeclarativebehaviors/data/parent.qml | 2 +- .../data/reassignedAnimation.qml | 2 +- .../qdeclarativebehaviors/data/scripttrigger.qml | 2 +- .../qdeclarativebehaviors/data/simple.qml | 2 +- .../tst_qdeclarativebehaviors.cpp | 2 +- .../qdeclarativedom/tst_qdeclarativedom.cpp | 72 +++---- .../qdeclarativelanguage/data/assignBasicTypes.qml | 2 - .../data/component.3.errors.txt | 2 +- .../data/doubleSignal.errors.txt | 2 +- .../data/invalidGroupedProperty.6.errors.txt | 2 +- .../data/invalidID.4.errors.txt | 2 +- .../data/listAssignment.3.errors.txt | 2 +- .../data/multiSet.1.errors.txt | 1 + .../qdeclarativelanguage/data/multiSet.1.qml | 7 + .../data/multiSet.10.errors.txt | 1 + .../qdeclarativelanguage/data/multiSet.10.qml | 6 + .../data/multiSet.2.errors.txt | 1 + .../qdeclarativelanguage/data/multiSet.2.qml | 7 + .../data/multiSet.3.errors.txt | 1 + .../qdeclarativelanguage/data/multiSet.3.qml | 7 + .../data/multiSet.4.errors.txt | 1 + .../qdeclarativelanguage/data/multiSet.4.qml | 7 + .../data/multiSet.5.errors.txt | 1 + .../qdeclarativelanguage/data/multiSet.5.qml | 6 + .../data/multiSet.6.errors.txt | 1 + .../qdeclarativelanguage/data/multiSet.6.qml | 7 + .../data/multiSet.7.errors.txt | 1 + .../qdeclarativelanguage/data/multiSet.7.qml | 7 + .../data/multiSet.8.errors.txt | 1 + .../qdeclarativelanguage/data/multiSet.8.qml | 8 + .../data/multiSet.9.errors.txt | 1 + .../qdeclarativelanguage/data/multiSet.9.qml | 6 + .../data/propertyValueSource.2.qml | 2 +- .../data/propertyValueSource.qml | 2 +- .../qdeclarativelanguage/data/script.8.errors.txt | 2 +- .../declarative/qdeclarativelanguage/testtypes.h | 5 + .../tst_qdeclarativelanguage.cpp | 11 ++ .../qdeclarativeparticles/data/particles.qml | 2 +- .../qdeclarativepathview/data/pathview2.qml | 2 +- .../qdeclarativepathview/data/pathview3.qml | 2 +- .../data/valueInterceptors.qml | 2 +- .../qdeclarativevaluetypes/data/valueSources.qml | 2 +- .../tst_qdeclarativevaluetypes.cpp | 3 +- tools/qml/qfxtester.h | 4 +- 120 files changed, 454 insertions(+), 532 deletions(-) delete mode 100644 examples/declarative/behaviours/test.qml delete mode 100644 examples/declarative/snow/ImageBatch.qml delete mode 100644 examples/declarative/snow/Loading.qml delete mode 100644 examples/declarative/snow/create.js delete mode 100644 examples/declarative/snow/pics/loading.png delete mode 100644 examples/declarative/snow/snow.qml create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/multiSet.1.errors.txt create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/multiSet.1.qml create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/multiSet.10.errors.txt create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/multiSet.10.qml create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/multiSet.2.errors.txt create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/multiSet.2.qml create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/multiSet.3.errors.txt create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/multiSet.3.qml create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/multiSet.4.errors.txt create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/multiSet.4.qml create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/multiSet.5.errors.txt create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/multiSet.5.qml create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/multiSet.6.errors.txt create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/multiSet.6.qml create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/multiSet.7.errors.txt create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/multiSet.7.qml create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/multiSet.8.errors.txt create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/multiSet.8.qml create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/multiSet.9.errors.txt create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/multiSet.9.qml diff --git a/demos/declarative/flickr/common/Loading.qml b/demos/declarative/flickr/common/Loading.qml index 174cd21..938a080 100644 --- a/demos/declarative/flickr/common/Loading.qml +++ b/demos/declarative/flickr/common/Loading.qml @@ -2,7 +2,7 @@ import Qt 4.6 Image { id: loading; source: "pics/loading.png"; transformOrigin: "Center" - rotation: NumberAnimation { + NumberAnimation on rotation { from: 0; to: 360; running: loading.visible == true; repeat: true; duration: 900 } } diff --git a/demos/declarative/flickr/mobile/GridDelegate.qml b/demos/declarative/flickr/mobile/GridDelegate.qml index 7634573..291d874 100644 --- a/demos/declarative/flickr/mobile/GridDelegate.qml +++ b/demos/declarative/flickr/mobile/GridDelegate.qml @@ -23,7 +23,7 @@ Item { anchors.centerIn: parent scale: 0.0 - scale: Behavior { NumberAnimation { easing.type: "InOutQuad"} } + Behavior on scale { NumberAnimation { easing.type: "InOutQuad"} } id: scaleMe Rectangle { height: 79; width: 79; id: blackRect; anchors.centerIn: parent; color: "black"; smooth: true } diff --git a/demos/declarative/flickr/mobile/ImageDetails.qml b/demos/declarative/flickr/mobile/ImageDetails.qml index 8749b4c..f1b3c7d 100644 --- a/demos/declarative/flickr/mobile/ImageDetails.qml +++ b/demos/declarative/flickr/mobile/ImageDetails.qml @@ -45,7 +45,7 @@ Flipable { Text { color: "white"; elide: Text.ElideRight; text: "Author: " + container.photoAuthor } Text { color: "white"; elide: Text.ElideRight; text: "Published: " + container.photoDate } Text { color: "white"; elide: Text.ElideRight; text: container.photoTags == "" ? "" : "Tags: " } - Text { color: "white"; elide: Text.ElideRight; elide: Text.ElideRight; text: container.photoTags } + Text { color: "white"; elide: Text.ElideRight; text: container.photoTags } } } diff --git a/demos/declarative/flickr/mobile/ListDelegate.qml b/demos/declarative/flickr/mobile/ListDelegate.qml index 75c4572..381664b 100644 --- a/demos/declarative/flickr/mobile/ListDelegate.qml +++ b/demos/declarative/flickr/mobile/ListDelegate.qml @@ -15,8 +15,8 @@ Component { Column { x: 92; width: wrapper.ListView.view.width - 95; y: 15; spacing: 2 Text { text: title; color: "white"; width: parent.width; font.bold: true; elide: Text.ElideRight; style: Text.Raised; styleColor: "black" } - Text { text: photoAuthor; color: "white"; width: parent.width; elide: Text.ElideLeft; color: "#cccccc"; style: Text.Raised; styleColor: "black" } - Text { text: photoDate; color: "white"; width: parent.width; elide: Text.ElideRight; color: "#cccccc"; style: Text.Raised; styleColor: "black" } + Text { text: photoAuthor; width: parent.width; elide: Text.ElideLeft; color: "#cccccc"; style: Text.Raised; styleColor: "black" } + Text { text: photoDate; width: parent.width; elide: Text.ElideRight; color: "#cccccc"; style: Text.Raised; styleColor: "black" } } } } diff --git a/demos/declarative/minehunt/main.cpp b/demos/declarative/minehunt/main.cpp index 0e99731..c8b4b54 100644 --- a/demos/declarative/minehunt/main.cpp +++ b/demos/declarative/minehunt/main.cpp @@ -100,8 +100,8 @@ public: MyWidget(int = 370, int = 480, QWidget *parent=0, Qt::WindowFlags flags=0); ~MyWidget(); - Q_PROPERTY(QList *tiles READ tiles CONSTANT); - QList *tiles() { return &_tiles; } + Q_PROPERTY(QDeclarativeListProperty tiles READ tiles CONSTANT); + QDeclarativeListProperty tiles() { return QDeclarativeListProperty(this, _tiles); } Q_PROPERTY(bool isPlaying READ isPlaying NOTIFY isPlayingChanged); bool isPlaying() {return playing;} @@ -168,7 +168,6 @@ MyWidget::MyWidget(int width, int height, QWidget *parent, Qt::WindowFlags flags QDeclarativeContext *ctxt = canvas->rootContext(); ctxt->addDefaultObject(this); - ctxt->setContextProperty("tiles", QVariant::fromValue*>(&_tiles));//QTBUG-5675 canvas->setSource(QUrl::fromLocalFile(fileName)); } diff --git a/demos/declarative/minehunt/minehunt.qml b/demos/declarative/minehunt/minehunt.qml index 617a6ed..c54e741 100644 --- a/demos/declarative/minehunt/minehunt.qml +++ b/demos/declarative/minehunt/minehunt.qml @@ -32,7 +32,7 @@ Item { anchors.verticalCenter: parent.verticalCenter source: "pics/flag.png" opacity: model.hasFlag - opacity: Behavior { + Behavior on opacity { NumberAnimation { property: "opacity" duration: 250 diff --git a/demos/declarative/samegame/content/BoomBlock.qml b/demos/declarative/samegame/content/BoomBlock.qml index 723e62a..e48194a 100644 --- a/demos/declarative/samegame/content/BoomBlock.qml +++ b/demos/declarative/samegame/content/BoomBlock.qml @@ -7,8 +7,8 @@ Item { id:block property int targetX: 0 property int targetY: 0 - x: SpringFollow { enabled: spawned; source: targetX; spring: 2; damping: 0.2 } - y: SpringFollow { source: targetY; spring: 2; damping: 0.2 } + SpringFollow on x { enabled: spawned; source: targetX; spring: 2; damping: 0.2 } + SpringFollow on y { source: targetY; spring: 2; damping: 0.2 } Image { id: img source: { @@ -21,7 +21,7 @@ Item { id:block } } opacity: 0 - opacity: Behavior { NumberAnimation { duration: 200 } } + Behavior on opacity { NumberAnimation { duration: 200 } } anchors.fill: parent } diff --git a/demos/declarative/samegame/content/Dialog.qml b/demos/declarative/samegame/content/Dialog.qml index 7769328..6d5d6b5 100644 --- a/demos/declarative/samegame/content/Dialog.qml +++ b/demos/declarative/samegame/content/Dialog.qml @@ -14,7 +14,7 @@ Rectangle { property Item text: myText color: "white"; border.width: 1; width: myText.width + 20; height: myText.height + 40; opacity: 0 - opacity: Behavior { + Behavior on opacity { NumberAnimation { duration: 1000 } } Text { id: myText; anchors.centerIn: parent; text: "Hello World!" } diff --git a/demos/declarative/samegame/samegame.qml b/demos/declarative/samegame/samegame.qml index 50f6293..c81f292 100644 --- a/demos/declarative/samegame/samegame.qml +++ b/demos/declarative/samegame/samegame.qml @@ -39,7 +39,7 @@ Rectangle { Dialog { id: scoreName; anchors.centerIn: parent; z: 22; property int initialWidth: 0 - width: Behavior{NumberAnimation{} enabled: initialWidth!=0} + Behavior on width {NumberAnimation{} enabled: initialWidth!=0} Text { id: spacer anchors.left: scoreName.left diff --git a/demos/declarative/snake/content/Cookie.qml b/demos/declarative/snake/content/Cookie.qml index 7f0aadf..0ea95cb 100644 --- a/demos/declarative/snake/content/Cookie.qml +++ b/demos/declarative/snake/content/Cookie.qml @@ -17,7 +17,7 @@ Item { anchors.fill: parent source: "pics/cookie.png" opacity: 0 - opacity: Behavior { NumberAnimation { duration: 100 } } + Behavior on opacity { NumberAnimation { duration: 100 } } Text { font.bold: true anchors.verticalCenter: parent.verticalCenter diff --git a/demos/declarative/snake/content/Link.qml b/demos/declarative/snake/content/Link.qml index 1b3f7bf..31ac4b9 100644 --- a/demos/declarative/snake/content/Link.qml +++ b/demos/declarative/snake/content/Link.qml @@ -13,8 +13,8 @@ Item { id:link x: margin - 3 + gridSize * column y: margin - 3 + gridSize * row - x: Behavior { NumberAnimation { duration: spawned ? heartbeatInterval : 0} } - y: Behavior { NumberAnimation { duration: spawned ? heartbeatInterval : 0 } } + Behavior on x { NumberAnimation { duration: spawned ? heartbeatInterval : 0} } + Behavior on y { NumberAnimation { duration: spawned ? heartbeatInterval : 0 } } Item { @@ -35,7 +35,7 @@ Item { id:link id: actualImageRotation origin.x: width/2; origin.y: height/2; angle: rotation * 90 - angle: Behavior{ NumberAnimation { duration: spawned ? 200 : 0} } + Behavior on angle { NumberAnimation { duration: spawned ? 200 : 0} } } } @@ -44,7 +44,7 @@ Item { id:link } opacity: 0 - opacity: Behavior { NumberAnimation { duration: 200 } } + Behavior on opacity { NumberAnimation { duration: 200 } } } diff --git a/demos/declarative/snake/content/Skull.qml b/demos/declarative/snake/content/Skull.qml index 585e7d3..821996a 100644 --- a/demos/declarative/snake/content/Skull.qml +++ b/demos/declarative/snake/content/Skull.qml @@ -9,11 +9,11 @@ Image { x: margin + column * gridSize + 2 y: margin + row * gridSize - 3 - x: Behavior { NumberAnimation { duration: spawned ? halfbeatInterval : 0} } - y: Behavior { NumberAnimation { duration: spawned ? halfbeatInterval : 0 } } + Behavior on x { NumberAnimation { duration: spawned ? halfbeatInterval : 0} } + Behavior on y { NumberAnimation { duration: spawned ? halfbeatInterval : 0 } } opacity: spawned ? 1 : 0 - opacity: Behavior { NumberAnimation { duration: 200 } } + Behavior on opacity { NumberAnimation { duration: 200 } } source: "pics/skull.png" width: 24 diff --git a/demos/declarative/snake/content/snake.js b/demos/declarative/snake/content/snake.js index a65aebc..12176c7 100644 --- a/demos/declarative/snake/content/snake.js +++ b/demos/declarative/snake/content/snake.js @@ -54,7 +54,7 @@ function startNewGame() } else { if(linkComponent.isReady == false){ if(linkComponent.isError == true) - print(linkComponent.errorString()); + print(linkComponent.errorsString()); else print("Still loading linkComponent"); continue;//TODO: Better error handling? @@ -295,7 +295,7 @@ function createCookie(value) { if(cookieComponent.isReady == false){ if(cookieComponent.isError == true) - print(cookieComponent.errorString()); + print(cookieComponent.errorsString()); else print("Still loading cookieComponent"); return;//TODO: Better error handling? diff --git a/demos/declarative/snake/snake.qml b/demos/declarative/snake/snake.qml index 09b6b7f..f9d02c7 100644 --- a/demos/declarative/snake/snake.qml +++ b/demos/declarative/snake/snake.qml @@ -65,7 +65,7 @@ Rectangle { anchors.fill: parent anchors.horizontalCenter: parent.horizontalCenter anchors.verticalCenter: parent.verticalCenter - opacity: Behavior { NumberAnimation { duration: 500 } } + Behavior on opacity { NumberAnimation { duration: 500 } } Text { color: "white" @@ -121,7 +121,7 @@ Rectangle { Rectangle { id: progressBar opacity: 0 - opacity: Behavior { NumberAnimation { duration: 200 } } + Behavior on opacity { NumberAnimation { duration: 200 } } color: "transparent" border.width: 2 border.color: "#221edd" @@ -137,7 +137,7 @@ Rectangle { id: progressIndicator color: "#221edd"; width: 0; - width: Behavior { NumberAnimation { duration: startHeartbeatTimer.running ? 1000 : 0}} + Behavior on width { NumberAnimation { duration: startHeartbeatTimer.running ? 1000 : 0}} height: 30; } } diff --git a/demos/declarative/twitter/content/FatDelegate.qml b/demos/declarative/twitter/content/FatDelegate.qml index 2b9288b..0f013e6 100644 --- a/demos/declarative/twitter/content/FatDelegate.qml +++ b/demos/declarative/twitter/content/FatDelegate.qml @@ -37,7 +37,7 @@ Component { + ''+userScreenName + " from " +source + "
" + addTags(statusText) + ""; textFormat: Qt.RichText - color: "white"; color: "#cccccc"; style: Text.Raised; styleColor: "black"; wrap: true + color: "#cccccc"; style: Text.Raised; styleColor: "black"; wrap: true anchors.left: whiteRect.right; anchors.right: blackRect.right; anchors.leftMargin: 6; anchors.rightMargin: 6 onLinkActivated: handleLink(link) } diff --git a/demos/declarative/twitter/content/Loading.qml b/demos/declarative/twitter/content/Loading.qml index 3151415..76bf64b 100644 --- a/demos/declarative/twitter/content/Loading.qml +++ b/demos/declarative/twitter/content/Loading.qml @@ -2,7 +2,7 @@ import Qt 4.6 Image { id: loading; source: "images/loading.png"; transformOrigin: "Center" - rotation: NumberAnimation { + NumberAnimation on rotation { from: 0; to: 360; running: loading.visible == true; repeat: true; duration: 900 } } diff --git a/demos/declarative/twitter/twitter.qml b/demos/declarative/twitter/twitter.qml index b091b03..0ea1309 100644 --- a/demos/declarative/twitter/twitter.qml +++ b/demos/declarative/twitter/twitter.qml @@ -35,7 +35,7 @@ Item { Text { width: 180 text: "Could not access twitter using this screen name and password pair."; - color: "white"; color: "#cccccc"; style: Text.Raised; styleColor: "black"; wrap: true + color: "#cccccc"; style: Text.Raised; styleColor: "black"; wrap: true visible: rssModel.status==XmlListModel.Error; anchors.centerIn: parent } diff --git a/examples/declarative/animations/color-animation.qml b/examples/declarative/animations/color-animation.qml index 7171a69..6740522 100644 --- a/examples/declarative/animations/color-animation.qml +++ b/examples/declarative/animations/color-animation.qml @@ -10,7 +10,7 @@ Item { gradient: Gradient { GradientStop { position: 0.0 - color: SequentialAnimation { + SequentialAnimation on color { repeat: true ColorAnimation { from: "DeepSkyBlue"; to: "#0E1533"; duration: 5000 } ColorAnimation { from: "#0E1533"; to: "DeepSkyBlue"; duration: 5000 } @@ -18,7 +18,7 @@ Item { } GradientStop { position: 1.0 - color: SequentialAnimation { + SequentialAnimation on color { repeat: true ColorAnimation { from: "SkyBlue"; to: "#437284"; duration: 5000 } ColorAnimation { from: "#437284"; to: "SkyBlue"; duration: 5000 } @@ -31,7 +31,7 @@ Item { Item { width: parent.width; height: 2 * parent.height transformOrigin: Item.Center - rotation: NumberAnimation { from: 0; to: 360; duration: 10000; repeat: true } + NumberAnimation on rotation { from: 0; to: 360; duration: 10000; repeat: true } Image { source: "images/sun.png"; y: 10; anchors.horizontalCenter: parent.horizontalCenter transformOrigin: Item.Center; rotation: -3 * parent.rotation @@ -44,7 +44,7 @@ Item { x: 0; y: parent.height/2; width: parent.width; height: parent.height/2 source: "images/star.png"; angleDeviation: 360; velocity: 0 velocityDeviation: 0; count: parent.width / 10; fadeInDuration: 2800 - opacity: SequentialAnimation { + SequentialAnimation on opacity { repeat: true NumberAnimation { from: 0; to: 1; duration: 5000 } NumberAnimation { from: 1; to: 0; duration: 5000 } @@ -58,7 +58,7 @@ Item { gradient: Gradient { GradientStop { position: 0.0 - color: SequentialAnimation { + SequentialAnimation on color { repeat: true ColorAnimation { from: "ForestGreen"; to: "#001600"; duration: 5000 } ColorAnimation { from: "#001600"; to: "ForestGreen"; duration: 5000 } diff --git a/examples/declarative/animations/property-animation.qml b/examples/declarative/animations/property-animation.qml index 537ee26..4428f34 100644 --- a/examples/declarative/animations/property-animation.qml +++ b/examples/declarative/animations/property-animation.qml @@ -42,7 +42,7 @@ Item { // Animate the y property. Setting repeat to true makes the // animation repeat indefinitely, otherwise it would only run once. - y: SequentialAnimation { + SequentialAnimation on y { repeat: true // Move from minHeight to maxHeight in 300ms, using the OutExpo easing function diff --git a/examples/declarative/aspectratio/face_fit_animated.qml b/examples/declarative/aspectratio/face_fit_animated.qml index 90ea516..79e99e9 100644 --- a/examples/declarative/aspectratio/face_fit_animated.qml +++ b/examples/declarative/aspectratio/face_fit_animated.qml @@ -18,7 +18,7 @@ Rectangle { source: "pics/face.png" x: (parent.width-width*scale)/2 y: (parent.height-height*scale)/2 - scale: SpringFollow { + SpringFollow on scale { source: Math.max(Math.min(face.parent.width/face.width*1.333,face.parent.height/face.height), Math.min(face.parent.width/face.width,face.parent.height/face.height*1.333)) spring: 1 diff --git a/examples/declarative/behaviours/behavior.qml b/examples/declarative/behaviours/behavior.qml index 2732c0a..c84bf62 100644 --- a/examples/declarative/behaviours/behavior.qml +++ b/examples/declarative/behaviours/behavior.qml @@ -50,12 +50,12 @@ Rectangle { radius: 5 border.width: 10; border.color: "white"; x: 100-37; y: 100-25 - x: Behavior { NumberAnimation { duration: 300 } } - y: Behavior { NumberAnimation { duration: 300 } } + Behavior on x { NumberAnimation { duration: 300 } } + Behavior on y { NumberAnimation { duration: 300 } } Text { id: focusText text: focusRect.text; - text: Behavior { + Behavior on text { SequentialAnimation { NumberAnimation { target: focusText; property: "opacity"; to: 0; duration: 150 } PropertyAction {} diff --git a/examples/declarative/behaviours/test.qml b/examples/declarative/behaviours/test.qml deleted file mode 100644 index 8fffd59..0000000 --- a/examples/declarative/behaviours/test.qml +++ /dev/null @@ -1,102 +0,0 @@ -import Qt 4.6 - -Rectangle { - color: "lightsteelblue" - width: 800 - height: 600 - id: page - MouseArea { - anchors.fill: parent - onClicked: { bluerect.parent = page; console.log(mouseX); bluerect.x = mouseX; } - } - MyRect { - color: "green" - x: 200 - y: 200 - } - MyRect { - color: "red" - x: 400 - y: 200 - } - MyRect { - color: "yellow" - x: 400 - y: 400 - } - MyRect { - color: "orange" - x: 400 - y: 500 - } - MyRect { - color: "pink" - x: 400 - y: 0 - } - MyRect { - color: "lightsteelblue" - x: 100 - y: 500 - } - MyRect { - color: "black" - x: 0 - y: 200 - } - MyRect { - color: "white" - x: 400 - y: 0 - } - Rectangle { - color: "blue" - x: 0 - y: 0 - width: 100 - height: 100 - id: bluerect - x: Behavior { - ParallelAnimation { - SequentialAnimation { - NumberAnimation { - target: bluerect - property: "y" - from: 0 - to: 10 - easing.type: "OutBounce" - easing.amplitude: 30 - duration: 250 - } - NumberAnimation { - target: bluerect - property: "y" - from: 10 - to: 0 - easing.type: "OutBounce" - easing.amplitude: 30 - duration: 250 - } - } - NumberAnimation { duration: 500 } - } - } - parent: Behavior { - SequentialAnimation { - NumberAnimation { - target: bluerect - property: "opacity" - to: 0 - duration: 150 - } - PropertyAction {} - NumberAnimation { - target: bluerect - property: "opacity" - to: 1 - duration: 150 - } - } - } - } -} diff --git a/examples/declarative/border-image/content/MyBorderImage.qml b/examples/declarative/border-image/content/MyBorderImage.qml index ca886e9..5621e18 100644 --- a/examples/declarative/border-image/content/MyBorderImage.qml +++ b/examples/declarative/border-image/content/MyBorderImage.qml @@ -17,13 +17,13 @@ Item { BorderImage { id: image; x: container.width / 2 - width / 2; y: container.height / 2 - height / 2 - width: SequentialAnimation { + SequentialAnimation on width { repeat: true NumberAnimation { from: container.minWidth; to: container.maxWidth; duration: 2000; easing.type: "InOutQuad"} NumberAnimation { from: container.maxWidth; to: container.minWidth; duration: 2000; easing.type: "InOutQuad" } } - height: SequentialAnimation { + SequentialAnimation on height { repeat: true NumberAnimation { from: container.minHeight; to: container.maxHeight; duration: 2000; easing.type: "InOutQuad"} NumberAnimation { from: container.maxHeight; to: container.minHeight; duration: 2000; easing.type: "InOutQuad" } diff --git a/examples/declarative/clocks/content/Clock.qml b/examples/declarative/clocks/content/Clock.qml index 0c6836f..75a1cf5 100644 --- a/examples/declarative/clocks/content/Clock.qml +++ b/examples/declarative/clocks/content/Clock.qml @@ -34,7 +34,7 @@ Item { transform: Rotation { id: hourRotation origin.x: 7.5; origin.y: 73; angle: 0 - angle: SpringFollow { + SpringFollow on angle { spring: 2; damping: 0.2; modulus: 360 source: (clock.hours * 30) + (clock.minutes * 0.5) } @@ -48,7 +48,7 @@ Item { transform: Rotation { id: minuteRotation origin.x: 6.5; origin.y: 83; angle: 0 - angle: SpringFollow { + SpringFollow on angle { spring: 2; damping: 0.2; modulus: 360 source: clock.minutes * 6 } @@ -62,7 +62,7 @@ Item { transform: Rotation { id: secondRotation origin.x: 2.5; origin.y: 80; angle: 0 - angle: SpringFollow { + SpringFollow on angle { spring: 5; damping: 0.25; modulus: 360 source: clock.seconds * 6 } diff --git a/examples/declarative/connections/connections.qml b/examples/declarative/connections/connections.qml index 4692343..c35bda5 100644 --- a/examples/declarative/connections/connections.qml +++ b/examples/declarative/connections/connections.qml @@ -10,7 +10,7 @@ Rectangle { Image { id: image; source: "content/bg1.jpg"; anchors.centerIn: parent; transformOrigin: Item.Center rotation: window.angle - rotation: Behavior { NumberAnimation { easing.type: "OutCubic"; duration: 300 } } + Behavior on rotation { NumberAnimation { easing.type: "OutCubic"; duration: 300 } } } Button { diff --git a/examples/declarative/dial/content/Dial.qml b/examples/declarative/dial/content/Dial.qml index 6fd0f39..ad4717a 100644 --- a/examples/declarative/dial/content/Dial.qml +++ b/examples/declarative/dial/content/Dial.qml @@ -26,7 +26,7 @@ Item { id: needleRotation origin.x: 7; origin.y: 65 angle: -130 - angle: SpringFollow { + SpringFollow on angle { spring: 1.4 damping: .15 source: Math.min(Math.max(-130, root.value*2.6 - 130), 133) diff --git a/examples/declarative/effects/effects.qml b/examples/declarative/effects/effects.qml index 0674433..997d7de 100644 --- a/examples/declarative/effects/effects.qml +++ b/examples/declarative/effects/effects.qml @@ -11,7 +11,7 @@ Rectangle { source: "pic.png" effect: Blur { - blurRadius: NumberAnimation { + NumberAnimation on blurRadius { id: blurEffect running: false from: 0; to: 10 @@ -33,7 +33,7 @@ Rectangle { effect: DropShadow { blurRadius: 3 offset.x: 3 - offset.y: NumberAnimation { id: dropShadowEffect; from: 0; to: 10; duration: 1000; running: false; repeat: true; } + NumberAnimation on offset.y { id: dropShadowEffect; from: 0; to: 10; duration: 1000; running: false; repeat: true; } } MouseArea { anchors.fill: parent; onClicked: dropShadowEffect.running = !dropShadowEffect.running } diff --git a/examples/declarative/fillmode/fillmode.qml b/examples/declarative/fillmode/fillmode.qml index ec3717f..ab0f81c 100644 --- a/examples/declarative/fillmode/fillmode.qml +++ b/examples/declarative/fillmode/fillmode.qml @@ -4,7 +4,7 @@ Image { width: 400 height: 250 source: "face.png" - fillMode: SequentialAnimation { + SequentialAnimation on fillMode { repeat: true PropertyAction { value: Image.Stretch } PropertyAction { target: label; property: "text"; value: "Stretch" } diff --git a/examples/declarative/fonts/banner.qml b/examples/declarative/fonts/banner.qml index 00b8660..7989f80 100644 --- a/examples/declarative/fonts/banner.qml +++ b/examples/declarative/fonts/banner.qml @@ -10,7 +10,7 @@ Rectangle { Row { y: -screen.height / 4.5 - x: NumberAnimation { from: 0; to: -text.width; duration: 6000; repeat: true } + NumberAnimation on x { from: 0; to: -text.width; duration: 6000; repeat: true } Text { id: text; font.pixelSize: screen.pixelSize; color: screen.textColor; text: screen.text } Text { font.pixelSize: screen.pixelSize; color: screen.textColor; text: screen.text } Text { font.pixelSize: screen.pixelSize; color: screen.textColor; text: screen.text } diff --git a/examples/declarative/fonts/hello.qml b/examples/declarative/fonts/hello.qml index fcc9580..334409e 100644 --- a/examples/declarative/fonts/hello.qml +++ b/examples/declarative/fonts/hello.qml @@ -9,7 +9,7 @@ Rectangle { id: text; color: "white"; anchors.centerIn: parent text: "Hello world!"; font.pixelSize: 60 - font.letterSpacing: SequentialAnimation { + SequentialAnimation on font.letterSpacing { repeat: true; NumberAnimation { from: 100; to: 300; easing.type: "InQuad"; duration: 3000 } ScriptAction { script: { @@ -17,7 +17,7 @@ Rectangle { container.x = (screen.width / 4) + (Math.random() * screen.width / 2) } } } - opacity: SequentialAnimation { + SequentialAnimation on opacity { repeat: true; NumberAnimation { from: 1; to: 0; duration: 2600 } PauseAnimation { duration: 400 } diff --git a/examples/declarative/layouts/positioners.qml b/examples/declarative/layouts/positioners.qml index 7146702..bce53bd 100644 --- a/examples/declarative/layouts/positioners.qml +++ b/examples/declarative/layouts/positioners.qml @@ -21,11 +21,11 @@ Rectangle { } Rectangle { color: "red"; width: 100; height: 50; border.color: "black"; radius: 15 } Rectangle { id: blueV1; color: "lightsteelblue"; width: 100; height: 50; border.color: "black"; radius: 15 - opacity: Behavior{NumberAnimation{}} + Behavior on opacity {NumberAnimation{}} } Rectangle { color: "green"; width: 100; height: 50; border.color: "black"; radius: 15 } Rectangle { id: blueV2; color: "lightsteelblue"; width: 100; height: 50; border.color: "black"; radius: 15 - opacity: Behavior{NumberAnimation{}} + Behavior on opacity {NumberAnimation{}} } Rectangle { color: "orange"; width: 100; height: 50; border.color: "black"; radius: 15 } } @@ -45,11 +45,11 @@ Rectangle { } Rectangle { color: "red"; width: 50; height: 100; border.color: "black"; radius: 15 } Rectangle { id: blueH1; color: "lightsteelblue"; width: 50; height: 100; border.color: "black"; radius: 15 - opacity: Behavior{NumberAnimation{}} + Behavior on opacity {NumberAnimation{}} } Rectangle { color: "green"; width: 50; height: 100; border.color: "black"; radius: 15 } Rectangle { id: blueH2; color: "lightsteelblue"; width: 50; height: 100; border.color: "black"; radius: 15 - opacity: Behavior{NumberAnimation{}} + Behavior on opacity {NumberAnimation{}} } Rectangle { color: "orange"; width: 50; height: 100; border.color: "black"; radius: 15 } } @@ -113,15 +113,15 @@ Rectangle { Rectangle { color: "red"; width: 50; height: 50; border.color: "black"; radius: 15 } Rectangle { id: blueG1; color: "lightsteelblue"; width: 50; height: 50; border.color: "black"; radius: 15 - opacity: Behavior{NumberAnimation{}} + Behavior on opacity {NumberAnimation{}} } Rectangle { color: "green"; width: 50; height: 50; border.color: "black"; radius: 15 } Rectangle { id: blueG2; color: "lightsteelblue"; width: 50; height: 50; border.color: "black"; radius: 15 - opacity: Behavior{NumberAnimation{}} + Behavior on opacity {NumberAnimation{}} } Rectangle { color: "orange"; width: 50; height: 50; border.color: "black"; radius: 15 } Rectangle { id: blueG3; color: "lightsteelblue"; width: 50; height: 50; border.color: "black"; radius: 15 - opacity: Behavior{NumberAnimation{}} + Behavior on opacity {NumberAnimation{}} } Rectangle { color: "red"; width: 50; height: 50; border.color: "black"; radius: 15 } Rectangle { color: "green"; width: 50; height: 50; border.color: "black"; radius: 15 } @@ -147,15 +147,15 @@ Rectangle { } Rectangle { color: "red"; width: 50; height: 50; border.color: "black"; radius: 15 } Rectangle { id: blueF1; color: "lightsteelblue"; width: 60; height: 50; border.color: "black"; radius: 15 - opacity: Behavior{NumberAnimation{}} + Behavior on opacity {NumberAnimation{}} } Rectangle { color: "green"; width: 30; height: 50; border.color: "black"; radius: 15 } Rectangle { id: blueF2; color: "lightsteelblue"; width: 60; height: 50; border.color: "black"; radius: 15 - opacity: Behavior{NumberAnimation{}} + Behavior on opacity {NumberAnimation{}} } Rectangle { color: "orange"; width: 50; height: 50; border.color: "black"; radius: 15 } Rectangle { id: blueF3; color: "lightsteelblue"; width: 40; height: 50; border.color: "black"; radius: 15 - opacity: Behavior{NumberAnimation{}} + Behavior on opacity {NumberAnimation{}} } Rectangle { color: "red"; width: 80; height: 50; border.color: "black"; radius: 15 } } diff --git a/examples/declarative/listview/content/ClickAutoRepeating.qml b/examples/declarative/listview/content/ClickAutoRepeating.qml index 0850f4e..5240e65 100644 --- a/examples/declarative/listview/content/ClickAutoRepeating.qml +++ b/examples/declarative/listview/content/ClickAutoRepeating.qml @@ -10,7 +10,7 @@ Item { signal released signal clicked - isPressed: SequentialAnimation { + SequentialAnimation on isPressed { running: false id: autoRepeat PropertyAction { target: page; property: "isPressed"; value: true } diff --git a/examples/declarative/listview/highlight.qml b/examples/declarative/listview/highlight.qml index be1f62d..5e4911d 100644 --- a/examples/declarative/listview/highlight.qml +++ b/examples/declarative/listview/highlight.qml @@ -44,7 +44,7 @@ Rectangle { id: petHighlight Rectangle { width: 200; height: 50; color: "#FFFF88" - y: SpringFollow { source: list1.currentItem.y; spring: 3; damping: 0.1 } + SpringFollow on y { source: list1.currentItem.y; spring: 3; damping: 0.1 } } } ListView { diff --git a/examples/declarative/parallax/qml/Smiley.qml b/examples/declarative/parallax/qml/Smiley.qml index 81eadda..4442d5e 100644 --- a/examples/declarative/parallax/qml/Smiley.qml +++ b/examples/declarative/parallax/qml/Smiley.qml @@ -24,7 +24,7 @@ Item { // Animate the y property. Setting repeat to true makes the // animation repeat indefinitely, otherwise it would only run once. - y: SequentialAnimation { + SequentialAnimation on y { repeat: true // Move from minHeight to maxHeight in 300ms, using the OutExpo easing function diff --git a/examples/declarative/progressbar/content/ProgressBar.qml b/examples/declarative/progressbar/content/ProgressBar.qml index bfc801c..65c80b2 100644 --- a/examples/declarative/progressbar/content/ProgressBar.qml +++ b/examples/declarative/progressbar/content/ProgressBar.qml @@ -21,7 +21,7 @@ Item { id: highlight; radius: 1 anchors.left: parent.left; anchors.top: parent.top; anchors.bottom: parent.bottom anchors.leftMargin: 3; anchors.topMargin: 3; anchors.bottomMargin: 3 - width: EaseFollow { source: highlight.widthDest; velocity: 1200 } + EaseFollow on width { source: highlight.widthDest; velocity: 1200 } gradient: Gradient { GradientStop { id: g1; position: 0.0 } GradientStop { id: g2; position: 1.0 } diff --git a/examples/declarative/progressbar/progressbars.qml b/examples/declarative/progressbar/progressbars.qml index 6530c3d..a66d544 100644 --- a/examples/declarative/progressbar/progressbars.qml +++ b/examples/declarative/progressbar/progressbars.qml @@ -14,9 +14,9 @@ Rectangle { ProgressBar { property int r: Math.floor(Math.random() * 5000 + 1000) width: main.width - 20 - value: NumberAnimation { duration: r; from: 0; to: 100; repeat: true } - color: ColorAnimation { duration: r; from: "lightsteelblue"; to: "thistle"; repeat: true } - secondColor: ColorAnimation { duration: r; from: "steelblue"; to: "#CD96CD"; repeat: true } + NumberAnimation on value { duration: r; from: 0; to: 100; repeat: true } + ColorAnimation on color { duration: r; from: "lightsteelblue"; to: "thistle"; repeat: true } + ColorAnimation on secondColor { duration: r; from: "steelblue"; to: "#CD96CD"; repeat: true } } } } diff --git a/examples/declarative/snow/ImageBatch.qml b/examples/declarative/snow/ImageBatch.qml deleted file mode 100644 index c2a2674..0000000 --- a/examples/declarative/snow/ImageBatch.qml +++ /dev/null @@ -1,72 +0,0 @@ -import Qt 4.6 - -GridView { - id: grid - property int offset: 0 - property var ref - property bool isSelected: ref.selectedItemColumn >= offset && ref.selectedItemColumn < offset + 5 - - currentIndex: (ref.selectedItemColumn - offset) + ref.selectedItemRow * 5 - - property int imageWidth: ref.imageWidth - property int imageHeight: ref.imageHeight - - width: 5 * imageWidth - height: 4 * imageHeight - cellWidth: imageWidth - cellHeight: imageHeight - - states: State { - name: "selected"; when: grid.isSelected - PropertyChanges { target: grid; z: 150 } - } - transitions: Transition { - SequentialAnimation { - PauseAnimation { duration: 150 } - PropertyAction { properties: "z" } - } - } - model: XmlListModel { - property string tags : "" - source: "http://api.flickr.com/services/feeds/photos_public.gne?"+(tags ? "tags="+tags+"&" : "")+"format=rss2" - query: "/rss/channel/item" - namespaceDeclarations: "declare namespace media=\"http://search.yahoo.com/mrss/\";" - - XmlRole { name: "url"; query: "media:content/@url/string()" } - } - - delegate: Item { - id: root - property bool isSelected: GridView.isCurrentItem && grid.isSelected - transformOrigin: Item.Center - width: grid.imageWidth; height: grid.imageHeight; - - Image { id: flickrImage; source: url; fillMode: Image.PreserveAspectFit; smooth: true; anchors.fill: parent; - opacity: (status == Image.Ready)?1:0; opacity: Behavior { NumberAnimation { } } } - Loading { anchors.centerIn: parent; visible: flickrImage.status!=1 } - - states: State { - name: "selected" - when: root.isSelected - PropertyChanges { target: root; scale: 3; z: 100 } - } - transitions: [ - Transition { - to: "selected" - SequentialAnimation { - PauseAnimation { duration: 150 } - PropertyAction { properties: "z" } - NumberAnimation { properties: "scale"; duration: 150; } - } - }, - Transition { - from: "selected" - SequentialAnimation { - NumberAnimation { properties: "scale"; duration: 150 } - PropertyAction { properties: "z" } - } - } - ] - } -} - diff --git a/examples/declarative/snow/Loading.qml b/examples/declarative/snow/Loading.qml deleted file mode 100644 index 238d9c7..0000000 --- a/examples/declarative/snow/Loading.qml +++ /dev/null @@ -1,8 +0,0 @@ -import Qt 4.6 - -Image { - id: loading; source: "pics/loading.png"; transformOrigin: Item.Center - rotation: NumberAnimation { - id: rotationAnimation; from: 0; to: 360; running: loading.visible == true; repeat: true; duration: 900 - } -} diff --git a/examples/declarative/snow/create.js b/examples/declarative/snow/create.js deleted file mode 100644 index 2bdae4a..0000000 --- a/examples/declarative/snow/create.js +++ /dev/null @@ -1,12 +0,0 @@ -var myComponent = null; - -function createNewBlock() { - if (myComponent == null) - myComponent = createComponent("ImageBatch.qml"); - - var obj = myComponent.createObject(); - obj.parent = layout; - obj.offset = maximumColumn + 1; - obj.ref = imagePanel; - maximumColumn += 5; -} diff --git a/examples/declarative/snow/pics/loading.png b/examples/declarative/snow/pics/loading.png deleted file mode 100644 index 0296cfe..0000000 Binary files a/examples/declarative/snow/pics/loading.png and /dev/null differ diff --git a/examples/declarative/snow/snow.qml b/examples/declarative/snow/snow.qml deleted file mode 100644 index 39c9c43..0000000 --- a/examples/declarative/snow/snow.qml +++ /dev/null @@ -1,69 +0,0 @@ -import Qt 4.6 - -Rectangle { - id: imagePanel - width: 1024 - height: 768 - color: "black" - - property int maximumColumn: 4 - property int selectedItemRow: 0 - property int selectedItemColumn: 0 - - Script { source: "create.js" } - - onSelectedItemColumnChanged: if (selectedItemColumn == maximumColumn) createNewBlock(); - - property int imageWidth: 200 - property int imageHeight: 200 - - property int selectedX: selectedItemColumn * imageWidth - property int selectedY: selectedItemRow * imageHeight - - Item { - anchors.centerIn: parent - Row { - id: layout - property real targetX: -(selectedX + imageWidth / 2) - - property real targetDeform: 0 - property bool slowDeform: true - - property real deform: 0 - deform: SpringFollow { - id: deformFollow; source: layout.targetDeform; velocity: layout.slowDeform?0.1:2 - onSyncChanged: if(inSync) { layout.slowDeform = true; layout.targetDeform = 0; } - } - - ImageBatch { offset: 0; ref: imagePanel } - - x: SpringFollow { source: layout.targetX; velocity: 1000 } - y: SpringFollow { source: -(selectedY + imageHeight / 2); velocity: 500 } - } - - transform: Rotation { - axis.y: 1; axis.z: 0 - angle: layout.deform * -100 - } - } - - Script { - function left() { - if (selectedItemColumn <= 0) return; - selectedItemColumn -= 1; - layout.slowDeform = false; - layout.targetDeform = Math.max(Math.min(layout.deform - 0.1, -0.1), -0.4); - } - function right() { - selectedItemColumn += 1; - layout.slowDeform = false; - layout.targetDeform = Math.min(Math.max(layout.deform + 0.1, 0.1), 0.4); - } - } - - focus: true - Keys.onLeftPressed: "left()" - Keys.onRightPressed: "right()" - Keys.onUpPressed: "if (selectedItemRow > 0) selectedItemRow = selectedItemRow - 1" - Keys.onDownPressed: "if (selectedItemRow < 3) selectedItemRow = selectedItemRow + 1" -} diff --git a/examples/declarative/tutorials/samegame/samegame3/Dialog.qml b/examples/declarative/tutorials/samegame/samegame3/Dialog.qml index 9d35832..36178ec 100644 --- a/examples/declarative/tutorials/samegame/samegame3/Dialog.qml +++ b/examples/declarative/tutorials/samegame/samegame3/Dialog.qml @@ -14,7 +14,7 @@ Rectangle { signal closed(); color: "white"; border.width: 1; width: myText.width + 20; height: 60; opacity: 0 - opacity: Behavior { + Behavior on opacity { NumberAnimation { duration: 1000 } } Text { id: myText; anchors.centerIn: parent; text: "Hello World!" } diff --git a/examples/declarative/tutorials/samegame/samegame4/content/BoomBlock.qml b/examples/declarative/tutorials/samegame/samegame4/content/BoomBlock.qml index 4c2ba43..1e3a0ed 100644 --- a/examples/declarative/tutorials/samegame/samegame4/content/BoomBlock.qml +++ b/examples/declarative/tutorials/samegame/samegame4/content/BoomBlock.qml @@ -8,8 +8,8 @@ Item { id:block property int targetX: 0 property int targetY: 0 - x: SpringFollow { enabled: spawned; source: targetX; spring: 2; damping: 0.2 } - y: SpringFollow { source: targetY; spring: 2; damping: 0.2 } + SpringFollow on x { enabled: spawned; source: targetX; spring: 2; damping: 0.2 } + SpringFollow on y { source: targetY; spring: 2; damping: 0.2 } //![1] //![2] @@ -24,7 +24,7 @@ Item { id:block } } opacity: 0 - opacity: Behavior { NumberAnimation { properties:"opacity"; duration: 200 } } + Behavior on opacity { NumberAnimation { properties:"opacity"; duration: 200 } } anchors.fill: parent } //![2] diff --git a/examples/declarative/tutorials/samegame/samegame4/content/Dialog.qml b/examples/declarative/tutorials/samegame/samegame4/content/Dialog.qml index ed9fd32..831c03b 100644 --- a/examples/declarative/tutorials/samegame/samegame4/content/Dialog.qml +++ b/examples/declarative/tutorials/samegame/samegame4/content/Dialog.qml @@ -13,7 +13,7 @@ Rectangle { signal closed(); color: "white"; border.width: 1; width: myText.width + 20; height: 60; opacity: 0 - opacity: Behavior { + Behavior on opacity { NumberAnimation { duration: 1000 } } Text { id: myText; anchors.centerIn: parent; text: "Hello World!" } diff --git a/examples/declarative/tvtennis/tvtennis.qml b/examples/declarative/tvtennis/tvtennis.qml index 4bd5319..1585c7b 100644 --- a/examples/declarative/tvtennis/tvtennis.qml +++ b/examples/declarative/tvtennis/tvtennis.qml @@ -16,7 +16,7 @@ Rectangle { x: 20; width: 20; height: 20; z: 1 // Move the ball to the right and back to the left repeatedly - x: SequentialAnimation { + SequentialAnimation on x { repeat: true NumberAnimation { to: page.width - 40; duration: 2000 } ScriptAction { script: Qt.playSound('paddle.wav') } @@ -27,7 +27,7 @@ Rectangle { } // Make y follow the target y coordinate, with a velocity of 200 - y: SpringFollow { source: ball.targetY; velocity: 200 } + SpringFollow on y { source: ball.targetY; velocity: 200 } // Detect the ball hitting the top or bottom of the view and bounce it onYChanged: { @@ -47,7 +47,7 @@ Rectangle { id: leftBat color: "Lime" x: 2; width: 20; height: 90 - y: SpringFollow { + SpringFollow on y { source: ball.y - 45; velocity: 300 enabled: ball.direction == 'left' } @@ -56,7 +56,7 @@ Rectangle { id: rightBat color: "Lime" x: page.width - 22; width: 20; height: 90 - y: SpringFollow { + SpringFollow on y { source: ball.y-45; velocity: 300 enabled: ball.direction == 'right' } diff --git a/examples/declarative/velocity/Day.qml b/examples/declarative/velocity/Day.qml index c39f99b..7424f60 100644 --- a/examples/declarative/velocity/Day.qml +++ b/examples/declarative/velocity/Day.qml @@ -24,7 +24,7 @@ Rectangle { id: stickyPage x: Math.random() * 200 + 100 y: Math.random() * 300 + 50 - rotation: SpringFollow { + SpringFollow on rotation { source: -flickable.horizontalVelocity / 100 spring: 2.0; damping: 0.1 } diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp index 5da207d..a9809c0 100644 --- a/src/declarative/qml/qdeclarativecompiler.cpp +++ b/src/declarative/qml/qdeclarativecompiler.cpp @@ -718,6 +718,7 @@ bool QDeclarativeCompiler::buildObject(Object *obj, const BindingContext &ctxt) BindingContext objCtxt(obj); // Create the synthesized meta object, ignoring aliases + COMPILE_CHECK(checkDynamicMeta(obj)); COMPILE_CHECK(mergeDynamicMetaProperties(obj)); COMPILE_CHECK(buildDynamicMeta(obj, IgnoreAliases)); @@ -1623,6 +1624,10 @@ void QDeclarativeCompiler::genPropertyAssignment(QDeclarativeParser::Property *p for (int ii = 0; ii < prop->values.count(); ++ii) { QDeclarativeParser::Value *v = prop->values.at(ii); + Q_ASSERT(v->type == Value::CreatedObject || + v->type == Value::PropertyBinding || + v->type == Value::Literal); + if (v->type == Value::CreatedObject) { genObject(v->object); @@ -1652,7 +1657,27 @@ void QDeclarativeCompiler::genPropertyAssignment(QDeclarativeParser::Property *p output->bytecode << store; } - } else if (v->type == Value::ValueSource) { + } else if (v->type == Value::PropertyBinding) { + + genBindingAssignment(v, prop, obj, valueTypeProperty); + + } else if (v->type == Value::Literal) { + + QMetaProperty mp = obj->metaObject()->property(prop->index); + genLiteralAssignment(mp, v); + + } + + } + + for (int ii = 0; ii < prop->onValues.count(); ++ii) { + + QDeclarativeParser::Value *v = prop->onValues.at(ii); + + Q_ASSERT(v->type == Value::ValueSource || + v->type == Value::ValueInterceptor); + + if (v->type == Value::ValueSource) { genObject(v->object); QDeclarativeInstruction store; @@ -1685,16 +1710,6 @@ void QDeclarativeCompiler::genPropertyAssignment(QDeclarativeParser::Property *p QDeclarativeType *valueType = toQmlType(v->object); store.assignValueInterceptor.castValue = valueType->propertyValueInterceptorCast(); output->bytecode << store; - - } else if (v->type == Value::PropertyBinding) { - - genBindingAssignment(v, prop, obj, valueTypeProperty); - - } else if (v->type == Value::Literal) { - - QMetaProperty mp = obj->metaObject()->property(prop->index); - genLiteralAssignment(mp, v); - } } @@ -1793,8 +1808,8 @@ bool QDeclarativeCompiler::buildAttachedProperty(QDeclarativeParser::Property *p // } // font is a nested property. pointSize and family are not. bool QDeclarativeCompiler::buildGroupedProperty(QDeclarativeParser::Property *prop, - QDeclarativeParser::Object *obj, - const BindingContext &ctxt) + QDeclarativeParser::Object *obj, + const BindingContext &ctxt) { Q_ASSERT(prop->type != 0); Q_ASSERT(prop->index != -1); @@ -1829,9 +1844,9 @@ bool QDeclarativeCompiler::buildGroupedProperty(QDeclarativeParser::Property *pr } bool QDeclarativeCompiler::buildValueTypeProperty(QObject *type, - QDeclarativeParser::Object *obj, - QDeclarativeParser::Object *baseObj, - const BindingContext &ctxt) + QDeclarativeParser::Object *obj, + QDeclarativeParser::Object *baseObj, + const BindingContext &ctxt) { if (obj->defaultProperty) COMPILE_EXCEPTION(obj, QCoreApplication::translate("QDeclarativeCompiler","Invalid property use")); @@ -1848,37 +1863,36 @@ bool QDeclarativeCompiler::buildValueTypeProperty(QObject *type, if (prop->value) COMPILE_EXCEPTION(prop, QCoreApplication::translate("QDeclarativeCompiler","Property assignment expected")); - if (prop->values.count() != 1) + if (prop->values.count() > 1) { COMPILE_EXCEPTION(prop, QCoreApplication::translate("QDeclarativeCompiler","Single property assignment expected")); + } else if (prop->values.count()) { + Value *value = prop->values.at(0); - Value *value = prop->values.at(0); - - if (value->object) { - bool isPropertyValue = output->types.at(value->object->type).type->propertyValueSourceCast() != -1; - bool isPropertyInterceptor = output->types.at(value->object->type).type->propertyValueInterceptorCast() != -1; - if (!isPropertyValue && !isPropertyInterceptor) { + if (value->object) { COMPILE_EXCEPTION(prop, QCoreApplication::translate("QDeclarativeCompiler","Unexpected object assignment")); - } else { - COMPILE_CHECK(buildObject(value->object, ctxt)); - - if (isPropertyInterceptor && baseObj->synthdata.isEmpty()) - buildDynamicMeta(baseObj, ForceCreation); - value->type = isPropertyValue ? Value::ValueSource : Value::ValueInterceptor; + } else if (value->value.isScript()) { + // ### Check for writability + BindingReference reference; + reference.expression = value->value; + reference.property = prop; + reference.value = value; + reference.bindingContext = ctxt; + reference.bindingContext.owner++; + addBindingReference(reference); + value->type = Value::PropertyBinding; + } else { + COMPILE_CHECK(testLiteralAssignment(p, value)); + value->type = Value::Literal; } - } else if (value->value.isScript()) { - // ### Check for writability - BindingReference reference; - reference.expression = value->value; - reference.property = prop; - reference.value = value; - reference.bindingContext = ctxt; - reference.bindingContext.owner++; - addBindingReference(reference); - value->type = Value::PropertyBinding; - } else { - COMPILE_CHECK(testLiteralAssignment(p, value)); - value->type = Value::Literal; } + + for (int ii = 0; ii < prop->onValues.count(); ++ii) { + Value *v = prop->onValues.at(ii); + Q_ASSERT(v->object); + + COMPILE_CHECK(buildPropertyOnAssignment(prop, obj, baseObj, v, ctxt)); + } + obj->addValueProperty(prop); } @@ -1886,13 +1900,11 @@ bool QDeclarativeCompiler::buildValueTypeProperty(QObject *type, } // Build assignments to QML lists. QML lists are properties of type -// QList * and QDeclarativeList *. -// -// QList * types can accept a list of objects, or a single binding -// QDeclarativeList * types can accept a list of objects +// QDeclarativeListProperty. List properties can accept a list of +// objects, or a single binding. bool QDeclarativeCompiler::buildListProperty(QDeclarativeParser::Property *prop, - QDeclarativeParser::Object *obj, - const BindingContext &ctxt) + QDeclarativeParser::Object *obj, + const BindingContext &ctxt) { Q_ASSERT(QDeclarativeEnginePrivate::get(engine)->isList(prop->type)); @@ -1950,20 +1962,6 @@ bool QDeclarativeCompiler::buildScriptStringProperty(QDeclarativeParser::Propert } // Compile regular property assignments of the form "property: " -// -// ### The following problems exist -// -// There is no distinction between how "lists" of values are specified. This -// Item { -// children: Item {} -// children: Item {} -// } -// is identical to -// Item { -// children: [ Item {}, Item {} ] -// } -// -// We allow assignming multiple values to single value properties bool QDeclarativeCompiler::buildPropertyAssignment(QDeclarativeParser::Property *prop, QDeclarativeParser::Object *obj, const BindingContext &ctxt) @@ -1983,14 +1981,21 @@ bool QDeclarativeCompiler::buildPropertyAssignment(QDeclarativeParser::Property } } + for (int ii = 0; ii < prop->onValues.count(); ++ii) { + Value *v = prop->onValues.at(ii); + + Q_ASSERT(v->object); + COMPILE_CHECK(buildPropertyOnAssignment(prop, obj, obj, v, ctxt)); + } + return true; } // Compile assigning a single object instance to a regular property bool QDeclarativeCompiler::buildPropertyObjectAssignment(QDeclarativeParser::Property *prop, - QDeclarativeParser::Object *obj, - QDeclarativeParser::Value *v, - const BindingContext &ctxt) + QDeclarativeParser::Object *obj, + QDeclarativeParser::Value *v, + const BindingContext &ctxt) { Q_ASSERT(prop->index != -1); Q_ASSERT(v->object->type != -1); @@ -2019,15 +2024,6 @@ bool QDeclarativeCompiler::buildPropertyObjectAssignment(QDeclarativeParser::Pro v->object->metatype = output->types.at(v->object->type).metaObject(); Q_ASSERT(v->object->metaObject()); - // Will be true if the assigned type inherits QDeclarativePropertyValueSource - bool isPropertyValue = false; - // Will be true if the assigned type inherits QDeclarativePropertyValueInterceptor - bool isPropertyInterceptor = false; - if (QDeclarativeType *valueType = toQmlType(v->object)) { - isPropertyValue = valueType->propertyValueSourceCast() != -1; - isPropertyInterceptor = valueType->propertyValueInterceptorCast() != -1; - } - // We want to raw metaObject here as the raw metaobject is the // actual property type before we applied any extensions that might // effect the properties on the type, but don't effect assignability @@ -2063,13 +2059,6 @@ bool QDeclarativeCompiler::buildPropertyObjectAssignment(QDeclarativeParser::Pro component->getDefaultProperty()->addValue(componentValue); v->object = component; COMPILE_CHECK(buildPropertyObjectAssignment(prop, obj, v, ctxt)); - } else if (isPropertyValue || isPropertyInterceptor) { - // Assign as a property value source - COMPILE_CHECK(buildObject(v->object, ctxt)); - - if (isPropertyInterceptor && prop->parent->synthdata.isEmpty()) - buildDynamicMeta(prop->parent, ForceCreation); - v->type = isPropertyValue ? Value::ValueSource : Value::ValueInterceptor; } else { COMPILE_EXCEPTION(v->object, QCoreApplication::translate("QDeclarativeCompiler","Cannot assign object to property")); } @@ -2078,6 +2067,55 @@ bool QDeclarativeCompiler::buildPropertyObjectAssignment(QDeclarativeParser::Pro return true; } +// Compile assigning a single object instance to a regular property using the "on" syntax. +// +// For example: +// Item { +// NumberAnimation on x { } +// } +bool QDeclarativeCompiler::buildPropertyOnAssignment(QDeclarativeParser::Property *prop, + QDeclarativeParser::Object *obj, + QDeclarativeParser::Object *baseObj, + QDeclarativeParser::Value *v, + const BindingContext &ctxt) +{ + Q_ASSERT(prop->index != -1); + Q_ASSERT(v->object->type != -1); + + if (!obj->metaObject()->property(prop->index).isWritable()) + COMPILE_EXCEPTION(v, QCoreApplication::translate("QDeclarativeCompiler","Invalid property assignment: \"%1\" is a read-only property").arg(QString::fromUtf8(prop->name))); + + + // Normally buildObject() will set this up, but we need the static + // meta object earlier to test for assignability. It doesn't matter + // that there may still be outstanding synthesized meta object changes + // on this type, as they are not relevant for assignability testing + v->object->metatype = output->types.at(v->object->type).metaObject(); + Q_ASSERT(v->object->metaObject()); + + // Will be true if the assigned type inherits QDeclarativePropertyValueSource + bool isPropertyValue = false; + // Will be true if the assigned type inherits QDeclarativePropertyValueInterceptor + bool isPropertyInterceptor = false; + if (QDeclarativeType *valueType = toQmlType(v->object)) { + isPropertyValue = valueType->propertyValueSourceCast() != -1; + isPropertyInterceptor = valueType->propertyValueInterceptorCast() != -1; + } + + if (isPropertyValue || isPropertyInterceptor) { + // Assign as a property value source + COMPILE_CHECK(buildObject(v->object, ctxt)); + + if (isPropertyInterceptor && prop->parent->synthdata.isEmpty()) + buildDynamicMeta(baseObj, ForceCreation); + v->type = isPropertyValue ? Value::ValueSource : Value::ValueInterceptor; + } else { + COMPILE_EXCEPTION(v, QCoreApplication::translate("QDeclarativeCompiler","\"%1\" cannot operate on \"%2\"").arg(v->object->typeName.constData()).arg(prop->name.constData())); + } + + return true; +} + // Compile assigning a literal or binding to a regular property bool QDeclarativeCompiler::buildPropertyLiteralAssignment(QDeclarativeParser::Property *prop, QDeclarativeParser::Object *obj, @@ -2203,10 +2241,13 @@ bool QDeclarativeCompiler::mergeDynamicMetaProperties(QDeclarativeParser::Object continue; Property *property = 0; - if (p.isDefaultProperty) + if (p.isDefaultProperty) { property = obj->getDefaultProperty(); - else + } else { property = obj->getProperty(p.name); + if (!property->values.isEmpty()) + COMPILE_EXCEPTION(property, QCoreApplication::translate("QDeclarativeCompiler","Property value set multiple times")); + } if (property->value) COMPILE_EXCEPTION(property, QCoreApplication::translate("QDeclarativeCompiler","Invalid property nesting")); @@ -2233,8 +2274,6 @@ bool QDeclarativeCompiler::buildDynamicMeta(QDeclarativeParser::Object *obj, Dyn obj->dynamicSlots.isEmpty()) return true; - COMPILE_CHECK(checkDynamicMeta(obj)); - QByteArray dynamicData(sizeof(QDeclarativeVMEMetaData), (char)0); QByteArray newClassName = obj->metatype->className(); diff --git a/src/declarative/qml/qdeclarativecompiler_p.h b/src/declarative/qml/qdeclarativecompiler_p.h index 2ea3366..93a3f83 100644 --- a/src/declarative/qml/qdeclarativecompiler_p.h +++ b/src/declarative/qml/qdeclarativecompiler_p.h @@ -219,6 +219,11 @@ private: QDeclarativeParser::Object *obj, QDeclarativeParser::Value *value, const BindingContext &ctxt); + bool buildPropertyOnAssignment(QDeclarativeParser::Property *prop, + QDeclarativeParser::Object *obj, + QDeclarativeParser::Object *baseObj, + QDeclarativeParser::Value *value, + const BindingContext &ctxt); bool buildPropertyLiteralAssignment(QDeclarativeParser::Property *prop, QDeclarativeParser::Object *obj, QDeclarativeParser::Value *value, diff --git a/src/declarative/qml/qdeclarativedom.cpp b/src/declarative/qml/qdeclarativedom.cpp index 6c81f34..5b43109 100644 --- a/src/declarative/qml/qdeclarativedom.cpp +++ b/src/declarative/qml/qdeclarativedom.cpp @@ -374,7 +374,10 @@ QDeclarativeDomValue QDeclarativeDomProperty::value() const QDeclarativeDomValue rv; if (d->property) { rv.d->property = d->property; - rv.d->value = d->property->values.at(0); + if (d->property->values.count()) + rv.d->value = d->property->values.at(0); + else + rv.d->value = d->property->onValues.at(0); rv.d->property->addref(); rv.d->value->addref(); } @@ -1346,7 +1349,7 @@ QDeclarativeDomValue::Type QDeclarativeDomValue::type() const { if (d->property) if (QDeclarativeMetaType::isList(d->property->type) || - (d->property && d->property->values.count() > 1)) + (d->property && (d->property->values.count() + d->property->onValues.count()) > 1)) return List; QDeclarativeParser::Value *value = d->value; @@ -1628,6 +1631,13 @@ QList QDeclarativeDomList::values() const rv << v; } + for (int ii = 0; ii < d->property->onValues.count(); ++ii) { + QDeclarativeDomValue v; + v.d->value = d->property->onValues.at(ii); + v.d->value->addref(); + rv << v; + } + return rv; } diff --git a/src/declarative/qml/qdeclarativeparser.cpp b/src/declarative/qml/qdeclarativeparser.cpp index 5ac49d5..0e3d856 100644 --- a/src/declarative/qml/qdeclarativeparser.cpp +++ b/src/declarative/qml/qdeclarativeparser.cpp @@ -221,6 +221,8 @@ QDeclarativeParser::Property::~Property() { foreach(Value *value, values) value->release(); + foreach(Value *value, onValues) + value->release(); if (value) value->release(); } @@ -235,9 +237,14 @@ void QDeclarativeParser::Property::addValue(Value *v) values << v; } +void QDeclarativeParser::Property::addOnValue(Value *v) +{ + onValues << v; +} + bool QDeclarativeParser::Property::isEmpty() const { - return !value && values.isEmpty(); + return !value && values.isEmpty() && onValues.isEmpty(); } QDeclarativeParser::Value::Value() diff --git a/src/declarative/qml/qdeclarativeparser_p.h b/src/declarative/qml/qdeclarativeparser_p.h index aae507e..d0d7de1 100644 --- a/src/declarative/qml/qdeclarativeparser_p.h +++ b/src/declarative/qml/qdeclarativeparser_p.h @@ -320,6 +320,7 @@ namespace QDeclarativeParser Object *getValue(); void addValue(Value *v); + void addOnValue(Value *v); // The QVariant::Type of the property, or 0 (QVariant::Invalid) if // unknown. @@ -333,6 +334,8 @@ namespace QDeclarativeParser // The list of values assigned to this property. Content in values // and value are mutually exclusive QList values; + // The list of values assigned to this property using the "on" syntax + QList onValues; // The accessed property. This is used to represent dot properties. // Content in value and values are mutually exclusive. Object *value; diff --git a/src/declarative/qml/qdeclarativescriptparser.cpp b/src/declarative/qml/qdeclarativescriptparser.cpp index f4c9cdd..a4b3668 100644 --- a/src/declarative/qml/qdeclarativescriptparser.cpp +++ b/src/declarative/qml/qdeclarativescriptparser.cpp @@ -106,12 +106,12 @@ public: void operator()(const QString &code, AST::Node *node); protected: - Object *defineObjectBinding(AST::UiQualifiedId *propertyName, + Object *defineObjectBinding(AST::UiQualifiedId *propertyName, bool onAssignment, AST::UiQualifiedId *objectTypeName, LocationSpan location, AST::UiObjectInitializer *initializer = 0); - Object *defineObjectBinding_helper(AST::UiQualifiedId *propertyName, + Object *defineObjectBinding_helper(AST::UiQualifiedId *propertyName, bool onAssignment, const QString &objectType, AST::SourceLocation typeLocation, LocationSpan location, @@ -243,6 +243,7 @@ QString ProcessAST::asString(AST::UiQualifiedId *node) const Object * ProcessAST::defineObjectBinding_helper(AST::UiQualifiedId *propertyName, + bool onAssignment, const QString &objectType, AST::SourceLocation typeLocation, LocationSpan location, @@ -254,10 +255,19 @@ ProcessAST::defineObjectBinding_helper(AST::UiQualifiedId *propertyName, (lastTypeDot >= 0 && objectType.at(lastTypeDot+1).isUpper())); int propertyCount = 0; - for (; propertyName; propertyName = propertyName->next){ + for (AST::UiQualifiedId *name = propertyName; name; name = name->next){ ++propertyCount; - _stateStack.pushProperty(propertyName->name->asString(), - this->location(propertyName)); + _stateStack.pushProperty(name->name->asString(), + this->location(name)); + } + + if (!onAssignment && propertyCount && currentProperty() && currentProperty()->values.count()) { + QDeclarativeError error; + error.setDescription(QCoreApplication::translate("QDeclarativeParser","Property value set multiple times")); + error.setLine(this->location(propertyName).start.line); + error.setColumn(this->location(propertyName).start.column); + _parser->_errors << error; + return 0; } if (!isType) { @@ -327,7 +337,10 @@ ProcessAST::defineObjectBinding_helper(AST::UiQualifiedId *propertyName, Value *v = new Value; v->object = obj; v->location = obj->location; - prop->addValue(v); + if (onAssignment) + prop->addOnValue(v); + else + prop->addValue(v); while (propertyCount--) _stateStack.pop(); @@ -363,7 +376,7 @@ ProcessAST::defineObjectBinding_helper(AST::UiQualifiedId *propertyName, } } -Object *ProcessAST::defineObjectBinding(AST::UiQualifiedId *qualifiedId, +Object *ProcessAST::defineObjectBinding(AST::UiQualifiedId *qualifiedId, bool onAssignment, AST::UiQualifiedId *objectTypeName, LocationSpan location, AST::UiObjectInitializer *initializer) @@ -395,7 +408,7 @@ Object *ProcessAST::defineObjectBinding(AST::UiQualifiedId *qualifiedId, } - return defineObjectBinding_helper(qualifiedId, objectType, typeLocation, location, initializer); + return defineObjectBinding_helper(qualifiedId, onAssignment, objectType, typeLocation, location, initializer); } LocationSpan ProcessAST::location(AST::UiQualifiedId *id) @@ -623,7 +636,7 @@ bool ProcessAST::visit(AST::UiObjectDefinition *node) LocationSpan l = location(node->firstSourceLocation(), node->lastSourceLocation()); - defineObjectBinding(/*propertyName = */ 0, + defineObjectBinding(/*propertyName = */ 0, false, node->qualifiedTypeNameId, l, node->initializer); @@ -638,7 +651,7 @@ bool ProcessAST::visit(AST::UiObjectBinding *node) LocationSpan l = location(node->qualifiedTypeNameId->identifierToken, node->initializer->rbraceToken); - defineObjectBinding(node->qualifiedId, + defineObjectBinding(node->qualifiedId, node->hasOnToken, node->qualifiedTypeNameId, l, node->initializer); @@ -674,14 +687,23 @@ bool ProcessAST::visit(AST::UiScriptBinding *node) { int propertyCount = 0; AST::UiQualifiedId *propertyName = node->qualifiedId; - for (; propertyName; propertyName = propertyName->next){ + for (AST::UiQualifiedId *name = propertyName; name; name = name->next){ ++propertyCount; - _stateStack.pushProperty(propertyName->name->asString(), - location(propertyName)); + _stateStack.pushProperty(name->name->asString(), + location(name)); } Property *prop = currentProperty(); + if (prop->values.count()) { + QDeclarativeError error; + error.setDescription(QCoreApplication::translate("QDeclarativeParser","Property value set multiple times")); + error.setLine(this->location(propertyName).start.line); + error.setColumn(this->location(propertyName).start.column); + _parser->_errors << error; + return 0; + } + QDeclarativeParser::Variant primitive; if (AST::ExpressionStatement *stmt = AST::cast(node->statement)) { @@ -724,16 +746,26 @@ bool ProcessAST::visit(AST::UiArrayBinding *node) { int propertyCount = 0; AST::UiQualifiedId *propertyName = node->qualifiedId; - for (; propertyName; propertyName = propertyName->next){ + for (AST::UiQualifiedId *name = propertyName; name; name = name->next){ ++propertyCount; - _stateStack.pushProperty(propertyName->name->asString(), - location(propertyName)); + _stateStack.pushProperty(name->name->asString(), + location(name)); + } + + Property* prop = currentProperty(); + + if (prop->values.count()) { + QDeclarativeError error; + error.setDescription(QCoreApplication::translate("QDeclarativeParser","Property value set multiple times")); + error.setLine(this->location(propertyName).start.line); + error.setColumn(this->location(propertyName).start.column); + _parser->_errors << error; + return 0; } accept(node->members); // For the DOM, store the position of the T_LBRACKET upto the T_RBRACKET as the range: - Property* prop = currentProperty(); prop->listValueRange.offset = node->lbracketToken.offset; prop->listValueRange.length = node->rbracketToken.offset + node->rbracketToken.length - node->lbracketToken.offset; diff --git a/tests/auto/declarative/examples/tst_examples.cpp b/tests/auto/declarative/examples/tst_examples.cpp index 6160e7c..106a4e0 100644 --- a/tests/auto/declarative/examples/tst_examples.cpp +++ b/tests/auto/declarative/examples/tst_examples.cpp @@ -190,7 +190,6 @@ void tst_examples::examples() << "-scriptopts" << "play,testerror,exitoncomplete,exitonfailure" << file; QProcess p; -qDebug() << qmlruntime << arguments; p.start(qmlruntime, arguments); QVERIFY(p.waitForFinished()); QCOMPARE(p.exitStatus(), QProcess::NormalExit); diff --git a/tests/auto/declarative/qdeclarativeanimations/data/badtype1.qml b/tests/auto/declarative/qdeclarativeanimations/data/badtype1.qml index 6381df3..2629cf4 100644 --- a/tests/auto/declarative/qdeclarativeanimations/data/badtype1.qml +++ b/tests/auto/declarative/qdeclarativeanimations/data/badtype1.qml @@ -7,6 +7,6 @@ Rectangle { color: "red" width: 50; height: 50 x: 100; y: 100 - x: PropertyAnimation { from: "blue"; to: "green"; } + PropertyAnimation on x { from: "blue"; to: "green"; } } } diff --git a/tests/auto/declarative/qdeclarativeanimations/data/badtype2.qml b/tests/auto/declarative/qdeclarativeanimations/data/badtype2.qml index 8d57e41..1543a2a 100644 --- a/tests/auto/declarative/qdeclarativeanimations/data/badtype2.qml +++ b/tests/auto/declarative/qdeclarativeanimations/data/badtype2.qml @@ -7,6 +7,6 @@ Rectangle { color: "red" width: 50; height: 50 x: 100; y: 100 - x: NumberAnimation { from: "blue"; to: "green"; } + NumberAnimation on x { from: "blue"; to: "green"; } } } diff --git a/tests/auto/declarative/qdeclarativeanimations/data/badtype3.qml b/tests/auto/declarative/qdeclarativeanimations/data/badtype3.qml index c4867c3..aa98c33 100644 --- a/tests/auto/declarative/qdeclarativeanimations/data/badtype3.qml +++ b/tests/auto/declarative/qdeclarativeanimations/data/badtype3.qml @@ -5,7 +5,7 @@ Rectangle { height: 320 Rectangle { color: "red" - color: ColorAnimation { from: 10; to: 15; } + ColorAnimation on color { from: 10; to: 15; } width: 50; height: 50 x: 100; y: 100 } diff --git a/tests/auto/declarative/qdeclarativeanimations/data/dontAutoStart.qml b/tests/auto/declarative/qdeclarativeanimations/data/dontAutoStart.qml index d9660b6..3f00e68 100644 --- a/tests/auto/declarative/qdeclarativeanimations/data/dontAutoStart.qml +++ b/tests/auto/declarative/qdeclarativeanimations/data/dontAutoStart.qml @@ -9,7 +9,7 @@ Rectangle { id: redRect width: 100; height: 100 color: Qt.rgba(1,0,0) - x: Behavior { + Behavior on x { NumberAnimation { objectName: "MyAnim"; target: redRect; property: "y"; to: 300; repeat: true} } diff --git a/tests/auto/declarative/qdeclarativeanimations/data/dontStart.qml b/tests/auto/declarative/qdeclarativeanimations/data/dontStart.qml index 36417db..efed058 100644 --- a/tests/auto/declarative/qdeclarativeanimations/data/dontStart.qml +++ b/tests/auto/declarative/qdeclarativeanimations/data/dontStart.qml @@ -9,7 +9,7 @@ Rectangle { id: redRect width: 100; height: 100 color: Qt.rgba(1,0,0) - x: SequentialAnimation { + SequentialAnimation on x { running: false NumberAnimation { objectName: "MyAnim"; running: true } } diff --git a/tests/auto/declarative/qdeclarativeanimations/data/properties.qml b/tests/auto/declarative/qdeclarativeanimations/data/properties.qml index 7e73f57..4437815 100644 --- a/tests/auto/declarative/qdeclarativeanimations/data/properties.qml +++ b/tests/auto/declarative/qdeclarativeanimations/data/properties.qml @@ -9,6 +9,6 @@ Rectangle { color: "red" width: 50; height: 50 x: 100; y: 100 - x: NumberAnimation { to: 200 } + NumberAnimation on x { to: 200 } } } diff --git a/tests/auto/declarative/qdeclarativeanimations/data/properties2.qml b/tests/auto/declarative/qdeclarativeanimations/data/properties2.qml index 6c96155..b1f2020 100644 --- a/tests/auto/declarative/qdeclarativeanimations/data/properties2.qml +++ b/tests/auto/declarative/qdeclarativeanimations/data/properties2.qml @@ -9,6 +9,6 @@ Rectangle { color: "red" width: 50; height: 50 x: 100; y: 100 - x: NumberAnimation { targets: theRect; properties: "x"; to: 200; } + NumberAnimation on x { targets: theRect; properties: "x"; to: 200; } } } diff --git a/tests/auto/declarative/qdeclarativeanimations/data/properties3.qml b/tests/auto/declarative/qdeclarativeanimations/data/properties3.qml index ff08885..0a0ed6f 100644 --- a/tests/auto/declarative/qdeclarativeanimations/data/properties3.qml +++ b/tests/auto/declarative/qdeclarativeanimations/data/properties3.qml @@ -9,6 +9,6 @@ Rectangle { color: "red" width: 50; height: 50 x: 100; y: 100 - x: NumberAnimation { target: theRect; property: "x"; to: 300; } + NumberAnimation on x { target: theRect; property: "x"; to: 300; } } } diff --git a/tests/auto/declarative/qdeclarativeanimations/data/properties4.qml b/tests/auto/declarative/qdeclarativeanimations/data/properties4.qml index dab7e5f..a90f004 100644 --- a/tests/auto/declarative/qdeclarativeanimations/data/properties4.qml +++ b/tests/auto/declarative/qdeclarativeanimations/data/properties4.qml @@ -9,6 +9,6 @@ Rectangle { color: "red" width: 50; height: 50 x: 100; y: 100 - x: NumberAnimation { target: theRect; property: "y"; to: 200; } + NumberAnimation on x { target: theRect; property: "y"; to: 200; } } } diff --git a/tests/auto/declarative/qdeclarativeanimations/data/properties5.qml b/tests/auto/declarative/qdeclarativeanimations/data/properties5.qml index 38396b1..7d3cec9 100644 --- a/tests/auto/declarative/qdeclarativeanimations/data/properties5.qml +++ b/tests/auto/declarative/qdeclarativeanimations/data/properties5.qml @@ -9,6 +9,6 @@ Rectangle { color: "red" width: 50; height: 50 x: 100; y: 100 - x: NumberAnimation { targets: theRect; properties: "y"; to: 200; } + NumberAnimation on x { targets: theRect; properties: "y"; to: 200; } } } diff --git a/tests/auto/declarative/qdeclarativeanimations/data/valuesource.qml b/tests/auto/declarative/qdeclarativeanimations/data/valuesource.qml index c35063d..2260440 100644 --- a/tests/auto/declarative/qdeclarativeanimations/data/valuesource.qml +++ b/tests/auto/declarative/qdeclarativeanimations/data/valuesource.qml @@ -9,6 +9,6 @@ Rectangle { color: "red" width: 50; height: 50 x: 100; y: 100 - x: NumberAnimation { id: anim; objectName: "MyAnim"; to: 200 } + NumberAnimation on x { id: anim; objectName: "MyAnim"; to: 200 } } } diff --git a/tests/auto/declarative/qdeclarativeanimations/data/valuesource2.qml b/tests/auto/declarative/qdeclarativeanimations/data/valuesource2.qml index 1a60542..36d6c72 100644 --- a/tests/auto/declarative/qdeclarativeanimations/data/valuesource2.qml +++ b/tests/auto/declarative/qdeclarativeanimations/data/valuesource2.qml @@ -9,6 +9,6 @@ Rectangle { color: "red" width: 50; height: 50 x: 100; y: 100 - x: NumberAnimation { id: anim; objectName: "MyAnim"; running: false; to: 200 } + NumberAnimation on x { id: anim; objectName: "MyAnim"; running: false; to: 200 } } } diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/binding.qml b/tests/auto/declarative/qdeclarativebehaviors/data/binding.qml index 201da37..e982f21 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/data/binding.qml +++ b/tests/auto/declarative/qdeclarativebehaviors/data/binding.qml @@ -9,7 +9,7 @@ Rectangle { objectName: "MyRect" width: 100; height: 100; color: "green" x: basex - x: Behavior { NumberAnimation { duration: 500; } } + Behavior on x { NumberAnimation { duration: 500; } } } MouseArea { id: clicker diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/color.qml b/tests/auto/declarative/qdeclarativebehaviors/data/color.qml index 91dbbd1..f2f4742 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/data/color.qml +++ b/tests/auto/declarative/qdeclarativebehaviors/data/color.qml @@ -7,7 +7,7 @@ Rectangle { objectName: "MyRect" width: 100; height: 100; color: "green" - color: Behavior { ColorAnimation { duration: 500; } } + Behavior on color { ColorAnimation { duration: 500; } } } MouseArea { id: clicker diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/cpptrigger.qml b/tests/auto/declarative/qdeclarativebehaviors/data/cpptrigger.qml index 8d032f0..3ea9376 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/data/cpptrigger.qml +++ b/tests/auto/declarative/qdeclarativebehaviors/data/cpptrigger.qml @@ -6,6 +6,6 @@ Rectangle { id: rect objectName: "MyRect" width: 100; height: 100; color: "green" - x: Behavior { NumberAnimation { duration: 500; } } + Behavior on x { NumberAnimation { duration: 500; } } } } diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/disabled.qml b/tests/auto/declarative/qdeclarativebehaviors/data/disabled.qml index 3c7078a..1403eb9 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/data/disabled.qml +++ b/tests/auto/declarative/qdeclarativebehaviors/data/disabled.qml @@ -6,7 +6,7 @@ Rectangle { id: rect objectName: "MyRect" width: 100; height: 100; color: "green" - x: Behavior { + Behavior on x { objectName: "MyBehavior"; enabled: false NumberAnimation { duration: 200; } diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/dontStart.qml b/tests/auto/declarative/qdeclarativebehaviors/data/dontStart.qml index ba7cc9c..12b1b7b 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/data/dontStart.qml +++ b/tests/auto/declarative/qdeclarativebehaviors/data/dontStart.qml @@ -9,7 +9,7 @@ Rectangle { id: redRect width: 100; height: 100 color: Qt.rgba(1,0,0) - x: Behavior { + Behavior on x { NumberAnimation { objectName: "MyAnim"; running: true } } diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/empty.qml b/tests/auto/declarative/qdeclarativebehaviors/data/empty.qml index 95d934a..5e30f03 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/data/empty.qml +++ b/tests/auto/declarative/qdeclarativebehaviors/data/empty.qml @@ -6,7 +6,7 @@ Rectangle { id: rect objectName: "MyRect" width: 100; height: 100; color: "green" - x: Behavior {} + Behavior on x {} } MouseArea { id: clicker diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/explicit.qml b/tests/auto/declarative/qdeclarativebehaviors/data/explicit.qml index 1b2025a..ca0ea54 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/data/explicit.qml +++ b/tests/auto/declarative/qdeclarativebehaviors/data/explicit.qml @@ -6,7 +6,7 @@ Rectangle { id: rect objectName: "MyRect" width: 100; height: 100; color: "green" - x: Behavior { + Behavior on x { objectName: "MyBehavior"; NumberAnimation { target: rect; property: "x"; duration: 500; } } diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/groupProperty.qml b/tests/auto/declarative/qdeclarativebehaviors/data/groupProperty.qml index 14883d4..a6c4ed9 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/data/groupProperty.qml +++ b/tests/auto/declarative/qdeclarativebehaviors/data/groupProperty.qml @@ -6,7 +6,7 @@ Rectangle { id: rect objectName: "MyRect" width: 100; height: 100; color: "green" - pos: Behavior { PropertyAnimation { duration: 500; } } + Behavior on pos { PropertyAnimation { duration: 500; } } } MouseArea { id: clicker diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/groupProperty2.qml b/tests/auto/declarative/qdeclarativebehaviors/data/groupProperty2.qml index b43ddbc..2dda220 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/data/groupProperty2.qml +++ b/tests/auto/declarative/qdeclarativebehaviors/data/groupProperty2.qml @@ -6,7 +6,7 @@ Rectangle { id: rect objectName: "MyRect" width: 100; height: 100; color: "green" - pos.x: Behavior { NumberAnimation { duration: 500; } } + Behavior on pos.x { NumberAnimation { duration: 500; } } } MouseArea { id: clicker diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/loop.qml b/tests/auto/declarative/qdeclarativebehaviors/data/loop.qml index 5f2c057..6187768 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/data/loop.qml +++ b/tests/auto/declarative/qdeclarativebehaviors/data/loop.qml @@ -6,7 +6,7 @@ Rectangle { id: rect objectName: "MyRect" width: 100; height: 100; color: "green" - x: Behavior { NumberAnimation { duration: 200; } } + Behavior on x { NumberAnimation { duration: 200; } } onXChanged: x = 100; } states: State { diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/nonSelecting2.qml b/tests/auto/declarative/qdeclarativebehaviors/data/nonSelecting2.qml index f267a05..640a7d1 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/data/nonSelecting2.qml +++ b/tests/auto/declarative/qdeclarativebehaviors/data/nonSelecting2.qml @@ -6,7 +6,7 @@ Rectangle { id: rect objectName: "MyRect" width: 100; height: 100; color: "green" - x: Behavior { + Behavior on x { objectName: "MyBehavior"; NumberAnimation { targets: rect; properties: "y"; duration: 200; } } diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/parent.qml b/tests/auto/declarative/qdeclarativebehaviors/data/parent.qml index 7c7fdcb..3860ec7 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/data/parent.qml +++ b/tests/auto/declarative/qdeclarativebehaviors/data/parent.qml @@ -6,7 +6,7 @@ Rectangle { id: rect objectName: "MyRect" width: 100; height: 100; color: "green" - parent: Behavior { + Behavior on parent { SequentialAnimation { PauseAnimation { duration: 500 } PropertyAction {} diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/reassignedAnimation.qml b/tests/auto/declarative/qdeclarativebehaviors/data/reassignedAnimation.qml index ba744b1..6419a6b 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/data/reassignedAnimation.qml +++ b/tests/auto/declarative/qdeclarativebehaviors/data/reassignedAnimation.qml @@ -6,7 +6,7 @@ Rectangle { id: rect objectName: "MyRect" width: 100; height: 100; color: "green" - x: Behavior { + Behavior on x { objectName: "MyBehavior" NumberAnimation { duration: 200 } NumberAnimation { duration: 1000 } diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/scripttrigger.qml b/tests/auto/declarative/qdeclarativebehaviors/data/scripttrigger.qml index a91ca88..b22441a 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/data/scripttrigger.qml +++ b/tests/auto/declarative/qdeclarativebehaviors/data/scripttrigger.qml @@ -11,6 +11,6 @@ Rectangle { id: rect objectName: "MyRect" width: 100; height: 100; color: "green" - x: Behavior { NumberAnimation { duration: 500; } } + Behavior on x { NumberAnimation { duration: 500; } } } } diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/simple.qml b/tests/auto/declarative/qdeclarativebehaviors/data/simple.qml index ac98ed0..c28fa9a 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/data/simple.qml +++ b/tests/auto/declarative/qdeclarativebehaviors/data/simple.qml @@ -6,7 +6,7 @@ Rectangle { id: rect objectName: "MyRect" width: 100; height: 100; color: "green" - x: Behavior { + Behavior on x { objectName: "MyBehavior"; NumberAnimation { duration: 500; } } diff --git a/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp b/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp index f87330d..0bf0b81 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp +++ b/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp @@ -260,7 +260,7 @@ void tst_qdeclarativebehaviors::reassignedAnimation() { QDeclarativeEngine engine; QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/reassignedAnimation.qml")); - QTest::ignoreMessage(QtWarningMsg, QString("QML Behavior (" + QUrl::fromLocalFile(SRCDIR "/data/reassignedAnimation.qml").toString() + ":9:12) Cannot change the animation assigned to a Behavior.").toUtf8().constData()); + QTest::ignoreMessage(QtWarningMsg, QString("QML Behavior (" + QUrl::fromLocalFile(SRCDIR "/data/reassignedAnimation.qml").toString() + ":9:9) Cannot change the animation assigned to a Behavior.").toUtf8().constData()); QDeclarativeRectangle *rect = qobject_cast(c.create()); QVERIFY(rect); QCOMPARE(qobject_cast( diff --git a/tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp b/tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp index 9543280..6cd0bdb 100644 --- a/tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp +++ b/tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp @@ -274,7 +274,7 @@ void tst_qdeclarativedom::loadComposite() void tst_qdeclarativedom::testValueSource() { QByteArray qml = "import Qt 4.6\n" - "Rectangle { height: SpringFollow { spring: 1.4; damping: .15; source: Math.min(Math.max(-130, value*2.2 - 130), 133); }}"; + "Rectangle { SpringFollow on height { spring: 1.4; damping: .15; source: Math.min(Math.max(-130, value*2.2 - 130), 133); }}"; QDeclarativeEngine freshEngine; QDeclarativeDomDocument document; @@ -306,7 +306,7 @@ void tst_qdeclarativedom::testValueSource() void tst_qdeclarativedom::testValueInterceptor() { QByteArray qml = "import Qt 4.6\n" - "Rectangle { height: Behavior { NumberAnimation { duration: 100 } } }"; + "Rectangle { Behavior on height { NumberAnimation { duration: 100 } } }"; QDeclarativeEngine freshEngine; QDeclarativeDomDocument document; @@ -823,8 +823,8 @@ void tst_qdeclarativedom::copy() " property int a: 10\n" " x: 10\n" " y: x + 10\n" - " z: NumberAnimation {}\n" - " opacity: Behavior {}\n" + " NumberAnimation on z {}\n" + " Behavior on opacity {}\n" " Component {\n" " Item{}\n" " }\n" @@ -1193,18 +1193,18 @@ void tst_qdeclarativedom::copy() void tst_qdeclarativedom::position() { QByteArray qml = "import Qt 4.6\n" - /*14*/ "Item {\n" - /*21*/ " id: myItem\n" - /*36*/ " property int a: 10\n" - /*59*/ " x: 10\n" - /*69*/ " y: x + 10\n" - /*83*/ " z: NumberAnimation {}\n" - /*109*/ " opacity: Behavior {}\n" - /*134*/ " Component {\n" - /*150*/ " Item{}\n" - /*165*/ " }\n" - /*171*/ " children: [ Item{}, Item{} ]\n" - /*204*/ "}\n"; + "Item {\n" + " id: myItem\n" + " property int a: 10\n" + " x: 10\n" + " y: x + 10\n" + " NumberAnimation on z {}\n" + " Behavior on opacity {}\n" + " Component {\n" + " Item{}\n" + " }\n" + " children: [ Item{}, Item{} ]\n" + "}\n"; QDeclarativeDomDocument document; @@ -1227,19 +1227,19 @@ void tst_qdeclarativedom::position() QCOMPARE(y.length(), 1); QDeclarativeDomProperty z = root.property("z"); - QCOMPARE(z.position(), 87); + QCOMPARE(z.position(), 106); QCOMPARE(z.length(), 1); QDeclarativeDomProperty opacity = root.property("opacity"); - QCOMPARE(opacity.position(), 113); + QCOMPARE(opacity.position(), 127); QCOMPARE(opacity.length(), 7); QDeclarativeDomProperty data = root.property("data"); - QCOMPARE(data.position(), 138); + QCOMPARE(data.position(), 142); QCOMPARE(data.length(), 0); QDeclarativeDomProperty children = root.property("children"); - QCOMPARE(children.position(), 175); + QCOMPARE(children.position(), 179); QCOMPARE(children.length(), 8); QDeclarativeDomList dataList = data.value().toList(); @@ -1249,30 +1249,30 @@ void tst_qdeclarativedom::position() // All QDeclarativeDomObject QCOMPARE(root.position(), 14); - QCOMPARE(root.length(), 191); + QCOMPARE(root.length(), 195); QDeclarativeDomObject numberAnimation = z.value().toValueSource().object(); - QCOMPARE(numberAnimation.position(), 90); - QCOMPARE(numberAnimation.length(), 18); + QCOMPARE(numberAnimation.position(), 87); + QCOMPARE(numberAnimation.length(), 23); QDeclarativeDomObject behavior = opacity.value().toValueInterceptor().object(); - QCOMPARE(behavior.position(), 122); - QCOMPARE(behavior.length(), 11); + QCOMPARE(behavior.position(), 115); + QCOMPARE(behavior.length(), 22); QDeclarativeDomObject component = dataList.values().at(0).toObject(); - QCOMPARE(component.position(), 138); + QCOMPARE(component.position(), 142); QCOMPARE(component.length(), 32); QDeclarativeDomObject componentRoot = component.toComponent().componentRoot(); - QCOMPARE(componentRoot.position(), 158); + QCOMPARE(componentRoot.position(), 162); QCOMPARE(componentRoot.length(), 6); QDeclarativeDomObject child1 = childrenList.values().at(0).toObject(); - QCOMPARE(child1.position(), 187); + QCOMPARE(child1.position(), 191); QCOMPARE(child1.length(), 6); QDeclarativeDomObject child2 = childrenList.values().at(1).toObject(); - QCOMPARE(child2.position(), 195); + QCOMPARE(child2.position(), 199); QCOMPARE(child2.length(), 6); // All QDeclarativeDomValue @@ -1285,23 +1285,23 @@ void tst_qdeclarativedom::position() QCOMPARE(yValue.length(), 6); QDeclarativeDomValue zValue = z.value(); - QCOMPARE(zValue.position(), 90); - QCOMPARE(zValue.length(), 18); + QCOMPARE(zValue.position(), 87); + QCOMPARE(zValue.length(), 23); QDeclarativeDomValue opacityValue = opacity.value(); - QCOMPARE(opacityValue.position(), 122); - QCOMPARE(opacityValue.length(), 11); + QCOMPARE(opacityValue.position(), 115); + QCOMPARE(opacityValue.length(), 22); QDeclarativeDomValue dataValue = data.value(); - QCOMPARE(dataValue.position(), 138); + QCOMPARE(dataValue.position(), 142); QCOMPARE(dataValue.length(), 32); QDeclarativeDomValue child1Value = childrenList.values().at(0); - QCOMPARE(child1Value.position(), 187); + QCOMPARE(child1Value.position(), 191); QCOMPARE(child1Value.length(), 6); QDeclarativeDomValue child2Value = childrenList.values().at(1); - QCOMPARE(child2Value.position(), 195); + QCOMPARE(child2Value.position(), 199); QCOMPARE(child2Value.length(), 6); // All QDeclarativeDomList diff --git a/tests/auto/declarative/qdeclarativelanguage/data/assignBasicTypes.qml b/tests/auto/declarative/qdeclarativelanguage/data/assignBasicTypes.qml index c86c96b..9fe0ded 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/assignBasicTypes.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/assignBasicTypes.qml @@ -10,8 +10,6 @@ MyTypeObject { floatProperty: 8.5 colorProperty: "red" dateProperty: "1982-11-25" - timeProperty: "11:11:31" - timeProperty: "11:11:32" timeProperty: "11:11:32" dateTimeProperty: "2009-05-12T13:22:01" pointProperty: "99,13" diff --git a/tests/auto/declarative/qdeclarativelanguage/data/component.3.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/component.3.errors.txt index 9a13142..450fc16 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/component.3.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/component.3.errors.txt @@ -1 +1 @@ -6:9:Invalid component id specification +6:9:Property value set multiple times diff --git a/tests/auto/declarative/qdeclarativelanguage/data/doubleSignal.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/doubleSignal.errors.txt index 2aea251..e1f7ec5 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/doubleSignal.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/doubleSignal.errors.txt @@ -1 +1 @@ -5:5:Incorrectly specified signal +5:5:Property value set multiple times diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.6.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.6.errors.txt index 8331725..e1f7ec5 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.6.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.6.errors.txt @@ -1 +1 @@ -5:18:Single property assignment expected +5:5:Property value set multiple times diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidID.4.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/invalidID.4.errors.txt index cfe8756..c721fe9 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/invalidID.4.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidID.4.errors.txt @@ -1 +1 @@ -4:5:Invalid use of id property +4:5:Property value set multiple times diff --git a/tests/auto/declarative/qdeclarativelanguage/data/listAssignment.3.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/listAssignment.3.errors.txt index 8c7b7e9..c721fe9 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/listAssignment.3.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/listAssignment.3.errors.txt @@ -1 +1 @@ -4:15:Can only assign one binding to lists +4:5:Property value set multiple times diff --git a/tests/auto/declarative/qdeclarativelanguage/data/multiSet.1.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.1.errors.txt new file mode 100644 index 0000000..e1f7ec5 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.1.errors.txt @@ -0,0 +1 @@ +5:5:Property value set multiple times diff --git a/tests/auto/declarative/qdeclarativelanguage/data/multiSet.1.qml b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.1.qml new file mode 100644 index 0000000..649c49e --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.1.qml @@ -0,0 +1,7 @@ +import Test 1.0 + +MyTypeObject { + intProperty: 10 + intProperty: 11 +} + diff --git a/tests/auto/declarative/qdeclarativelanguage/data/multiSet.10.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.10.errors.txt new file mode 100644 index 0000000..e1f7ec5 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.10.errors.txt @@ -0,0 +1 @@ +5:5:Property value set multiple times diff --git a/tests/auto/declarative/qdeclarativelanguage/data/multiSet.10.qml b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.10.qml new file mode 100644 index 0000000..bc21db9 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.10.qml @@ -0,0 +1,6 @@ +import Test 1.0 + +MyTypeObject { + property int a: 10 + a: 11 +} diff --git a/tests/auto/declarative/qdeclarativelanguage/data/multiSet.2.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.2.errors.txt new file mode 100644 index 0000000..e1f7ec5 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.2.errors.txt @@ -0,0 +1 @@ +5:5:Property value set multiple times diff --git a/tests/auto/declarative/qdeclarativelanguage/data/multiSet.2.qml b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.2.qml new file mode 100644 index 0000000..abcd216 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.2.qml @@ -0,0 +1,7 @@ +import Test 1.0 + +MyTypeObject { + intProperty: 10 + intProperty: a + 10 +} + diff --git a/tests/auto/declarative/qdeclarativelanguage/data/multiSet.3.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.3.errors.txt new file mode 100644 index 0000000..e1f7ec5 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.3.errors.txt @@ -0,0 +1 @@ +5:5:Property value set multiple times diff --git a/tests/auto/declarative/qdeclarativelanguage/data/multiSet.3.qml b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.3.qml new file mode 100644 index 0000000..77eaba0 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.3.qml @@ -0,0 +1,7 @@ +import Test 1.0 + +MyTypeObject { + intProperty: a + 10 + intProperty: 10 +} + diff --git a/tests/auto/declarative/qdeclarativelanguage/data/multiSet.4.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.4.errors.txt new file mode 100644 index 0000000..e1f7ec5 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.4.errors.txt @@ -0,0 +1 @@ +5:5:Property value set multiple times diff --git a/tests/auto/declarative/qdeclarativelanguage/data/multiSet.4.qml b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.4.qml new file mode 100644 index 0000000..c16d04f --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.4.qml @@ -0,0 +1,7 @@ +import Test 1.0 + +MyTypeObject { + intProperty: 10 + intProperty: MyTypeObject {} +} + diff --git a/tests/auto/declarative/qdeclarativelanguage/data/multiSet.5.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.5.errors.txt new file mode 100644 index 0000000..e1f7ec5 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.5.errors.txt @@ -0,0 +1 @@ +5:5:Property value set multiple times diff --git a/tests/auto/declarative/qdeclarativelanguage/data/multiSet.5.qml b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.5.qml new file mode 100644 index 0000000..2980c5b --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.5.qml @@ -0,0 +1,6 @@ +import Test 1.0 + +MyContainer { + children: MyContainer {} + children: MyContainer {} +} diff --git a/tests/auto/declarative/qdeclarativelanguage/data/multiSet.6.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.6.errors.txt new file mode 100644 index 0000000..e1f7ec5 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.6.errors.txt @@ -0,0 +1 @@ +5:5:Property value set multiple times diff --git a/tests/auto/declarative/qdeclarativelanguage/data/multiSet.6.qml b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.6.qml new file mode 100644 index 0000000..492c720 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.6.qml @@ -0,0 +1,7 @@ +import Test 1.0 + +MyContainer { + children: MyContainer {} + children: [ MyContainer {}, MyContainer {} ] +} + diff --git a/tests/auto/declarative/qdeclarativelanguage/data/multiSet.7.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.7.errors.txt new file mode 100644 index 0000000..e1f7ec5 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.7.errors.txt @@ -0,0 +1 @@ +5:5:Property value set multiple times diff --git a/tests/auto/declarative/qdeclarativelanguage/data/multiSet.7.qml b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.7.qml new file mode 100644 index 0000000..2a9c1d0 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.7.qml @@ -0,0 +1,7 @@ +import Test 1.0 + +MyContainer { + children: [ MyContainer {}, MyContainer {} ] + children: MyContainer {} +} + diff --git a/tests/auto/declarative/qdeclarativelanguage/data/multiSet.8.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.8.errors.txt new file mode 100644 index 0000000..450fc16 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.8.errors.txt @@ -0,0 +1 @@ +6:9:Property value set multiple times diff --git a/tests/auto/declarative/qdeclarativelanguage/data/multiSet.8.qml b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.8.qml new file mode 100644 index 0000000..052437e --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.8.qml @@ -0,0 +1,8 @@ +import Test 1.0 + +MyTypeObject { + grouped { + value: 10 + value: 11 + } +} diff --git a/tests/auto/declarative/qdeclarativelanguage/data/multiSet.9.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.9.errors.txt new file mode 100644 index 0000000..e1f7ec5 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.9.errors.txt @@ -0,0 +1 @@ +5:5:Property value set multiple times diff --git a/tests/auto/declarative/qdeclarativelanguage/data/multiSet.9.qml b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.9.qml new file mode 100644 index 0000000..e2e954f --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.9.qml @@ -0,0 +1,6 @@ +import Test 1.0 + +MyTypeObject { + grouped.value: 10 + grouped.value: 11 +} diff --git a/tests/auto/declarative/qdeclarativelanguage/data/propertyValueSource.2.qml b/tests/auto/declarative/qdeclarativelanguage/data/propertyValueSource.2.qml index 57a6070..e48526a 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/propertyValueSource.2.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/propertyValueSource.2.qml @@ -1,5 +1,5 @@ import Test 1.0 MyTypeObject { - intProperty : MyCompositeValueSource {} + MyCompositeValueSource on intProperty {} } diff --git a/tests/auto/declarative/qdeclarativelanguage/data/propertyValueSource.qml b/tests/auto/declarative/qdeclarativelanguage/data/propertyValueSource.qml index ad71fcf..22aa682 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/propertyValueSource.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/propertyValueSource.qml @@ -1,4 +1,4 @@ import Test 1.0 MyTypeObject { - intProperty : MyPropertyValueSource {} + MyPropertyValueSource on intProperty {} } diff --git a/tests/auto/declarative/qdeclarativelanguage/data/script.8.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/script.8.errors.txt index b5bf1a8..450fc16 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/script.8.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/script.8.errors.txt @@ -1 +1 @@ -6:9:Invalid Script source value +6:9:Property value set multiple times diff --git a/tests/auto/declarative/qdeclarativelanguage/testtypes.h b/tests/auto/declarative/qdeclarativelanguage/testtypes.h index 8ac7aa6..ec2c5f7 100644 --- a/tests/auto/declarative/qdeclarativelanguage/testtypes.h +++ b/tests/auto/declarative/qdeclarativelanguage/testtypes.h @@ -166,11 +166,16 @@ class MyGroupedObject : public QObject { Q_OBJECT Q_PROPERTY(QDeclarativeScriptString script READ script WRITE setScript); + Q_PROPERTY(int value READ value WRITE setValue); public: QDeclarativeScriptString script() const { return m_script; } void setScript(const QDeclarativeScriptString &s) { m_script = s; } + int value() const { return m_value; } + void setValue(int v) { m_value = v; } + private: + int m_value; QDeclarativeScriptString m_script; }; diff --git a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp index 1ba4454..39f5223 100644 --- a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp +++ b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp @@ -288,6 +288,17 @@ void tst_qdeclarativelanguage::errors_data() QTest::newRow("Component.5") << "component.5.qml" << "component.5.errors.txt" << false; QTest::newRow("Component.6") << "component.6.qml" << "component.6.errors.txt" << false; + QTest::newRow("MultiSet.1") << "multiSet.1.qml" << "multiSet.1.errors.txt" << false; + QTest::newRow("MultiSet.2") << "multiSet.2.qml" << "multiSet.2.errors.txt" << false; + QTest::newRow("MultiSet.3") << "multiSet.3.qml" << "multiSet.3.errors.txt" << false; + QTest::newRow("MultiSet.4") << "multiSet.4.qml" << "multiSet.4.errors.txt" << false; + QTest::newRow("MultiSet.5") << "multiSet.5.qml" << "multiSet.5.errors.txt" << false; + QTest::newRow("MultiSet.6") << "multiSet.6.qml" << "multiSet.6.errors.txt" << false; + QTest::newRow("MultiSet.7") << "multiSet.7.qml" << "multiSet.7.errors.txt" << false; + QTest::newRow("MultiSet.8") << "multiSet.8.qml" << "multiSet.8.errors.txt" << false; + QTest::newRow("MultiSet.9") << "multiSet.9.qml" << "multiSet.9.errors.txt" << false; + QTest::newRow("MultiSet.10") << "multiSet.10.qml" << "multiSet.10.errors.txt" << false; + QTest::newRow("invalidAttachedProperty.1") << "invalidAttachedProperty.1.qml" << "invalidAttachedProperty.1.errors.txt" << false; QTest::newRow("invalidAttachedProperty.2") << "invalidAttachedProperty.2.qml" << "invalidAttachedProperty.2.errors.txt" << false; QTest::newRow("invalidAttachedProperty.3") << "invalidAttachedProperty.3.qml" << "invalidAttachedProperty.3.errors.txt" << false; diff --git a/tests/auto/declarative/qdeclarativeparticles/data/particles.qml b/tests/auto/declarative/qdeclarativeparticles/data/particles.qml index c58927e..0d42645 100644 --- a/tests/auto/declarative/qdeclarativeparticles/data/particles.qml +++ b/tests/auto/declarative/qdeclarativeparticles/data/particles.qml @@ -8,7 +8,7 @@ Rectangle{ objectName: "particles" width:1; height:1; anchors.centerIn: parent; opacity: 1 lifeSpan: 100; lifeSpanDeviation: 20; count:1000; - fadeInDuration: 20; fadeOutDuration: 20; count: -1; emissionRate: 1000 + fadeInDuration: 20; fadeOutDuration: 20; emissionRate: 1000 angle: 0; angleDeviation: 360; velocity: 500; velocityDeviation:30 source: "particle.png" } diff --git a/tests/auto/declarative/qdeclarativepathview/data/pathview2.qml b/tests/auto/declarative/qdeclarativepathview/data/pathview2.qml index 0d5c98b..c825292 100644 --- a/tests/auto/declarative/qdeclarativepathview/data/pathview2.qml +++ b/tests/auto/declarative/qdeclarativepathview/data/pathview2.qml @@ -1,7 +1,7 @@ import Qt 4.6 PathView { - id: photoPathView; model: rssModel; delegate: photoDelegate + id: photoPathView y: 100; width: 800; height: 330; pathItemCount: 10; z: 1 path: Path { diff --git a/tests/auto/declarative/qdeclarativepathview/data/pathview3.qml b/tests/auto/declarative/qdeclarativepathview/data/pathview3.qml index 412cca2..af3ae13 100644 --- a/tests/auto/declarative/qdeclarativepathview/data/pathview3.qml +++ b/tests/auto/declarative/qdeclarativepathview/data/pathview3.qml @@ -1,7 +1,7 @@ import Qt 4.6 PathView { - id: photoPathView; model: rssModel; delegate: photoDelegate + id: photoPathView y: 100; width: 800; height: 330; pathItemCount: 4; offset: 10 dragMargin: 24; snapPosition: 50 diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/valueInterceptors.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/valueInterceptors.qml index 026ae83..0897847 100644 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/valueInterceptors.qml +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/valueInterceptors.qml @@ -3,6 +3,6 @@ import Test 1.0 MyTypeObject { property int value: 13; - rect.x: MyOffsetValueInterceptor {} + MyOffsetValueInterceptor on rect.x {} rect.x: value } diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/valueSources.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/valueSources.qml index d4d4391..717f350 100644 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/valueSources.qml +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/valueSources.qml @@ -1,5 +1,5 @@ import Test 1.0 MyTypeObject { - rect.x: MyConstantValueSource {} + MyConstantValueSource on rect.x {} } diff --git a/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp b/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp index 69646b9..8732215 100644 --- a/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp +++ b/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp @@ -502,10 +502,9 @@ void tst_qdeclarativevaluetypes::valueInterceptors() QDeclarativeComponent component(&engine, TEST_FILE("valueInterceptors.qml")); MyTypeObject *object = qobject_cast(component.create()); checkNoErrors(component); - QEXPECT_FAIL("", "QT-2920", Abort); QVERIFY(object != 0); - QCOMPARE(object->rect().x(), 26); + QCOMPARE(object->rect().x(), 13); object->setProperty("value", 99); diff --git a/tools/qml/qfxtester.h b/tools/qml/qfxtester.h index 1a9f077..6521409 100644 --- a/tools/qml/qfxtester.h +++ b/tools/qml/qfxtester.h @@ -54,12 +54,12 @@ QT_BEGIN_NAMESPACE class QDeclarativeVisualTest : public QObject { Q_OBJECT - Q_PROPERTY(QList* events READ events CONSTANT) + Q_PROPERTY(QDeclarativeListProperty events READ events CONSTANT) Q_CLASSINFO("DefaultProperty", "events") public: QDeclarativeVisualTest() {} - QList *events() { return &m_events; } + QDeclarativeListProperty events() { return QDeclarativeListProperty(this, m_events); } int count() const { return m_events.count(); } QObject *event(int idx) { return m_events.at(idx); } -- cgit v0.12 From a9d327db7e77cc167172ad3199b6ffbc1c9da74f Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Tue, 2 Mar 2010 11:17:02 +1000 Subject: Add accessor operations to VisualItemModel::children --- src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp index 59d6db8..a0aed46 100644 --- a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp +++ b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp @@ -81,6 +81,14 @@ public: static_cast(prop->data)->emitChildrenChanged(); } + static int children_count(QDeclarativeListProperty *prop) { + return static_cast(prop->data)->children.count(); + } + + static QDeclarativeItem *children_at(QDeclarativeListProperty *prop, int index) { + return static_cast(prop->data)->children.at(index); + } + void itemAppended() { Q_Q(QDeclarativeVisualItemModel); QDeclarativeVisualItemModelAttached *attached = QDeclarativeVisualItemModelAttached::properties(children.last()); @@ -136,7 +144,8 @@ QDeclarativeVisualItemModel::QDeclarativeVisualItemModel() QDeclarativeListProperty QDeclarativeVisualItemModel::children() { Q_D(QDeclarativeVisualItemModel); - return QDeclarativeListProperty(this, d, QDeclarativeVisualItemModelPrivate::children_append); + return QDeclarativeListProperty(this, d, d->children_append, + d->children_count, d->children_at); } /*! -- cgit v0.12