summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2010-09-06 06:48:16 (GMT)
committerMichael Brasser <michael.brasser@nokia.com>2010-09-06 06:51:54 (GMT)
commitc3848a886448a15ae87801099849018d761026ed (patch)
treef270551764d8473a1120649a8aad20f309859e38
parentdc7f31dbd698e00cd25d36b4568b03dd83032ecc (diff)
downloadQt-c3848a886448a15ae87801099849018d761026ed.zip
Qt-c3848a886448a15ae87801099849018d761026ed.tar.gz
Qt-c3848a886448a15ae87801099849018d761026ed.tar.bz2
Fix AnchorAnimation for multiple AnchorChanges with dependancies.
When rewinding, don't reapply bindings, only values. This is consistent with how we handle rewinding other property bindings. Task-number: QTBUG-13398
-rw-r--r--src/declarative/util/qdeclarativestateoperations.cpp17
-rw-r--r--src/declarative/util/qdeclarativetransitionmanager.cpp2
-rw-r--r--tests/auto/declarative/qmlvisual/animation/qtbug13398/data/qtbug13398.0.pngbin0 -> 1265 bytes
-rw-r--r--tests/auto/declarative/qmlvisual/animation/qtbug13398/data/qtbug13398.qml447
-rw-r--r--tests/auto/declarative/qmlvisual/animation/qtbug13398/qtbug13398.qml68
5 files changed, 518 insertions, 16 deletions
diff --git a/src/declarative/util/qdeclarativestateoperations.cpp b/src/declarative/util/qdeclarativestateoperations.cpp
index 6e6f0cb..845b3da 100644
--- a/src/declarative/util/qdeclarativestateoperations.cpp
+++ b/src/declarative/util/qdeclarativestateoperations.cpp
@@ -1427,6 +1427,7 @@ void QDeclarativeAnchorChanges::clearBindings()
if (!d->target)
return;
+ //### should this (saving "from" values) be moved to saveCurrentValues()?
d->fromX = d->target->x();
d->fromY = d->target->y();
d->fromWidth = d->target->width();
@@ -1486,22 +1487,8 @@ void QDeclarativeAnchorChanges::rewind()
return;
QDeclarativeItemPrivate *targetPrivate = QDeclarativeItemPrivate::get(d->target);
- //restore previous anchors
- if (d->rewindLeft.anchorLine != QDeclarativeAnchorLine::Invalid)
- targetPrivate->anchors()->setLeft(d->rewindLeft);
- if (d->rewindRight.anchorLine != QDeclarativeAnchorLine::Invalid)
- targetPrivate->anchors()->setRight(d->rewindRight);
- if (d->rewindHCenter.anchorLine != QDeclarativeAnchorLine::Invalid)
- targetPrivate->anchors()->setHorizontalCenter(d->rewindHCenter);
- if (d->rewindTop.anchorLine != QDeclarativeAnchorLine::Invalid)
- targetPrivate->anchors()->setTop(d->rewindTop);
- if (d->rewindBottom.anchorLine != QDeclarativeAnchorLine::Invalid)
- targetPrivate->anchors()->setBottom(d->rewindBottom);
- if (d->rewindVCenter.anchorLine != QDeclarativeAnchorLine::Invalid)
- targetPrivate->anchors()->setVerticalCenter(d->rewindVCenter);
- if (d->rewindBaseline.anchorLine != QDeclarativeAnchorLine::Invalid)
- targetPrivate->anchors()->setBaseline(d->rewindBaseline);
+ //restore previous values (but not previous bindings, i.e. anchors)
d->target->setX(d->rewindX);
d->target->setY(d->rewindY);
if (targetPrivate->widthValid) {
diff --git a/src/declarative/util/qdeclarativetransitionmanager.cpp b/src/declarative/util/qdeclarativetransitionmanager.cpp
index 9f198e4..d82c4bb 100644
--- a/src/declarative/util/qdeclarativetransitionmanager.cpp
+++ b/src/declarative/util/qdeclarativetransitionmanager.cpp
@@ -176,7 +176,7 @@ void QDeclarativeTransitionManager::transition(const QList<QDeclarativeAction> &
if (action.event->isReversable()) {
action.event->clearBindings();
action.event->rewind();
- action.event->clearBindings();
+ action.event->clearBindings(); //### shouldn't be needed
}
continue;
}
diff --git a/tests/auto/declarative/qmlvisual/animation/qtbug13398/data/qtbug13398.0.png b/tests/auto/declarative/qmlvisual/animation/qtbug13398/data/qtbug13398.0.png
new file mode 100644
index 0000000..16adc51
--- /dev/null
+++ b/tests/auto/declarative/qmlvisual/animation/qtbug13398/data/qtbug13398.0.png
Binary files differ
diff --git a/tests/auto/declarative/qmlvisual/animation/qtbug13398/data/qtbug13398.qml b/tests/auto/declarative/qmlvisual/animation/qtbug13398/data/qtbug13398.qml
new file mode 100644
index 0000000..0cc98ce
--- /dev/null
+++ b/tests/auto/declarative/qmlvisual/animation/qtbug13398/data/qtbug13398.qml
@@ -0,0 +1,447 @@
+import Qt.VisualTest 4.7
+
+VisualTest {
+ Frame {
+ msec: 0
+ }
+ Frame {
+ msec: 16
+ hash: "2452007928bf86b9c42e666c7a7afc89"
+ }
+ Frame {
+ msec: 32
+ hash: "2452007928bf86b9c42e666c7a7afc89"
+ }
+ Frame {
+ msec: 48
+ hash: "2452007928bf86b9c42e666c7a7afc89"
+ }
+ Frame {
+ msec: 64
+ hash: "2452007928bf86b9c42e666c7a7afc89"
+ }
+ Frame {
+ msec: 80
+ hash: "2452007928bf86b9c42e666c7a7afc89"
+ }
+ Frame {
+ msec: 96
+ hash: "2452007928bf86b9c42e666c7a7afc89"
+ }
+ Frame {
+ msec: 112
+ hash: "2452007928bf86b9c42e666c7a7afc89"
+ }
+ Frame {
+ msec: 128
+ hash: "2452007928bf86b9c42e666c7a7afc89"
+ }
+ Frame {
+ msec: 144
+ hash: "2452007928bf86b9c42e666c7a7afc89"
+ }
+ Frame {
+ msec: 160
+ hash: "2452007928bf86b9c42e666c7a7afc89"
+ }
+ Frame {
+ msec: 176
+ hash: "2452007928bf86b9c42e666c7a7afc89"
+ }
+ Frame {
+ msec: 192
+ hash: "2452007928bf86b9c42e666c7a7afc89"
+ }
+ Frame {
+ msec: 208
+ hash: "2452007928bf86b9c42e666c7a7afc89"
+ }
+ Frame {
+ msec: 224
+ hash: "2452007928bf86b9c42e666c7a7afc89"
+ }
+ Frame {
+ msec: 240
+ hash: "2452007928bf86b9c42e666c7a7afc89"
+ }
+ Frame {
+ msec: 256
+ hash: "2452007928bf86b9c42e666c7a7afc89"
+ }
+ Frame {
+ msec: 272
+ hash: "2452007928bf86b9c42e666c7a7afc89"
+ }
+ Frame {
+ msec: 288
+ hash: "2452007928bf86b9c42e666c7a7afc89"
+ }
+ Frame {
+ msec: 304
+ hash: "2452007928bf86b9c42e666c7a7afc89"
+ }
+ Frame {
+ msec: 320
+ hash: "2452007928bf86b9c42e666c7a7afc89"
+ }
+ Frame {
+ msec: 336
+ hash: "2452007928bf86b9c42e666c7a7afc89"
+ }
+ Frame {
+ msec: 352
+ hash: "2452007928bf86b9c42e666c7a7afc89"
+ }
+ Frame {
+ msec: 368
+ hash: "2452007928bf86b9c42e666c7a7afc89"
+ }
+ Frame {
+ msec: 384
+ hash: "2452007928bf86b9c42e666c7a7afc89"
+ }
+ Frame {
+ msec: 400
+ hash: "2452007928bf86b9c42e666c7a7afc89"
+ }
+ Frame {
+ msec: 416
+ hash: "2452007928bf86b9c42e666c7a7afc89"
+ }
+ Frame {
+ msec: 432
+ hash: "2452007928bf86b9c42e666c7a7afc89"
+ }
+ Frame {
+ msec: 448
+ hash: "2452007928bf86b9c42e666c7a7afc89"
+ }
+ Frame {
+ msec: 464
+ hash: "2452007928bf86b9c42e666c7a7afc89"
+ }
+ Frame {
+ msec: 480
+ hash: "2452007928bf86b9c42e666c7a7afc89"
+ }
+ Frame {
+ msec: 496
+ hash: "2452007928bf86b9c42e666c7a7afc89"
+ }
+ Mouse {
+ type: 2
+ button: 1
+ buttons: 1
+ x: 220; y: 270
+ modifiers: 0
+ sendToViewport: true
+ }
+ Frame {
+ msec: 512
+ hash: "2452007928bf86b9c42e666c7a7afc89"
+ }
+ Frame {
+ msec: 528
+ hash: "2452007928bf86b9c42e666c7a7afc89"
+ }
+ Frame {
+ msec: 544
+ hash: "2452007928bf86b9c42e666c7a7afc89"
+ }
+ Frame {
+ msec: 560
+ hash: "2452007928bf86b9c42e666c7a7afc89"
+ }
+ Frame {
+ msec: 576
+ hash: "2452007928bf86b9c42e666c7a7afc89"
+ }
+ Mouse {
+ type: 5
+ button: 0
+ buttons: 1
+ x: 220; y: 271
+ modifiers: 0
+ sendToViewport: true
+ }
+ Mouse {
+ type: 3
+ button: 1
+ buttons: 0
+ x: 220; y: 271
+ modifiers: 0
+ sendToViewport: true
+ }
+ Frame {
+ msec: 592
+ hash: "2452007928bf86b9c42e666c7a7afc89"
+ }
+ Frame {
+ msec: 608
+ hash: "96e8e81d61bffe02b8f41f47a4a7e8fc"
+ }
+ Frame {
+ msec: 624
+ hash: "75881a2779bd7d7f683f87c4a7393769"
+ }
+ Frame {
+ msec: 640
+ hash: "2ef628328d2a6393095e78db80b0513f"
+ }
+ Frame {
+ msec: 656
+ hash: "390926f2c2c27dfa10c9b393ee466ce6"
+ }
+ Frame {
+ msec: 672
+ hash: "ea07d93e7d8a53f56cff19d9d3b282a4"
+ }
+ Frame {
+ msec: 688
+ hash: "8aa6be919b1ef4b7e102a319a453707e"
+ }
+ Frame {
+ msec: 704
+ hash: "6ebc518fb53ffe42fca20b9f16a21b36"
+ }
+ Frame {
+ msec: 720
+ hash: "ee7a93b157e24e22efa84604e7e44fe6"
+ }
+ Frame {
+ msec: 736
+ hash: "de3bf8f67e51b036db4976fd3b4b6c3c"
+ }
+ Frame {
+ msec: 752
+ hash: "648be4298ebe3bbc7e5c4a4c9c46f193"
+ }
+ Frame {
+ msec: 768
+ hash: "1ccf3b73e22a4b98ce1df098af9466f2"
+ }
+ Frame {
+ msec: 784
+ hash: "73a2fb047728b2b8e613f0fb8dfe429d"
+ }
+ Frame {
+ msec: 800
+ hash: "bbb4cabec4b98ea8ca94dff91a0d8c99"
+ }
+ Frame {
+ msec: 816
+ hash: "3337e86bd9fcfbce939389928fb1fb72"
+ }
+ Frame {
+ msec: 832
+ hash: "cb4a2a330e8470c61de9e9b6d2dc4597"
+ }
+ Frame {
+ msec: 848
+ hash: "e09a359578935b988ac1cc8c40b25547"
+ }
+ Frame {
+ msec: 864
+ hash: "e09a359578935b988ac1cc8c40b25547"
+ }
+ Frame {
+ msec: 880
+ hash: "e09a359578935b988ac1cc8c40b25547"
+ }
+ Frame {
+ msec: 896
+ hash: "e09a359578935b988ac1cc8c40b25547"
+ }
+ Frame {
+ msec: 912
+ hash: "e09a359578935b988ac1cc8c40b25547"
+ }
+ Frame {
+ msec: 928
+ hash: "e09a359578935b988ac1cc8c40b25547"
+ }
+ Frame {
+ msec: 944
+ hash: "e09a359578935b988ac1cc8c40b25547"
+ }
+ Frame {
+ msec: 960
+ image: "qtbug13398.0.png"
+ }
+ Frame {
+ msec: 976
+ hash: "e09a359578935b988ac1cc8c40b25547"
+ }
+ Frame {
+ msec: 992
+ hash: "e09a359578935b988ac1cc8c40b25547"
+ }
+ Frame {
+ msec: 1008
+ hash: "e09a359578935b988ac1cc8c40b25547"
+ }
+ Frame {
+ msec: 1024
+ hash: "e09a359578935b988ac1cc8c40b25547"
+ }
+ Frame {
+ msec: 1040
+ hash: "e09a359578935b988ac1cc8c40b25547"
+ }
+ Frame {
+ msec: 1056
+ hash: "e09a359578935b988ac1cc8c40b25547"
+ }
+ Frame {
+ msec: 1072
+ hash: "e09a359578935b988ac1cc8c40b25547"
+ }
+ Frame {
+ msec: 1088
+ hash: "e09a359578935b988ac1cc8c40b25547"
+ }
+ Frame {
+ msec: 1104
+ hash: "e09a359578935b988ac1cc8c40b25547"
+ }
+ Frame {
+ msec: 1120
+ hash: "e09a359578935b988ac1cc8c40b25547"
+ }
+ Frame {
+ msec: 1136
+ hash: "e09a359578935b988ac1cc8c40b25547"
+ }
+ Frame {
+ msec: 1152
+ hash: "e09a359578935b988ac1cc8c40b25547"
+ }
+ Frame {
+ msec: 1168
+ hash: "e09a359578935b988ac1cc8c40b25547"
+ }
+ Frame {
+ msec: 1184
+ hash: "e09a359578935b988ac1cc8c40b25547"
+ }
+ Frame {
+ msec: 1200
+ hash: "e09a359578935b988ac1cc8c40b25547"
+ }
+ Frame {
+ msec: 1216
+ hash: "e09a359578935b988ac1cc8c40b25547"
+ }
+ Frame {
+ msec: 1232
+ hash: "e09a359578935b988ac1cc8c40b25547"
+ }
+ Mouse {
+ type: 2
+ button: 1
+ buttons: 1
+ x: 220; y: 271
+ modifiers: 0
+ sendToViewport: true
+ }
+ Frame {
+ msec: 1248
+ hash: "e09a359578935b988ac1cc8c40b25547"
+ }
+ Frame {
+ msec: 1264
+ hash: "e09a359578935b988ac1cc8c40b25547"
+ }
+ Frame {
+ msec: 1280
+ hash: "e09a359578935b988ac1cc8c40b25547"
+ }
+ Frame {
+ msec: 1296
+ hash: "e09a359578935b988ac1cc8c40b25547"
+ }
+ Frame {
+ msec: 1312
+ hash: "e09a359578935b988ac1cc8c40b25547"
+ }
+ Frame {
+ msec: 1328
+ hash: "e09a359578935b988ac1cc8c40b25547"
+ }
+ Mouse {
+ type: 3
+ button: 1
+ buttons: 0
+ x: 220; y: 271
+ modifiers: 0
+ sendToViewport: true
+ }
+ Frame {
+ msec: 1344
+ hash: "e09a359578935b988ac1cc8c40b25547"
+ }
+ Frame {
+ msec: 1360
+ hash: "697a4fd182ff90cd557f224174bad43a"
+ }
+ Frame {
+ msec: 1376
+ hash: "99e5ca9a77df1acfed628f31b9050179"
+ }
+ Frame {
+ msec: 1392
+ hash: "1f0dc00d3e3536b40a6becf775b31cee"
+ }
+ Frame {
+ msec: 1408
+ hash: "5b81ddd35d74be222bc8a40d2573884b"
+ }
+ Frame {
+ msec: 1424
+ hash: "4e236f5de69048e87add0e4380f2c3e6"
+ }
+ Frame {
+ msec: 1440
+ hash: "a901c9c0c77e03d98a2b95267cca8514"
+ }
+ Frame {
+ msec: 1456
+ hash: "78bbdf6781c2968c67982ffdb747dbbe"
+ }
+ Frame {
+ msec: 1472
+ hash: "a245ca593649f60980be982eb8fda57e"
+ }
+ Frame {
+ msec: 1488
+ hash: "c27fddc147749da24eaeb92aeaf61738"
+ }
+ Frame {
+ msec: 1504
+ hash: "b9674af46b618dc1eedabd4f18253b11"
+ }
+ Frame {
+ msec: 1520
+ hash: "8ae3c0cc0888fd0a607bc5b537a9ce0a"
+ }
+ Frame {
+ msec: 1536
+ hash: "f1981bd3fb08233622a4078e2f717011"
+ }
+ Frame {
+ msec: 1552
+ hash: "4dce834c9e3988fe535391fedc942add"
+ }
+ Frame {
+ msec: 1568
+ hash: "ca7356dee61e156d04b0b46ea033498e"
+ }
+ Frame {
+ msec: 1584
+ hash: "97499f6e04cbe690bc12458aef4b66a5"
+ }
+ Frame {
+ msec: 1600
+ hash: "2452007928bf86b9c42e666c7a7afc89"
+ }
+}
diff --git a/tests/auto/declarative/qmlvisual/animation/qtbug13398/qtbug13398.qml b/tests/auto/declarative/qmlvisual/animation/qtbug13398/qtbug13398.qml
new file mode 100644
index 0000000..8f388bc
--- /dev/null
+++ b/tests/auto/declarative/qmlvisual/animation/qtbug13398/qtbug13398.qml
@@ -0,0 +1,68 @@
+import Qt 4.7
+
+Item {
+ width: 300
+ height: 400
+
+ Rectangle {
+ id: root
+ color: "darkkhaki"
+
+ x: 50
+ y: 50
+
+ width: 200
+ height: 300
+
+ Rectangle {
+ id: statusbar
+ color: "chocolate"
+
+ height: 30
+
+ anchors.top: root.top
+ anchors.left: root.left
+ anchors.right: root.right
+ }
+
+ Rectangle {
+ id: titlebar
+ color: "crimson"
+
+ height: 60
+
+ anchors.top: statusbar.bottom
+ anchors.left: root.left
+ anchors.right: root.right
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: {
+ root.state = root.state ? "" : "fullscreen";
+ }
+ }
+
+ states: [
+ State {
+ name: "fullscreen"
+ AnchorChanges {
+ target: statusbar
+ anchors.top: undefined
+ anchors.bottom: titlebar.top
+ }
+ AnchorChanges {
+ target: titlebar
+ anchors.top: undefined
+ anchors.bottom: root.top
+ }
+ }
+ ]
+
+ transitions: [
+ Transition {
+ AnchorAnimation { }
+ }
+ ]
+ }
+}