From ad2b2c698d90d04aebe1f6d05c3a4eb992c0e7b6 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Tue, 16 Feb 2010 11:59:27 +1000 Subject: Get rid of the matchProperties/properties distinction, as it has proven to be confusing in practice. property/target and properties/targets will be functionally equivilant (the only distinction being singular/plural). In a transition these properties can be used for both 'matching' and explicit animation based on whether a 'to' value is supplied. The documentation, tests, examples and demos have been updated as well. --- demos/declarative/calculator/calculator.qml | 4 +- demos/declarative/flickr/common/ImageDetails.qml | 2 +- demos/declarative/flickr/common/MediaLineEdit.qml | 2 +- demos/declarative/flickr/common/ScrollBar.qml | 2 +- demos/declarative/flickr/common/Star.qml | 2 +- demos/declarative/flickr/flickr-desktop.qml | 8 +- demos/declarative/flickr/flickr-mobile.qml | 4 +- demos/declarative/flickr/mobile/GridDelegate.qml | 6 +- demos/declarative/flickr/mobile/ImageDetails.qml | 2 +- demos/declarative/flickr/mobile/TitleBar.qml | 2 +- demos/declarative/minehunt/minehunt.qml | 2 +- demos/declarative/twitter/content/HomeTitleBar.qml | 2 +- .../declarative/twitter/content/MultiTitleBar.qml | 2 +- demos/declarative/twitter/content/TitleBar.qml | 2 +- demos/declarative/twitter/twitter.qml | 2 +- .../content/RetractingWebBrowserHeader.qml | 4 +- .../webbrowser/content/fieldtext/FieldText.qml | 2 +- demos/declarative/webbrowser/webbrowser.qml | 4 +- doc/src/declarative/animation.qdoc | 88 +- doc/src/declarative/qmlstates.qdoc | 2 +- examples/declarative/anchors/anchor-changes.qml | 2 +- examples/declarative/animations/easing.qml | 4 +- examples/declarative/layouts/Button.qml | 2 +- examples/declarative/layouts/positioners.qml | 16 +- examples/declarative/listview/dynamic.qml | 2 +- examples/declarative/listview/highlight.qml | 2 +- examples/declarative/listview/recipes.qml | 2 +- examples/declarative/parallax/qml/ParallaxView.qml | 2 +- examples/declarative/scrollbar/ScrollBar.qml | 2 +- examples/declarative/scrollbar/display.qml | 2 +- examples/declarative/searchbox/SearchBox.qml | 4 +- .../declarative/slideswitch/content/Switch.qml | 2 +- examples/declarative/snow/ImageBatch.qml | 10 +- examples/declarative/states/transitions.qml | 8 +- .../declarative/tutorials/helloworld/tutorial3.qml | 2 +- .../samegame/samegame4/content/BoomBlock.qml | 2 +- examples/declarative/velocity/Day.qml | 2 +- examples/declarative/webview/autosize.qml | 2 +- examples/declarative/webview/content/FieldText.qml | 2 +- examples/declarative/xmldata/yahoonews.qml | 4 +- .../graphicsitems/qmlgraphicsflipable.cpp | 2 +- .../graphicsitems/qmlgraphicspositioners.cpp | 8 +- src/declarative/util/qmlanimation.cpp | 695 ++++----- src/declarative/util/qmlanimation_p.h | 23 +- src/declarative/util/qmlanimation_p_p.h | 24 +- src/declarative/util/qmlbehavior.cpp | 4 +- src/declarative/util/qmlstateoperations.cpp | 2 +- .../declarative/qmlanimations/data/badtype4.qml | 4 +- .../qmlanimations/data/dontAutoStart.qml | 18 + .../declarative/qmlanimations/data/dotproperty.qml | 2 +- .../declarative/qmlanimations/data/mixedtype1.qml | 2 +- .../declarative/qmlanimations/data/mixedtype2.qml | 2 +- .../declarative/qmlanimations/data/properties2.qml | 2 +- .../declarative/qmlanimations/data/properties5.qml | 2 +- .../qmlanimations/data/propertiesTransition.qml | 2 +- .../qmlanimations/data/propertiesTransition3.qml | 2 +- .../qmlanimations/data/propertiesTransition4.qml | 2 +- .../qmlanimations/data/propertiesTransition5.qml | 2 +- .../qmlanimations/data/propertiesTransition6.qml | 2 +- .../qmlanimations/tst_qmlanimations.cpp | 44 +- .../declarative/qmlbehaviors/data/explicit.qml | 26 + .../declarative/qmlbehaviors/data/nonSelecting.qml | 26 - .../qmlbehaviors/data/nonSelecting2.qml | 2 +- .../declarative/qmlbehaviors/tst_qmlbehaviors.cpp | 11 +- .../qmlgraphicspositioners/data/grid-animated.qml | 4 +- .../data/horizontal-animated.qml | 4 +- .../data/vertical-animated.qml | 4 +- .../visual/Package_Views/packageviews.qml | 2 +- .../bindinganimation/bindinganimation.qml | 2 +- .../declarative/visual/animation/easing/easing.qml | 2 +- .../visual/animation/loop/data/loop.0.png | Bin 0 -> 508 bytes .../visual/animation/loop/data/loop.1.png | Bin 0 -> 507 bytes .../visual/animation/loop/data/loop.2.png | Bin 0 -> 508 bytes .../visual/animation/loop/data/loop.3.png | Bin 0 -> 508 bytes .../visual/animation/loop/data/loop.4.png | Bin 0 -> 505 bytes .../visual/animation/loop/data/loop.5.png | Bin 0 -> 508 bytes .../visual/animation/loop/data/loop.qml | 1471 ++++++++++++++++++++ .../declarative/visual/animation/loop/loop.qml | 24 + .../parallelAnimation/parallelAnimation.qml | 6 +- .../visual/animation/parentAction/parentAction.qml | 2 +- .../animation/propertyAction/propertyAction.qml | 4 +- .../visual/animation/reanchor/reanchor.qml | 2 +- .../visual/animation/scriptAction/scriptAction.qml | 4 +- .../data/flickable-vertical.qml | 2 +- .../visual/qmlgraphicsflipable/test-flipable.qml | 4 +- .../visual/qmlgraphicspositioners/dynamic.qml | 4 +- .../visual/qmlgraphicstextedit/cursorDelegate.qml | 4 +- .../visual/qmlgraphicstextinput/cursorDelegate.qml | 4 +- 88 files changed, 2050 insertions(+), 626 deletions(-) create mode 100644 tests/auto/declarative/qmlanimations/data/dontAutoStart.qml create mode 100644 tests/auto/declarative/qmlbehaviors/data/explicit.qml delete mode 100644 tests/auto/declarative/qmlbehaviors/data/nonSelecting.qml create mode 100644 tests/auto/declarative/visual/animation/loop/data/loop.0.png create mode 100644 tests/auto/declarative/visual/animation/loop/data/loop.1.png create mode 100644 tests/auto/declarative/visual/animation/loop/data/loop.2.png create mode 100644 tests/auto/declarative/visual/animation/loop/data/loop.3.png create mode 100644 tests/auto/declarative/visual/animation/loop/data/loop.4.png create mode 100644 tests/auto/declarative/visual/animation/loop/data/loop.5.png create mode 100644 tests/auto/declarative/visual/animation/loop/data/loop.qml create mode 100644 tests/auto/declarative/visual/animation/loop/loop.qml diff --git a/demos/declarative/calculator/calculator.qml b/demos/declarative/calculator/calculator.qml index d9b73ed..54af7ad 100644 --- a/demos/declarative/calculator/calculator.qml +++ b/demos/declarative/calculator/calculator.qml @@ -118,7 +118,7 @@ Rectangle { } transitions: Transition { - NumberAnimation { matchProperties: "x,y,width"; easing: "easeOutBounce"; duration: 500 } - NumberAnimation { matchProperties: "opacity"; easing: "easeInOutQuad"; duration: 500 } + NumberAnimation { properties: "x,y,width"; easing: "easeOutBounce"; duration: 500 } + NumberAnimation { properties: "opacity"; easing: "easeInOutQuad"; duration: 500 } } } diff --git a/demos/declarative/flickr/common/ImageDetails.qml b/demos/declarative/flickr/common/ImageDetails.qml index 95c32e8..19cad06 100644 --- a/demos/declarative/flickr/common/ImageDetails.qml +++ b/demos/declarative/flickr/common/ImageDetails.qml @@ -149,7 +149,7 @@ Flipable { property: "smooth" value: false } - NumberAnimation { easing: "easeInOutQuad"; matchProperties: "angle"; duration: 500 } + NumberAnimation { easing: "easeInOutQuad"; properties: "angle"; duration: 500 } PropertyAction { target: bigImage property: "smooth" diff --git a/demos/declarative/flickr/common/MediaLineEdit.qml b/demos/declarative/flickr/common/MediaLineEdit.qml index abc8034..b24b296 100644 --- a/demos/declarative/flickr/common/MediaLineEdit.qml +++ b/demos/declarative/flickr/common/MediaLineEdit.qml @@ -42,7 +42,7 @@ Item { ] transitions: [ Transition { - NumberAnimation { matchProperties: "x,width"; duration: 500; easing: "easeInOutQuad" } + NumberAnimation { properties: "x,width"; duration: 500; easing: "easeInOutQuad" } } ] diff --git a/demos/declarative/flickr/common/ScrollBar.qml b/demos/declarative/flickr/common/ScrollBar.qml index 2c1ec8a..feebcb0 100644 --- a/demos/declarative/flickr/common/ScrollBar.qml +++ b/demos/declarative/flickr/common/ScrollBar.qml @@ -32,7 +32,7 @@ Item { to: "*" NumberAnimation { target: container - matchProperties: "opacity" + properties: "opacity" duration: 400 } } diff --git a/demos/declarative/flickr/common/Star.qml b/demos/declarative/flickr/common/Star.qml index c5abcca..173021b 100644 --- a/demos/declarative/flickr/common/Star.qml +++ b/demos/declarative/flickr/common/Star.qml @@ -37,7 +37,7 @@ Item { transitions: [ Transition { NumberAnimation { - matchProperties: "opacity,scale,x,y" + properties: "opacity,scale,x,y" easing: "easeOutBounce" } } diff --git a/demos/declarative/flickr/flickr-desktop.qml b/demos/declarative/flickr/flickr-desktop.qml index 4e3b6cb..3848f12 100644 --- a/demos/declarative/flickr/flickr-desktop.qml +++ b/demos/declarative/flickr/flickr-desktop.qml @@ -86,15 +86,15 @@ Item { from: "*"; to: "Details" SequentialAnimation { ParentAction { } - NumberAnimation { matchProperties: "x,y,scale,opacity,angle"; duration: 500; easing: "easeInOutQuad" } + NumberAnimation { properties: "x,y,scale,opacity,angle"; duration: 500; easing: "easeInOutQuad" } } }, Transition { from: "Details"; to: "*" SequentialAnimation { ParentAction { } - NumberAnimation { matchProperties: "x,y,scale,opacity,angle"; duration: 500; easing: "easeInOutQuad" } - PropertyAction { matchTargets: wrapper; matchProperties: "z" } + NumberAnimation { properties: "x,y,scale,opacity,angle"; duration: 500; easing: "easeInOutQuad" } + PropertyAction { targets: wrapper; properties: "z" } } } ] @@ -180,7 +180,7 @@ Item { transitions: [ Transition { from: "*"; to: "*" - NumberAnimation { matchProperties: "y"; duration: 1000; easing: "easeOutBounce(amplitude:0.5)" } + NumberAnimation { properties: "y"; duration: 1000; easing: "easeOutBounce(amplitude:0.5)" } } ] } diff --git a/demos/declarative/flickr/flickr-mobile.qml b/demos/declarative/flickr/flickr-mobile.qml index 583f992..0a89c4f 100644 --- a/demos/declarative/flickr/flickr-mobile.qml +++ b/demos/declarative/flickr/flickr-mobile.qml @@ -38,7 +38,7 @@ Item { } transitions: Transition { - NumberAnimation { matchProperties: "x"; duration: 500; easing: "easeInOutQuad" } + NumberAnimation { properties: "x"; duration: 500; easing: "easeInOutQuad" } } } @@ -76,7 +76,7 @@ Item { } transitions: Transition { - NumberAnimation { matchProperties: "x"; duration: 500; easing: "easeInOutQuad" } + NumberAnimation { properties: "x"; duration: 500; easing: "easeInOutQuad" } } } } diff --git a/demos/declarative/flickr/mobile/GridDelegate.qml b/demos/declarative/flickr/mobile/GridDelegate.qml index 3a42507..6c12896 100644 --- a/demos/declarative/flickr/mobile/GridDelegate.qml +++ b/demos/declarative/flickr/mobile/GridDelegate.qml @@ -55,14 +55,14 @@ Transition { from: "Show"; to: "Details" ParentAction { } - NumberAnimation { matchProperties: "x,y"; duration: 500; easing: "easeInOutQuad" } + NumberAnimation { properties: "x,y"; duration: 500; easing: "easeInOutQuad" } }, Transition { from: "Details"; to: "Show" SequentialAnimation { ParentAction { } - NumberAnimation { matchProperties: "x,y"; duration: 500; easing: "easeInOutQuad" } - PropertyAction { matchTargets: wrapper; matchProperties: "z" } + NumberAnimation { properties: "x,y"; duration: 500; easing: "easeInOutQuad" } + PropertyAction { targets: wrapper; properties: "z" } } } ] diff --git a/demos/declarative/flickr/mobile/ImageDetails.qml b/demos/declarative/flickr/mobile/ImageDetails.qml index 9116428..1963bf5 100644 --- a/demos/declarative/flickr/mobile/ImageDetails.qml +++ b/demos/declarative/flickr/mobile/ImageDetails.qml @@ -117,7 +117,7 @@ Flipable { transitions: Transition { SequentialAnimation { PropertyAction { target: bigImage; property: "smooth"; value: false } - NumberAnimation { easing: "easeInOutQuad"; matchProperties: "angle"; duration: 500 } + NumberAnimation { easing: "easeInOutQuad"; properties: "angle"; duration: 500 } PropertyAction { target: bigImage; property: "smooth"; value: !flickable.moving } } } diff --git a/demos/declarative/flickr/mobile/TitleBar.qml b/demos/declarative/flickr/mobile/TitleBar.qml index 0341585..07b9762 100644 --- a/demos/declarative/flickr/mobile/TitleBar.qml +++ b/demos/declarative/flickr/mobile/TitleBar.qml @@ -71,6 +71,6 @@ Item { } transitions: Transition { - NumberAnimation { matchProperties: "x"; easing: "easeInOutQuad" } + NumberAnimation { properties: "x"; easing: "easeInOutQuad" } } } diff --git a/demos/declarative/minehunt/minehunt.qml b/demos/declarative/minehunt/minehunt.qml index ff00d83..58e2cc9 100644 --- a/demos/declarative/minehunt/minehunt.qml +++ b/demos/declarative/minehunt/minehunt.qml @@ -93,7 +93,7 @@ Item { } NumberAnimation { easing: "easeInOutQuad" - matchProperties: "angle" + properties: "angle" } ScriptAction{ script: if(modelData.hasMine && modelData.flipped){expl.explode = true;} diff --git a/demos/declarative/twitter/content/HomeTitleBar.qml b/demos/declarative/twitter/content/HomeTitleBar.qml index c48befd..8054f2e 100644 --- a/demos/declarative/twitter/content/HomeTitleBar.qml +++ b/demos/declarative/twitter/content/HomeTitleBar.qml @@ -115,7 +115,7 @@ Item { transitions: [ Transition { from: "*"; to: "*" - NumberAnimation { matchProperties: "x,y,width,height"; easing: "easeInOutQuad" } + NumberAnimation { properties: "x,y,width,height"; easing: "easeInOutQuad" } } ] } diff --git a/demos/declarative/twitter/content/MultiTitleBar.qml b/demos/declarative/twitter/content/MultiTitleBar.qml index ef8a450..ef7de65 100644 --- a/demos/declarative/twitter/content/MultiTitleBar.qml +++ b/demos/declarative/twitter/content/MultiTitleBar.qml @@ -18,7 +18,7 @@ Item { } ] transitions: [ - Transition { NumberAnimation { matchProperties: "x,y"; duration: 500; easing: "easeInOutQuad" } } + Transition { NumberAnimation { properties: "x,y"; duration: 500; easing: "easeInOutQuad" } } ] } diff --git a/demos/declarative/twitter/content/TitleBar.qml b/demos/declarative/twitter/content/TitleBar.qml index 28e7389..42a6115 100644 --- a/demos/declarative/twitter/content/TitleBar.qml +++ b/demos/declarative/twitter/content/TitleBar.qml @@ -72,6 +72,6 @@ Item { } transitions: Transition { - NumberAnimation { matchProperties: "x"; easing: "easeInOutQuad" } + NumberAnimation { properties: "x"; easing: "easeInOutQuad" } } } diff --git a/demos/declarative/twitter/twitter.qml b/demos/declarative/twitter/twitter.qml index bb7da9c..d2abf28 100644 --- a/demos/declarative/twitter/twitter.qml +++ b/demos/declarative/twitter/twitter.qml @@ -89,7 +89,7 @@ Item { } ] transitions: [ - Transition { NumberAnimation { matchProperties: "x,y"; duration: 500; easing: "easeInOutQuad" } } + Transition { NumberAnimation { properties: "x,y"; duration: 500; easing: "easeInOutQuad" } } ] } } diff --git a/demos/declarative/webbrowser/content/RetractingWebBrowserHeader.qml b/demos/declarative/webbrowser/content/RetractingWebBrowserHeader.qml index a7e6a97..e58ab0a 100644 --- a/demos/declarative/webbrowser/content/RetractingWebBrowserHeader.qml +++ b/demos/declarative/webbrowser/content/RetractingWebBrowserHeader.qml @@ -96,8 +96,8 @@ Image { transitions: [ Transition { NumberAnimation { - matchTargets: header - matchProperties: "progressOff" + targets: header + properties: "progressOff" easing: "easeInOutQuad" duration: 300 } diff --git a/demos/declarative/webbrowser/content/fieldtext/FieldText.qml b/demos/declarative/webbrowser/content/fieldtext/FieldText.qml index 6b1d271..b1c1938 100644 --- a/demos/declarative/webbrowser/content/fieldtext/FieldText.qml +++ b/demos/declarative/webbrowser/content/fieldtext/FieldText.qml @@ -149,7 +149,7 @@ Item { to: "*" reversible: true NumberAnimation { - matchProperties: "opacity,leftMargin,rightMargin" + properties: "opacity,leftMargin,rightMargin" duration: 200 } ColorAnimation { diff --git a/demos/declarative/webbrowser/webbrowser.qml b/demos/declarative/webbrowser/webbrowser.qml index 3b3790c..8de13d5 100644 --- a/demos/declarative/webbrowser/webbrowser.qml +++ b/demos/declarative/webbrowser/webbrowser.qml @@ -97,7 +97,7 @@ Item { transitions: [ Transition { NumberAnimation { - matchProperties: "opacity" + properties: "opacity" easing: "easeInOutQuad" duration: 300 } @@ -153,7 +153,7 @@ Item { transitions: [ Transition { NumberAnimation { - matchProperties: "opacity" + properties: "opacity" easing: "easeInOutQuad" duration: 320 } diff --git a/doc/src/declarative/animation.qdoc b/doc/src/declarative/animation.qdoc index bf5907d..4efc806 100644 --- a/doc/src/declarative/animation.qdoc +++ b/doc/src/declarative/animation.qdoc @@ -44,9 +44,9 @@ \title QML Animation Animation in QML is done by animating properties of objects. Properties of type -real, int, color, rect, point, and size can all be animated. +real, int, color, rect, point, size, and vector3d can all be animated. -QML supports three different forms of animation - basic property animation, +QML supports three main forms of animation - basic property animation, transitions, and property behaviors. \tableofcontents @@ -71,7 +71,6 @@ Rectangle { x: 60-img.width/2 y: 0 y: SequentialAnimation { - running: true repeat: true NumberAnimation { to: 200-img.height; easing: "easeOutBounce"; duration: 2000 } PauseAnimation { duration: 1000 } @@ -84,8 +83,8 @@ Rectangle { \image propanim.gif When you assign an animation as a value source, you do not need to specify \c property -or \c target; they are automatically selected for you. You do, however, need to specify \c to, and explicitly -start the animation (usually via the \c running property). +or \c target; they are automatically selected for you. You do, however, need to specify \c to. +An animation specified as a value source will be \c running by default. \qml Rectangle { @@ -94,7 +93,7 @@ Rectangle { Rectangle { color: "red" width: 50; height: 50 - x: NumberAnimation { to: 50; running: true } + x: NumberAnimation { to: 50; } } } \endqml @@ -135,7 +134,7 @@ For example, a transition could describe how an item moves from its initial posi transitions: [ Transition { NumberAnimation { - matchProperties: "x,y" + properties: "x,y" easing: "easeOutBounce" duration: 200 } @@ -143,13 +142,38 @@ transitions: [ ] \endcode -As you can see from the above example, transitions make use of the same basic animation classes introduced -above. However, you generally use a different set of properties when working with transitions. In the example, -no \c target or \c property has been specified. Instead, we have specified \c matchProperties, -which (along with \c matchTargets) acts as a selector to determine which property changes to animate; -in this case, we will animate any x,y properties that have changed on any objects. +As can be seen, transitions make use of the same basic animation classes introduced above. +In the above example we have specified that we want to animate the \c x and \c y properties, but have not +specified the objects to animate or the \c to values. By default these values are supplied by the framework -- +the animation will animate any \c targets whose \c x and \c y have changed, and the \c to values will be those +defined in the end state. You can always supply explicit values to override these implicit values when needed. -QML transitions also have selectors to determine which state changes a transition should apply to: +\code +Transition { + from: "*" + to: "MyState" + reversible: true + SequentialAnimation { + NumberAnimation { + duration: 1000 + easing: "easeOutBounce" + // animate myItem's x and y if they have changed in the state + target: myItem + properties: "x,y" + } + NumberAnimation { + duration: 1000 + // animate myItem2's y to 200, regardless of what happens in the state + target: myItem2 + property: "y" + to: 200 + } + } +} +\endcode + +QML transitions have selectors to determine which state changes a transition should apply to. +The following transition will only be triggered when we enter into the \c "details" state. \code Transition { @@ -175,50 +199,24 @@ Transition { NumberAnimation { duration: 1000 easing: "easeOutBounce" - matchTargets: box1 - matchProperties: "x,y" + targets: box1 + properties: "x,y" } NumberAnimation { duration: 1000 - matchTargets: box2 - matchProperties: "x,y" + targets: box2 + properties: "x,y" } } } } \endcode -To insert an explicit animation into your transition, you can use \c target and \c property as normal. - -\code -Transition { - from: "*" - to: "MyState" - reversible: true - SequentialAnimation { - NumberAnimation { - duration: 1000 - easing: "easeOutBounce" - // animate myItem's x and y if they have changed in the state - matchTargets: myItem - matchProperties: "x,y" - } - NumberAnimation { - duration: 1000 - // animate myItem2's y to 200, regardless of what happens in the state - target: myItem2 - property: "y" - to: 200 - } - } -} -\endcode - \section1 Property Behaviors A \l{Behavior}{property behavior} specifies a default animation to run whenever the property's value changes, regardless -of what caused the change. Unlike Transition, \l Behavior doesn't provide a way to indicate that a Behavior -should only apply under certain circumstances. +of what caused the change. The \c enabled property can be used to force a \l Behavior +to only apply under certain circumstances. In the following snippet, we specify that we want the x position of redRect to be animated whenever it changes. The animation will last 300 milliseconds and use an InOutQuad easing curve. diff --git a/doc/src/declarative/qmlstates.qdoc b/doc/src/declarative/qmlstates.qdoc index abf3c93..18ba35d 100644 --- a/doc/src/declarative/qmlstates.qdoc +++ b/doc/src/declarative/qmlstates.qdoc @@ -67,7 +67,7 @@ For example, adding this code to the above \c {Item {}} element animates the tra \qml transitions: [ Transition { - NumberAnimation { matchProperties: "x,y"; duration: 500 } + NumberAnimation { properties: "x,y"; duration: 500 } } ] \endqml diff --git a/examples/declarative/anchors/anchor-changes.qml b/examples/declarative/anchors/anchor-changes.qml index 2ebe1c0..f6fd35d 100644 --- a/examples/declarative/anchors/anchor-changes.qml +++ b/examples/declarative/anchors/anchor-changes.qml @@ -41,6 +41,6 @@ Item { } transitions : Transition { - NumberAnimation { matchProperties: "y,height" } + NumberAnimation { properties: "y,height" } } } diff --git a/examples/declarative/animations/easing.qml b/examples/declarative/animations/easing.qml index a9ba05f..59e9b17 100644 --- a/examples/declarative/animations/easing.qml +++ b/examples/declarative/animations/easing.qml @@ -80,8 +80,8 @@ Rectangle { transitions: Transition { ParallelAnimation { - NumberAnimation { matchProperties: "x"; easing: type; duration: 1000 } - ColorAnimation { matchProperties: "color"; easing: type; duration: 1000 } + NumberAnimation { properties: "x"; easing: type; duration: 1000 } + ColorAnimation { properties: "color"; easing: type; duration: 1000 } } } } diff --git a/examples/declarative/layouts/Button.qml b/examples/declarative/layouts/Button.qml index 215b536..44d0c7b 100644 --- a/examples/declarative/layouts/Button.qml +++ b/examples/declarative/layouts/Button.qml @@ -17,6 +17,6 @@ Rectangle { border.color: "black"; color: "steelblue"; radius: 5; width: pix.wid transitions: Transition{ - NumberAnimation { matchProperties:"x,left"; easing:"easeInOutQuad"; duration:200 } + NumberAnimation { properties:"x,left"; easing:"easeInOutQuad"; duration:200 } } } diff --git a/examples/declarative/layouts/positioners.qml b/examples/declarative/layouts/positioners.qml index 46762f7..fefd964 100644 --- a/examples/declarative/layouts/positioners.qml +++ b/examples/declarative/layouts/positioners.qml @@ -11,12 +11,12 @@ Rectangle { y: 0 move: Transition { NumberAnimation { - matchProperties: "y"; easing: "easeOutBounce" + properties: "y"; easing: "easeOutBounce" } } add: Transition { NumberAnimation { - matchProperties: "y"; easing: "easeOutQuad" + properties: "y"; easing: "easeOutQuad" } } Rectangle { color: "red"; width: 100; height: 50; border.color: "black"; radius: 15 } @@ -35,12 +35,12 @@ Rectangle { y: 300 move: Transition { NumberAnimation { - matchProperties: "x"; easing: "easeOutBounce" + properties: "x"; easing: "easeOutBounce" } } add: Transition { NumberAnimation { - matchProperties: "x"; easing: "easeOutQuad" + properties: "x"; easing: "easeOutQuad" } } Rectangle { color: "red"; width: 50; height: 100; border.color: "black"; radius: 15 } @@ -101,13 +101,13 @@ Rectangle { move: Transition { NumberAnimation { - matchProperties: "x,y"; easing: "easeOutBounce" + properties: "x,y"; easing: "easeOutBounce" } } add: Transition { NumberAnimation { - matchProperties: "x,y"; easing: "easeOutBounce" + properties: "x,y"; easing: "easeOutBounce" } } @@ -136,13 +136,13 @@ Rectangle { move: Transition { NumberAnimation { - matchProperties: "x,y"; easing: "easeOutBounce" + properties: "x,y"; easing: "easeOutBounce" } } add: Transition { NumberAnimation { - matchProperties: "x,y"; easing: "easeOutBounce" + properties: "x,y"; easing: "easeOutBounce" } } Rectangle { color: "red"; width: 50; height: 50; border.color: "black"; radius: 15 } diff --git a/examples/declarative/listview/dynamic.qml b/examples/declarative/listview/dynamic.qml index 101b708..2607527 100644 --- a/examples/declarative/listview/dynamic.qml +++ b/examples/declarative/listview/dynamic.qml @@ -122,7 +122,7 @@ Rectangle { PropertyChanges { target: verticalScrollBar; opacity: 1 } } ] - transitions: [ Transition { NumberAnimation { matchProperties: "opacity"; duration: 400 } } ] + transitions: [ Transition { NumberAnimation { properties: "opacity"; duration: 400 } } ] } Row { diff --git a/examples/declarative/listview/highlight.qml b/examples/declarative/listview/highlight.qml index 9665499..be1f62d 100644 --- a/examples/declarative/listview/highlight.qml +++ b/examples/declarative/listview/highlight.qml @@ -31,7 +31,7 @@ Rectangle { transitions: [ Transition { NumberAnimation { - matchProperties: "x"; duration: 200 + properties: "x"; duration: 200 } } ] diff --git a/examples/declarative/listview/recipes.qml b/examples/declarative/listview/recipes.qml index c133351..3410f56 100644 --- a/examples/declarative/listview/recipes.qml +++ b/examples/declarative/listview/recipes.qml @@ -124,7 +124,7 @@ Rectangle { ParallelAnimation { ColorAnimation { property: "color"; duration: 500 } NumberAnimation { - duration: 300; matchProperties: "detailsOpacity,x,viewportY,height,width" + duration: 300; properties: "detailsOpacity,x,viewportY,height,width" } } } diff --git a/examples/declarative/parallax/qml/ParallaxView.qml b/examples/declarative/parallax/qml/ParallaxView.qml index ff4a85a..f10d374 100644 --- a/examples/declarative/parallax/qml/ParallaxView.qml +++ b/examples/declarative/parallax/qml/ParallaxView.qml @@ -74,7 +74,7 @@ Item { } transitions: Transition { NumberAnimation { - matchProperties: "scale,y" + properties: "scale,y" } } } diff --git a/examples/declarative/scrollbar/ScrollBar.qml b/examples/declarative/scrollbar/ScrollBar.qml index f68775c..802b537 100644 --- a/examples/declarative/scrollbar/ScrollBar.qml +++ b/examples/declarative/scrollbar/ScrollBar.qml @@ -2,7 +2,7 @@ import Qt 4.6 Item { id: scrollBar - // The matchProperties that define the scrollbar's state. + // The properties that define the scrollbar's state. // position and pageSize are in the range 0.0 - 1.0. They are relative to the // height of the page, i.e. a pageSize of 0.5 means that you can see 50% // of the height of the view. diff --git a/examples/declarative/scrollbar/display.qml b/examples/declarative/scrollbar/display.qml index 0b9f95a..536a8b7 100644 --- a/examples/declarative/scrollbar/display.qml +++ b/examples/declarative/scrollbar/display.qml @@ -27,7 +27,7 @@ Rectangle { from: "*" to: "*" NumberAnimation { - matchProperties: "opacity" + properties: "opacity" duration: 400 } } diff --git a/examples/declarative/searchbox/SearchBox.qml b/examples/declarative/searchbox/SearchBox.qml index 42b5d67..7077a11 100644 --- a/examples/declarative/searchbox/SearchBox.qml +++ b/examples/declarative/searchbox/SearchBox.qml @@ -50,11 +50,11 @@ FocusScope { transitions: [ Transition { from: ""; to: "hasText" - NumberAnimation { exclude: typeSomething; matchProperties: "opacity" } + NumberAnimation { exclude: typeSomething; properties: "opacity" } }, Transition { from: "hasText"; to: "" - NumberAnimation { matchProperties: "opacity" } + NumberAnimation { properties: "opacity" } } ] } diff --git a/examples/declarative/slideswitch/content/Switch.qml b/examples/declarative/slideswitch/content/Switch.qml index 29a62f7..c7f1c24 100644 --- a/examples/declarative/slideswitch/content/Switch.qml +++ b/examples/declarative/slideswitch/content/Switch.qml @@ -66,7 +66,7 @@ Item { //![7] transitions: Transition { - NumberAnimation { matchProperties: "x"; easing: "easeInOutQuad"; duration: 200 } + NumberAnimation { properties: "x"; easing: "easeInOutQuad"; duration: 200 } } //![7] } diff --git a/examples/declarative/snow/ImageBatch.qml b/examples/declarative/snow/ImageBatch.qml index 1d738b2..c2a2674 100644 --- a/examples/declarative/snow/ImageBatch.qml +++ b/examples/declarative/snow/ImageBatch.qml @@ -23,7 +23,7 @@ GridView { transitions: Transition { SequentialAnimation { PauseAnimation { duration: 150 } - PropertyAction { matchProperties: "z" } + PropertyAction { properties: "z" } } } model: XmlListModel { @@ -55,15 +55,15 @@ GridView { to: "selected" SequentialAnimation { PauseAnimation { duration: 150 } - PropertyAction { matchProperties: "z" } - NumberAnimation { matchProperties: "scale"; duration: 150; } + PropertyAction { properties: "z" } + NumberAnimation { properties: "scale"; duration: 150; } } }, Transition { from: "selected" SequentialAnimation { - NumberAnimation { matchProperties: "scale"; duration: 150 } - PropertyAction { matchProperties: "z" } + NumberAnimation { properties: "scale"; duration: 150 } + PropertyAction { properties: "z" } } } ] diff --git a/examples/declarative/states/transitions.qml b/examples/declarative/states/transitions.qml index 925d90e..ba97d9be 100644 --- a/examples/declarative/states/transitions.qml +++ b/examples/declarative/states/transitions.qml @@ -48,23 +48,23 @@ Rectangle { } ] - // transitions define how the matchProperties change. + // transitions define how the properties change. transitions: [ // When transitioning to 'Position1' move x,y over a duration of 1 second, // with easeOutBounce easing function. Transition { from: "*"; to: "Position1" - NumberAnimation { matchProperties: "x,y"; easing: "easeOutBounce"; duration: 1000 } + NumberAnimation { properties: "x,y"; easing: "easeOutBounce"; duration: 1000 } }, // When transitioning to 'Position2' move x,y over a duration of 2 seconds, // with easeInOutQuad easing function. Transition { from: "*"; to: "Position2" - NumberAnimation { matchProperties: "x,y"; easing: "easeInOutQuad"; duration: 2000 } + NumberAnimation { properties: "x,y"; easing: "easeInOutQuad"; duration: 2000 } }, // For any other state changes move x,y linearly over duration of 200ms. Transition { - NumberAnimation { matchProperties: "x,y"; duration: 200 } + NumberAnimation { properties: "x,y"; duration: 200 } } ] } diff --git a/examples/declarative/tutorials/helloworld/tutorial3.qml b/examples/declarative/tutorials/helloworld/tutorial3.qml index 0f27f86..107b066 100644 --- a/examples/declarative/tutorials/helloworld/tutorial3.qml +++ b/examples/declarative/tutorials/helloworld/tutorial3.qml @@ -28,7 +28,7 @@ Rectangle { transitions: Transition { from: ""; to: "down"; reversible: true ParallelAnimation { - NumberAnimation { matchProperties: "y,rotation"; duration: 500; easing: "easeInOutQuad" } + NumberAnimation { properties: "y,rotation"; duration: 500; easing: "easeInOutQuad" } ColorAnimation { duration: 500 } } } diff --git a/examples/declarative/tutorials/samegame/samegame4/content/BoomBlock.qml b/examples/declarative/tutorials/samegame/samegame4/content/BoomBlock.qml index 2eb2ceb..4c2ba43 100644 --- a/examples/declarative/tutorials/samegame/samegame4/content/BoomBlock.qml +++ b/examples/declarative/tutorials/samegame/samegame4/content/BoomBlock.qml @@ -24,7 +24,7 @@ Item { id:block } } opacity: 0 - opacity: Behavior { NumberAnimation { matchProperties:"opacity"; duration: 200 } } + opacity: Behavior { NumberAnimation { properties:"opacity"; duration: 200 } } anchors.fill: parent } //![2] diff --git a/examples/declarative/velocity/Day.qml b/examples/declarative/velocity/Day.qml index 3a7ffa9..030fa13 100644 --- a/examples/declarative/velocity/Day.qml +++ b/examples/declarative/velocity/Day.qml @@ -71,7 +71,7 @@ Rectangle { } transitions: Transition { - NumberAnimation { matchProperties: "rotation,scale"; duration: 200 } + NumberAnimation { properties: "rotation,scale"; duration: 200 } } } } diff --git a/examples/declarative/webview/autosize.qml b/examples/declarative/webview/autosize.qml index 1614906..74c6844 100644 --- a/examples/declarative/webview/autosize.qml +++ b/examples/declarative/webview/autosize.qml @@ -1,7 +1,7 @@ import Qt 4.6 // The WebView size is determined by the width, height, -// preferredWidth, and preferredHeight matchProperties. +// preferredWidth, and preferredHeight properties. Rectangle { id: rect color: "white" diff --git a/examples/declarative/webview/content/FieldText.qml b/examples/declarative/webview/content/FieldText.qml index 6b1d271..b1c1938 100644 --- a/examples/declarative/webview/content/FieldText.qml +++ b/examples/declarative/webview/content/FieldText.qml @@ -149,7 +149,7 @@ Item { to: "*" reversible: true NumberAnimation { - matchProperties: "opacity,leftMargin,rightMargin" + properties: "opacity,leftMargin,rightMargin" duration: 200 } ColorAnimation { diff --git a/examples/declarative/xmldata/yahoonews.qml b/examples/declarative/xmldata/yahoonews.qml index bd14516..23463c2 100644 --- a/examples/declarative/xmldata/yahoonews.qml +++ b/examples/declarative/xmldata/yahoonews.qml @@ -61,8 +61,8 @@ Rectangle { transitions: Transition { from: "*"; to: "Details"; reversible: true SequentialAnimation { - NumberAnimation { duration: 200; matchProperties: "height"; easing: "easeOutQuad" } - NumberAnimation { duration: 200; matchProperties: "opacity" } + NumberAnimation { duration: 200; properties: "height"; easing: "easeOutQuad" } + NumberAnimation { duration: 200; properties: "opacity" } } } } diff --git a/src/declarative/graphicsitems/qmlgraphicsflipable.cpp b/src/declarative/graphicsitems/qmlgraphicsflipable.cpp index 4116817..6857eae 100644 --- a/src/declarative/graphicsitems/qmlgraphicsflipable.cpp +++ b/src/declarative/graphicsitems/qmlgraphicsflipable.cpp @@ -94,7 +94,7 @@ public: } transitions: Transition { - NumberAnimation { matchProperties: "angle"; duration: 2000 } + NumberAnimation { properties: "angle"; duration: 2000 } } MouseRegion { diff --git a/src/declarative/graphicsitems/qmlgraphicspositioners.cpp b/src/declarative/graphicsitems/qmlgraphicspositioners.cpp index 142cdce..4905a30 100644 --- a/src/declarative/graphicsitems/qmlgraphicspositioners.cpp +++ b/src/declarative/graphicsitems/qmlgraphicspositioners.cpp @@ -361,7 +361,7 @@ Column { Column { move: Transition { NumberAnimation { - matchProperties: "y" + properties: "y" ease: "easeOutBounce" } } @@ -470,7 +470,7 @@ Row { id: positioner move: Transition { NumberAnimation { - matchProperties: "x" + properties: "x" ease: "easeOutBounce" } } @@ -592,7 +592,7 @@ Grid { Grid { move: Transition { NumberAnimation { - matchProperties: "x,y" + properties: "x,y" ease: "easeOutBounce" } } @@ -737,7 +737,7 @@ Flow { id: positioner move: Transition { NumberAnimation { - matchProperties: "x,y" + properties: "x,y" ease: "easeOutBounce" } } diff --git a/src/declarative/util/qmlanimation.cpp b/src/declarative/util/qmlanimation.cpp index 6609c73..e36a1cc 100644 --- a/src/declarative/util/qmlanimation.cpp +++ b/src/declarative/util/qmlanimation.cpp @@ -213,7 +213,6 @@ bool QmlAbstractAnimation::isRunning() const void QmlAbstractAnimationPrivate::commence() { Q_Q(QmlAbstractAnimation); - q->prepare(userProperty.value); q->qtAnimation()->start(); if (q->qtAnimation()->state() != QAbstractAnimation::Running) { @@ -238,7 +237,6 @@ QmlMetaProperty QmlAbstractAnimationPrivate::createProperty(QObject *obj, const void QmlAbstractAnimation::setRunning(bool r) { Q_D(QmlAbstractAnimation); - if (r == false) d->avoidPropertyValueSourceStart = true; @@ -541,10 +539,22 @@ void QmlAbstractAnimation::setTarget(const QmlMetaProperty &p) setRunning(true); } +//we rely on setTarget only being called when used as a value source +//so this function allows us to do the same thing as setTarget without +//that assumption +void QmlAbstractAnimation::setDefaultTarget(const QmlMetaProperty &p) +{ + Q_D(QmlAbstractAnimation); + d->userProperty = p; +} + //prepare is called before an animation begins //(when an animation is used as a simple animation, and not as part of a transition) void QmlAbstractAnimation::prepare(QmlMetaProperty &) { + QmlStateActions actions; + QmlMetaProperties properties; + transition(actions, properties, QmlAbstractAnimation::Forward); } void QmlAbstractAnimation::transition(QmlStateActions &actions, @@ -685,7 +695,7 @@ void QmlColorAnimation::setFrom(const QColor &f) } /*! - \qmlproperty color ColorAnimation::from + \qmlproperty color ColorAnimation::to This property holds the ending color. */ QColor QmlColorAnimation::to() const @@ -819,7 +829,7 @@ QML_DEFINE_TYPE(Qt,4,6,ScriptAction,QmlScriptAction) Set \c thewebview.url to the value set for the destination state: \code - PropertyAction { matchTargets: thewebview; matchProperties: "url" } + PropertyAction { target: thewebview; property: "url" } \endcode The PropertyAction is immediate - @@ -866,14 +876,7 @@ void QmlPropertyAction::setTarget(QObject *o) Q_D(QmlPropertyAction); if (d->target == o) return; - d->target = o; - if (d->target && !d->propertyName.isEmpty()) { - d->userProperty = d->createProperty(d->target, d->propertyName, this); - } else { - d->userProperty.invalidate(); - } - emit targetChanged(d->target, d->propertyName); } @@ -896,29 +899,18 @@ void QmlPropertyAction::setProperty(const QString &n) Q_D(QmlPropertyAction); if (d->propertyName == n) return; - d->propertyName = n; - if (d->target && !d->propertyName.isEmpty()) { - d->userProperty = d->createProperty(d->target, d->propertyName, this); - } else { - d->userProperty.invalidate(); - } - emit targetChanged(d->target, d->propertyName); } /*! - \qmlproperty string PropertyAction::matchProperties + \qmlproperty string PropertyAction::properties This property holds a comma-separated list of property names this action - will match against. These names are used in conjunction with matchTargets - to create a list of properties that the action will set, assuming those - properties have changed. + will affect. These names are used in conjunction with targets (and the + singular forms target and property) to create a list of properties that the + action will set. - This property is typically used for an action appearing as part of a Transition. - - By default, no property names will be matched. - - \sa matchTargets PropertyAnimation::matchProperties + \sa targets PropertyAnimation::properties */ QString QmlPropertyAction::properties() const { @@ -936,16 +928,15 @@ void QmlPropertyAction::setProperties(const QString &p) } /*! - \qmlproperty list PropertyAction::matchTargets - This property holds a list of objects this action will match against. - These objects are used in conjunction with matchProperties to create a list of properties - that the action will set, assuming those properties have changed. + \qmlproperty list PropertyAction::targets + This property holds a list of objects this action will affect. + These objects are used in conjunction with properties (and their singular + forms property and target) to create a list of properties + that the action will set. - This property is typically used for an action appearing as part of a Transition. + If no targets are specificed, all changing targets will be animated. - By default, all changing targets will be matched. - - \sa exclude matchProperties PropertyAnimation::matchTargets + \sa exclude properties PropertyAnimation::targets */ QList *QmlPropertyAction::targets() { @@ -956,7 +947,7 @@ QList *QmlPropertyAction::targets() /*! \qmlproperty list PropertyAction::exclude This property holds the objects not to be affected by this animation. - \sa matchTargets + \sa targets */ QList *QmlPropertyAction::exclude() { @@ -984,29 +975,12 @@ void QmlPropertyAction::setValue(const QVariant &v) } } -void QmlPropertyActionPrivate::doAction() -{ - property.write(value, QmlMetaProperty::BypassInterceptor | QmlMetaProperty::DontRemoveBinding); -} - QAbstractAnimation *QmlPropertyAction::qtAnimation() { Q_D(QmlPropertyAction); return d->spa; } -void QmlPropertyAction::prepare(QmlMetaProperty &p) -{ - Q_D(QmlPropertyAction); - - if (d->userProperty.isNull) - d->property = p; - else - d->property = d->userProperty; - - d->spa->setAnimAction(&d->proxy, QAbstractAnimation::KeepWhenStopped); -} - void QmlPropertyAction::transition(QmlStateActions &actions, QmlMetaProperties &modified, TransitionDirection direction) @@ -1029,31 +1003,42 @@ void QmlPropertyAction::transition(QmlStateActions &actions, QStringList props = d->properties.isEmpty() ? QStringList() : d->properties.split(QLatin1Char(',')); for (int ii = 0; ii < props.count(); ++ii) props[ii] = props.at(ii).trimmed(); + if (!d->propertyName.isEmpty()) + props << d->propertyName; - bool hasSelectors = !props.isEmpty() || !d->targets.isEmpty() || !d->exclude.isEmpty(); - bool hasTarget = !d->propertyName.isEmpty() || d->target; + QList targets = d->targets; + if (d->target) + targets.append(d->target); - if (hasSelectors && hasTarget) { - qmlInfo(this) << tr("matchTargets/matchProperties/exclude and target/property are mutually exclusive."); - return; + bool hasSelectors = !props.isEmpty() || !targets.isEmpty() || !d->exclude.isEmpty(); + + if (d->userProperty.isValid() && !hasSelectors) { + props << d->userProperty.value.name(); + targets << d->userProperty.value.object(); } QmlSetPropertyAnimationAction *data = new QmlSetPropertyAnimationAction; bool hasExplicit = false; - if (hasTarget && d->value.isValid()) { - QmlAction myAction; - myAction.property = d->createProperty(target(), d->propertyName, this); - if (myAction.property.isValid()) { - myAction.toValue = d->value; - data->actions << myAction; - hasExplicit = true; - for (int ii = 0; ii < actions.count(); ++ii) { - QmlAction &action = actions[ii]; - if (action.property.object() == myAction.property.object() && - myAction.property.name() == action.property.name()) { - modified << action.property; - break; //### any chance there could be multiples? + //an explicit animation has been specified + if (d->value.isValid()) { + for (int i = 0; i < props.count(); ++i) { + for (int j = 0; j < targets.count(); ++j) { + QmlAction myAction; + myAction.property = d->createProperty(targets.at(j), props.at(i), this); + if (myAction.property.isValid()) { + myAction.toValue = d->value; + QmlPropertyAnimationPrivate::convertVariant(myAction.toValue, myAction.property.propertyType()); + data->actions << myAction; + hasExplicit = true; + for (int ii = 0; ii < actions.count(); ++ii) { + QmlAction &action = actions[ii]; + if (action.property.object() == myAction.property.object() && + myAction.property.name() == action.property.name()) { + modified << action.property; + break; //### any chance there could be multiples? + } + } } } } @@ -1069,31 +1054,18 @@ void QmlPropertyAction::transition(QmlStateActions &actions, QString sPropertyName = action.specifiedProperty; bool same = (obj == sObj); - if ((d->targets.isEmpty() || d->targets.contains(obj) || (!same && d->targets.contains(sObj))) && + if ((targets.isEmpty() || targets.contains(obj) || (!same && targets.contains(sObj))) && (!d->exclude.contains(obj)) && (same || (!d->exclude.contains(sObj))) && (props.contains(propertyName) || (!same && props.contains(sPropertyName)))) { QmlAction myAction = action; if (d->value.isValid()) myAction.toValue = d->value; + QmlPropertyAnimationPrivate::convertVariant(myAction.toValue, myAction.property.propertyType()); modified << action.property; data->actions << myAction; action.fromValue = myAction.toValue; - } else if (d->userProperty.isValid() && - !hasSelectors && !hasTarget) { - if ((d->userProperty.value.object() == obj || (!same && d->userProperty.value.object() == sObj)) && - (d->userProperty.value.name() == propertyName || (!same && d->userProperty.value.name() == sPropertyName))) { - //### same as above. merge - QmlAction myAction = action; - - if (d->value.isValid()) - myAction.toValue = d->value; - - modified << action.property; - data->actions << myAction; - action.fromValue = myAction.toValue; - } } } @@ -1161,24 +1133,7 @@ void QmlParentActionPrivate::init() /*! \qmlproperty Item ParentAction::target - This property holds an explicit target item to reparent. - */ -QmlGraphicsItem *QmlParentAction::object() const -{ - Q_D(const QmlParentAction); - return d->pcTarget; -} - -void QmlParentAction::setObject(QmlGraphicsItem *target) -{ - Q_D(QmlParentAction); - d->pcTarget = target; -} - -/*! - \qmlproperty Item ParentAction::matchTarget - This property holds the item this action will match against -- the item - that the action will reparent, assuming its parent has changed. + This property holds a target item to reparent. In the following example, \c myItem will be reparented by the ParentAction, while \c myOtherItem will not. @@ -1196,24 +1151,23 @@ void QmlParentAction::setObject(QmlGraphicsItem *target) Transition { SequentialAnimation { PropertyAnimation { ... } - ParentAction { matchTargets: myItem } + ParentAction { target: myItem } PropertyAnimation { ... } } } \endqml - This property is typically used for an action appearing as part of a Transition. */ -QmlGraphicsItem *QmlParentAction::matchTarget() const +QmlGraphicsItem *QmlParentAction::object() const { Q_D(const QmlParentAction); return d->pcTarget; } -void QmlParentAction::setMatchTarget(QmlGraphicsItem *target) +void QmlParentAction::setObject(QmlGraphicsItem *target) { Q_D(QmlParentAction); - d->pcMatchTarget = target; + d->pcTarget = target; } /*! @@ -1277,17 +1231,27 @@ void QmlParentAction::transition(QmlStateActions &actions, QmlParentActionData *data = new QmlParentActionData; - if (d->pcTarget && d->pcMatchTarget) { - qmlInfo(this) << tr("matchTarget and target are mutually exclusive."); - return; + //### need to correctly handle modified/done + + bool hasExplicit = false; + if (d->pcTarget && d->pcParent) { + data->reverse = false; + QmlAction myAction; + QmlParentChange *pc = new QmlParentChange; + pc->setObject(d->pcTarget); + pc->setParent(d->pcParent); + myAction.event = pc; + data->pc = pc; + data->actions << myAction; + hasExplicit = true; } + if (!hasExplicit) for (int ii = 0; ii < actions.count(); ++ii) { QmlAction &action = actions[ii]; if (action.event && action.event->typeName() == QLatin1String("ParentChange") - && !d->pcTarget - && (!d->pcMatchTarget || static_cast(action.event)->object() == d->pcMatchTarget)) { + && (!d->pcTarget || static_cast(action.event)->object() == d->pcTarget)) { QmlAction myAction = action; data->reverse = action.reverseEvent; //### this logic differs from PropertyAnimation @@ -1308,17 +1272,6 @@ void QmlParentAction::transition(QmlStateActions &actions, } } - if (d->pcTarget && d->pcParent) { - data->reverse = false; - QmlAction myAction; - QmlParentChange *pc = new QmlParentChange; - pc->setObject(d->pcTarget); - pc->setParent(d->pcParent); - myAction.event = pc; - data->pc = pc; - data->actions << myAction; - } - if (data->actions.count()) { d->cpa->setAnimAction(data, QAbstractAnimation::DeleteWhenStopped); } else { @@ -1336,7 +1289,7 @@ QML_DEFINE_TYPE(Qt,4,6,ParentAction,QmlParentAction) Animate a set of properties over 200ms, from their values in the start state to their values in the end state of the transition: \code - NumberAnimation { matchProperties: "x,y,scale"; duration: 200 } + NumberAnimation { properties: "x,y,scale"; duration: 200 } \endcode */ @@ -1376,7 +1329,7 @@ void QmlNumberAnimation::setFrom(qreal f) /*! \qmlproperty real NumberAnimation::to This property holds the ending value. - If not set, then the value defined in the end state of the transition. + If not set, then the value defined in the end state of the transition or Behavior. */ qreal QmlNumberAnimation::to() const { @@ -1434,7 +1387,7 @@ void QmlVector3dAnimation::setFrom(QVector3D f) /*! \qmlproperty real Vector3dAnimation::to This property holds the ending value. - If not set, then the value defined in the end state of the transition. + If not set, then the value defined in the end state of the transition or Behavior. */ QVector3D QmlVector3dAnimation::to() const { @@ -1495,18 +1448,6 @@ QmlSequentialAnimation::~QmlSequentialAnimation() { } -void QmlSequentialAnimation::prepare(QmlMetaProperty &p) -{ - Q_D(QmlAnimationGroup); - if (d->userProperty.isNull) - d->property = p; - else - d->property = d->userProperty; - - for (int i = 0; i < d->animations.size(); ++i) - d->animations.at(i)->prepare(d->property); -} - QAbstractAnimation *QmlSequentialAnimation::qtAnimation() { Q_D(QmlAnimationGroup); @@ -1526,13 +1467,10 @@ void QmlSequentialAnimation::transition(QmlStateActions &actions, from = d->animations.count() - 1; } - //needed for Behavior - if (d->userProperty.isValid()) { - for (int i = 0; i < d->animations.count(); ++i) - d->animations.at(i)->setTarget(d->userProperty); - } - + bool valid = d->userProperty.isValid(); for (int ii = from; ii < d->animations.count() && ii >= 0; ii += inc) { + if (valid) + d->animations.at(ii)->setDefaultTarget(d->userProperty); d->animations.at(ii)->transition(actions, modified, direction); } } @@ -1574,18 +1512,6 @@ QmlParallelAnimation::~QmlParallelAnimation() { } -void QmlParallelAnimation::prepare(QmlMetaProperty &p) -{ - Q_D(QmlAnimationGroup); - if (d->userProperty.isNull) - d->property = p; - else - d->property = d->userProperty; - - for (int i = 0; i < d->animations.size(); ++i) - d->animations.at(i)->prepare(d->property); -} - QAbstractAnimation *QmlParallelAnimation::qtAnimation() { Q_D(QmlAnimationGroup); @@ -1597,14 +1523,10 @@ void QmlParallelAnimation::transition(QmlStateActions &actions, TransitionDirection direction) { Q_D(QmlAnimationGroup); - - //needed for Behavior - if (d->userProperty.isValid()) { - for (int i = 0; i < d->animations.count(); ++i) - d->animations.at(i)->setTarget(d->userProperty); - } - + bool valid = d->userProperty.isValid(); for (int ii = 0; ii < d->animations.count(); ++ii) { + if (valid) + d->animations.at(ii)->setDefaultTarget(d->userProperty); d->animations.at(ii)->transition(actions, modified, direction); } } @@ -1668,12 +1590,56 @@ void QmlPropertyAnimationPrivate::convertVariant(QVariant &variant, int type) \inherits Animation \brief The PropertyAnimation element allows you to animate property changes. - Animate theObject's size property over 200ms, from its current size to 20-by-20: - \code + PropertyAnimation provides a way to animate changes to a property's value. It can + be used in many different situations: + \list + \o In a Transition + + Animate any objects that have changed their x or y properties in the target state using + an InOutQuad easing curve: + \qml + Transition { PropertyAnimation { properties: "x,y"; easing: "InOutQuad" } } + \endqml + \o In a Behavior + + Animate all changes to a rectangle's x property. + \qml + Rectangle { + x: Behavior { PropertyAnimation {} } + } + \endqml + \o As a property value source + + Repeatedly animate the rectangle's x property. + \qml + Rectangle { + x: SequentialAnimation { + repeat: true + PropertyAnimation { to: 50 } + PropertyAnimation { to: 0 } + } + } + \endqml + \o In a signal handler + + Fade out \c theObject when clicked: + \qml + MouseRegion { + anchors.fill: theObject + onClicked: PropertyAnimation { target: theObject; property: "opacity"; to: 0 } + } + \endqml + \o Standalone + + Animate \c theObject's size property over 200ms, from its current size to 20-by-20: + \qml PropertyAnimation { target: theObject; property: "size"; to: "20x20"; duration: 200 } - \endcode + \endqml + \endlist - For an introduction to animation in QML, see \l{QML Animation}. + Depending on how the animation is used, the set of properties normally used will be + different. For more information see the individual property documentation, as well + as the \l{QML Animation} introduction. */ QmlPropertyAnimation::QmlPropertyAnimation(QObject *parent) @@ -1744,7 +1710,7 @@ void QmlPropertyAnimation::setFrom(const QVariant &f) /*! \qmlproperty real PropertyAnimation::to This property holds the ending value. - If not set, then the value defined in the end state of the transition. + If not set, then the value defined in the end state of the transition or Behavior. */ QVariant QmlPropertyAnimation::to() const { @@ -1955,16 +1921,6 @@ void QmlPropertyAnimation::setEasing(const QString &e) emit easingChanged(e); } -/*! - \qmlproperty Object PropertyAnimation::target - This property holds an explicit target object to animate. - - target is used in conjunction with property to determine - what property should be animated. - - \sa property matchTargets -*/ - QObject *QmlPropertyAnimation::target() const { Q_D(const QmlPropertyAnimation); @@ -1976,27 +1932,10 @@ void QmlPropertyAnimation::setTarget(QObject *o) Q_D(QmlPropertyAnimation); if (d->target == o) return; - d->target = o; - if (d->target && !d->propertyName.isEmpty()) { - d->userProperty = d->createProperty(d->target, d->propertyName, this); - } else { - d->userProperty.invalidate(); - } - emit targetChanged(d->target, d->propertyName); } -/*! - \qmlproperty string PropertyAnimation::property - This property holds an explicit property name to animate. - - property is used in conjunction with target to determine - what property should be animated. - - \sa target matchProperties -*/ - QString QmlPropertyAnimation::property() const { Q_D(const QmlPropertyAnimation); @@ -2008,46 +1947,10 @@ void QmlPropertyAnimation::setProperty(const QString &n) Q_D(QmlPropertyAnimation); if (d->propertyName == n) return; - d->propertyName = n; - if (d->target && !d->propertyName.isEmpty()) { - d->userProperty = d->createProperty(d->target, d->propertyName, this); - } else { - d->userProperty.invalidate(); - } - emit targetChanged(d->target, d->propertyName); } -/*! - \qmlproperty string PropertyAnimation::matchProperties - This property holds a comma-separated list of property names this animation - will match against. These names are used in conjunction with matchTargets - to create a list of properties that the animation will animate, assuming those - properties have changed. - - In the following example, the change in 'x' will be animated by the transition, while - the change in 'y' will not. - \qml - State { - PropertyChanges { - target: myItem - x: 15; y: 15 - } - } - Transition { - PropertyAnimation { - matchProperties: "x" - } - } - \endqml - - This property is typically used for an animation appearing as part of a Transition. - - By default, no property names will be matched. - - \sa matchTargets PropertyAction::matchTargets -*/ QString QmlPropertyAnimation::properties() const { Q_D(const QmlPropertyAnimation); @@ -2065,37 +1968,86 @@ void QmlPropertyAnimation::setProperties(const QString &prop) } /*! - \qmlproperty list PropertyAnimation::matchTargets - This property holds a list of objects this animation will match against. - These objects are used in conjunction with matchProperties to create a list of properties - that the animation will animate, assuming those properties have changed. + \qmlproperty string PropertyAnimation::property + \qmlproperty string PropertyAnimation::properties + \qmlproperty Object PropertyAnimation::target + \qmlproperty list PropertyAnimation::targets - In the following example, the changes to \c myItem will be animated by the transition, while - the changes to \c myOtherItem will not. + These properties are used as a set to determine which properties should be animated. + The singular and plural forms are functionally identical, e.g. \qml - State { - PropertyChanges { - target: myItem - x: 15; y: 15 - } - PropertyChanges { - target: myOtherItem - x: 30; y: 30 - } - } - Transition { - PropertyAnimation { - matchTargets: myItem - matchProperties: "x,y" - } - } + NumberAnimation { target: theItem; property: "x"; to: 500 } + \endqml + has the same meaning as + \qml + NumberAnimation { targets: theItem; properties: "x"; to: 500 } \endqml + The singular forms are slightly optimized, so if you do have only a single target/property + to animate you should try to use them. + + In many cases these properties do not need to be explicitly specified -- they can be + inferred from the animation framework. + \table 80% + \row + \o Value Source / Behavior + \o When an animation is used as a value source or in a Behavior, the default target and property + name to be animated can both be inferred. + \qml + Rectangle { + id: theRect + width: 100; height: 100 + color: Qt.rgba(0,0,1) + x: NumberAnimation { to: 500; repeat: true } //animate theRect's x property + y: Behavior { NumberAnimation {} } //animate theRect's y property + } + \endqml + \row + \o Transition + \o When used in a transition, a property animation is assumed to match \e all targets + but \e no properties. In practice, that means you need to specify at least the properties + in order for the animation to do anything. + \qml + Rectangle { + id: theRect + width: 100; height: 100 + color: Qt.rgba(0,0,1) + Item { id: uselessItem } + states: State { + name: "state1" + PropertyChanges { target: theRect; x: 200; y: 200; z: 4 } + PropertyChanges { target: uselessItem; x: 10; y: 10; z: 2 } + } + transitions: Transition { + //animate both theRect's and uselessItem's x and y to their final values + NumberAnimation { properties: "x,y" } + + //animate theRect's z to its final value + NumberAnimation { target: theRect; property: "z" } + } + } + \endqml + \row + \o Standalone + \o When an animation is used standalone, both the target and property need to be + explicitly specified. + \qml + Rectangle { + id: theRect + width: 100; height: 100 + color: Qt.rgba(0,0,1) + //need to explicitly specify target and property + NumberAnimation { id: theAnim; target: theRect; property: "x" to: 500 } + MouseRegion { + anchors.fill: parent + onClicked: theAnim.start() + } + } + \endqml + \endtable - This property is typically used for an animation appearing as part of a Transition. + As seen in the above example, properties is specified as a comma-separated string of property names to animate. - By default, all changing targets will be matched. - - \sa exclude matchProperties + \sa exclude */ QList *QmlPropertyAnimation::targets() { @@ -2106,7 +2058,7 @@ QList *QmlPropertyAnimation::targets() /*! \qmlproperty list PropertyAnimation::exclude This property holds the items not to be affected by this animation. - \sa matchTargets + \sa targets */ QList *QmlPropertyAnimation::exclude() { @@ -2114,60 +2066,59 @@ QList *QmlPropertyAnimation::exclude() return &d->exclude; } -void QmlPropertyAnimationPrivate::valueChanged(qreal r) -{ - if (!fromSourced) { - if (!fromIsDefined) { - from = property.read(); - convertVariant(from, interpolatorType ? interpolatorType : property.propertyType()); - //### check for invalid variant if using property type - } - fromSourced = true; - } - - if (r == 1.) { - property.write(to, QmlMetaProperty::BypassInterceptor | QmlMetaProperty::DontRemoveBinding); - } else { - if (interpolator) - property.write(interpolator(from.constData(), to.constData(), r), QmlMetaProperty::BypassInterceptor | QmlMetaProperty::DontRemoveBinding); - } -} - QAbstractAnimation *QmlPropertyAnimation::qtAnimation() { Q_D(QmlPropertyAnimation); return d->va; } -void QmlPropertyAnimation::prepare(QmlMetaProperty &p) +struct PropertyUpdater : public QmlTimeLineValue { - Q_D(QmlPropertyAnimation); - if (d->userProperty.isNull) - d->property = p; - else - d->property = d->userProperty; - - if (!d->rangeIsSet) { - d->va->setStartValue(qreal(0)); - d->va->setEndValue(qreal(1)); - d->rangeIsSet = true; - } - - int propType = d->property.propertyType(); - d->convertVariant(d->to, d->interpolatorType ? d->interpolatorType : propType); - if (d->fromIsDefined) - d->convertVariant(d->from, d->interpolatorType ? d->interpolatorType : propType); - - if (!d->interpolatorType) { - //### check for invalid variants - d->interpolator = QVariantAnimationPrivate::getInterpolator(propType); + QmlStateActions actions; + int interpolatorType; //for Number/ColorAnimation + int prevInterpolatorType; //for generic + QVariantAnimation::Interpolator interpolator; + bool reverse; + bool fromSourced; + bool fromDefined; + bool *wasDeleted; + PropertyUpdater() : wasDeleted(0) {} + ~PropertyUpdater() { if (wasDeleted) *wasDeleted = true; } + void setValue(qreal v) + { + bool deleted = false; + wasDeleted = &deleted; + if (reverse) //QVariantAnimation sends us 1->0 when reversed, but we are expecting 0->1 + v = 1 - v; + QmlTimeLineValue::setValue(v); + for (int ii = 0; ii < actions.count(); ++ii) { + QmlAction &action = actions[ii]; + + if (v == 1.) + action.property.write(action.toValue, QmlMetaProperty::BypassInterceptor | QmlMetaProperty::DontRemoveBinding); + else { + if (!fromSourced && !fromDefined) { + action.fromValue = action.property.read(); + if (interpolatorType) + QmlPropertyAnimationPrivate::convertVariant(action.fromValue, interpolatorType); + } + if (!interpolatorType) { + int propType = action.property.propertyType(); + if (!prevInterpolatorType || prevInterpolatorType != propType) { + prevInterpolatorType = propType; + interpolator = QVariantAnimationPrivate::getInterpolator(prevInterpolatorType); + } + } + if (interpolator) + action.property.write(interpolator(action.fromValue.constData(), action.toValue.constData(), v), QmlMetaProperty::BypassInterceptor | QmlMetaProperty::DontRemoveBinding); + } + if (deleted) + return; + } + wasDeleted = 0; + fromSourced = true; } - - d->fromSourced = false; - d->value.QmlTimeLineValue::setValue(0.); - d->va->setAnimValue(&d->value, QAbstractAnimation::KeepWhenStopped); - d->va->setFromSourcedValue(&d->fromSourced); -} +}; void QmlPropertyAnimation::transition(QmlStateActions &actions, QmlMetaProperties &modified, @@ -2176,90 +2127,55 @@ void QmlPropertyAnimation::transition(QmlStateActions &actions, Q_D(QmlPropertyAnimation); Q_UNUSED(direction); - struct PropertyUpdater : public QmlTimeLineValue - { - QmlStateActions actions; - int interpolatorType; //for Number/ColorAnimation - int prevInterpolatorType; //for generic - QVariantAnimation::Interpolator interpolator; - bool reverse; - bool *wasDeleted; - PropertyUpdater() : wasDeleted(0) {} - ~PropertyUpdater() { if (wasDeleted) *wasDeleted = true; } - void setValue(qreal v) - { - bool deleted = false; - wasDeleted = &deleted; - if (reverse) //QVariantAnimation sends us 1->0 when reversed, but we are expecting 0->1 - v = 1 - v; - QmlTimeLineValue::setValue(v); - for (int ii = 0; ii < actions.count(); ++ii) { - QmlAction &action = actions[ii]; - - if (v == 1.) - action.property.write(action.toValue, QmlMetaProperty::BypassInterceptor | QmlMetaProperty::DontRemoveBinding); - else { - if (action.fromValue.isNull()) { - action.fromValue = action.property.read(); - if (interpolatorType) - QmlPropertyAnimationPrivate::convertVariant(action.fromValue, interpolatorType); - } - if (!interpolatorType) { - int propType = action.property.propertyType(); - if (!prevInterpolatorType || prevInterpolatorType != propType) { - prevInterpolatorType = propType; - interpolator = QVariantAnimationPrivate::getInterpolator(prevInterpolatorType); - } - } - if (interpolator) - action.property.write(interpolator(action.fromValue.constData(), action.toValue.constData(), v), QmlMetaProperty::BypassInterceptor | QmlMetaProperty::DontRemoveBinding); - } - if (deleted) - return; - } - wasDeleted = 0; - } - }; - QStringList props = d->properties.isEmpty() ? QStringList() : d->properties.split(QLatin1Char(',')); for (int ii = 0; ii < props.count(); ++ii) props[ii] = props.at(ii).trimmed(); + if (!d->propertyName.isEmpty()) + props << d->propertyName; - bool hasSelectors = !props.isEmpty() || !d->targets.isEmpty() || !d->exclude.isEmpty(); - bool hasTarget = !d->propertyName.isEmpty() || d->target; - - if (hasSelectors && hasTarget) { - qmlInfo(this) << tr("matchTargets/matchProperties/exclude and target/property are mutually exclusive."); - return; - } + QList targets = d->targets; + if (d->target) + targets.append(d->target); + bool hasSelectors = !props.isEmpty() || !targets.isEmpty() || !d->exclude.isEmpty(); bool useType = (props.isEmpty() && d->propertyName.isEmpty() && d->defaultToInterpolatorType) ? true : false; + if (d->userProperty.isValid() && !hasSelectors) { + props << d->userProperty.value.name(); + targets << d->userProperty.value.object(); + } + PropertyUpdater *data = new PropertyUpdater; data->interpolatorType = d->interpolatorType; data->interpolator = d->interpolator; data->reverse = direction == Backward ? true : false; + data->fromSourced = false; + data->fromDefined = d->fromIsDefined; bool hasExplicit = false; //an explicit animation has been specified - if (hasTarget && d->toIsDefined) { - QmlAction myAction; - myAction.property = d->createProperty(target(), d->propertyName, this); - if (myAction.property.isValid()) { - if (d->fromIsDefined) { - d->convertVariant(d->from, d->interpolatorType ? d->interpolatorType : myAction.property.propertyType()); - myAction.fromValue = d->from; - } - d->convertVariant(d->to, d->interpolatorType ? d->interpolatorType : myAction.property.propertyType()); - myAction.toValue = d->to; - data->actions << myAction; - hasExplicit = true; - for (int ii = 0; ii < actions.count(); ++ii) { - QmlAction &action = actions[ii]; - if (action.property.object() == myAction.property.object() && - myAction.property.name() == action.property.name()) { - modified << action.property; - break; //### any chance there could be multiples? + if (d->toIsDefined) { + for (int i = 0; i < props.count(); ++i) { + for (int j = 0; j < targets.count(); ++j) { + QmlAction myAction; + myAction.property = d->createProperty(targets.at(j), props.at(i), this); + if (myAction.property.isValid()) { + if (d->fromIsDefined) { + myAction.fromValue = d->from; + d->convertVariant(myAction.fromValue, d->interpolatorType ? d->interpolatorType : myAction.property.propertyType()); + } + myAction.toValue = d->to; + d->convertVariant(myAction.toValue, d->interpolatorType ? d->interpolatorType : myAction.property.propertyType()); + data->actions << myAction; + hasExplicit = true; + for (int ii = 0; ii < actions.count(); ++ii) { + QmlAction &action = actions[ii]; + if (action.property.object() == myAction.property.object() && + myAction.property.name() == action.property.name()) { + modified << action.property; + break; //### any chance there could be multiples? + } + } } } } @@ -2275,7 +2191,7 @@ void QmlPropertyAnimation::transition(QmlStateActions &actions, QString sPropertyName = action.specifiedProperty; bool same = (obj == sObj); - if ((d->targets.isEmpty() || d->targets.contains(obj) || (!same && d->targets.contains(sObj))) && + if ((targets.isEmpty() || targets.contains(obj) || (!same && targets.contains(sObj))) && (!d->exclude.contains(obj)) && (same || (!d->exclude.contains(sObj))) && (props.contains(propertyName) || (!same && props.contains(sPropertyName)) || (useType && action.property.propertyType() == d->interpolatorType))) { @@ -2295,29 +2211,7 @@ void QmlPropertyAnimation::transition(QmlStateActions &actions, data->actions << myAction; action.fromValue = myAction.toValue; - } else if (d->userProperty.isValid() && - !hasSelectors && !hasTarget) { - if ((d->userProperty.value.object() == obj || (!same && d->userProperty.value.object() == sObj)) && - (d->userProperty.value.name() == propertyName || (!same && d->userProperty.value.name() == sPropertyName))) { - //### same as above. merge - QmlAction myAction = action; - - if (d->fromIsDefined) - myAction.fromValue = d->from; - else - myAction.fromValue = QVariant(); - if (d->toIsDefined) - myAction.toValue = d->to; - - d->convertVariant(myAction.fromValue, d->interpolatorType ? d->interpolatorType : myAction.property.propertyType()); - d->convertVariant(myAction.toValue, d->interpolatorType ? d->interpolatorType : myAction.property.propertyType()); - - modified << action.property; - - data->actions << myAction; - action.fromValue = myAction.toValue; - } - } + } } if (data->actions.count()) { @@ -2327,6 +2221,7 @@ void QmlPropertyAnimation::transition(QmlStateActions &actions, d->rangeIsSet = true; } d->va->setAnimValue(data, QAbstractAnimation::DeleteWhenStopped); + d->va->setFromSourcedValue(&data->fromSourced); } else { delete data; } diff --git a/src/declarative/util/qmlanimation_p.h b/src/declarative/util/qmlanimation_p.h index 6a69e4d..cd4f575 100644 --- a/src/declarative/util/qmlanimation_p.h +++ b/src/declarative/util/qmlanimation_p.h @@ -94,7 +94,8 @@ public: QmlAnimationGroup *group() const; void setGroup(QmlAnimationGroup *); - virtual void setTarget(const QmlMetaProperty &); + virtual void setTarget(const QmlMetaProperty &); //###make private? + void setDefaultTarget(const QmlMetaProperty &); void classBegin(); void componentComplete(); @@ -123,7 +124,7 @@ public: virtual void transition(QmlStateActions &actions, QmlMetaProperties &modified, TransitionDirection direction); - virtual void prepare(QmlMetaProperty &); + void prepare(QmlMetaProperty &); //### make private virtual QAbstractAnimation *qtAnimation() = 0; private Q_SLOTS: @@ -186,8 +187,8 @@ class QmlPropertyAction : public QmlAbstractAnimation Q_PROPERTY(QObject *target READ target WRITE setTarget NOTIFY targetChanged) Q_PROPERTY(QString property READ property WRITE setProperty NOTIFY targetChanged) - Q_PROPERTY(QString matchProperties READ properties WRITE setProperties NOTIFY propertiesChanged) - Q_PROPERTY(QList* matchTargets READ targets) + Q_PROPERTY(QString properties READ properties WRITE setProperties NOTIFY propertiesChanged) + Q_PROPERTY(QList* targets READ targets) Q_PROPERTY(QList* exclude READ exclude) Q_PROPERTY(QVariant value READ value WRITE setValue NOTIFY valueChanged) @@ -220,7 +221,6 @@ protected: QmlMetaProperties &modified, TransitionDirection direction); virtual QAbstractAnimation *qtAnimation(); - virtual void prepare(QmlMetaProperty &); }; class QmlGraphicsItem; @@ -231,8 +231,7 @@ class QmlParentAction : public QmlAbstractAnimation Q_DECLARE_PRIVATE(QmlParentAction) Q_PROPERTY(QmlGraphicsItem *target READ object WRITE setObject) - Q_PROPERTY(QmlGraphicsItem *matchTarget READ matchTarget WRITE setMatchTarget) - Q_PROPERTY(QmlGraphicsItem *parent READ parent WRITE setParent) + Q_PROPERTY(QmlGraphicsItem *parent READ parent WRITE setParent) //### newParent public: QmlParentAction(QObject *parent=0); @@ -241,9 +240,6 @@ public: QmlGraphicsItem *object() const; void setObject(QmlGraphicsItem *); - QmlGraphicsItem *matchTarget() const; - void setMatchTarget(QmlGraphicsItem *); - QmlGraphicsItem *parent() const; void setParent(QmlGraphicsItem *); @@ -266,8 +262,8 @@ class Q_AUTOTEST_EXPORT QmlPropertyAnimation : public QmlAbstractAnimation Q_PROPERTY(QString easing READ easing WRITE setEasing NOTIFY easingChanged) Q_PROPERTY(QObject *target READ target WRITE setTarget NOTIFY targetChanged) Q_PROPERTY(QString property READ property WRITE setProperty NOTIFY targetChanged) - Q_PROPERTY(QString matchProperties READ properties WRITE setProperties NOTIFY propertiesChanged) - Q_PROPERTY(QList* matchTargets READ targets) + Q_PROPERTY(QString properties READ properties WRITE setProperties NOTIFY propertiesChanged) + Q_PROPERTY(QList* targets READ targets) Q_PROPERTY(QList* exclude READ exclude) public: @@ -303,7 +299,6 @@ protected: QmlMetaProperties &modified, TransitionDirection direction); virtual QAbstractAnimation *qtAnimation(); - virtual void prepare(QmlMetaProperty &); Q_SIGNALS: void durationChanged(int); @@ -401,7 +396,6 @@ protected: QmlMetaProperties &modified, TransitionDirection direction); virtual QAbstractAnimation *qtAnimation(); - virtual void prepare(QmlMetaProperty &); }; class QmlParallelAnimation : public QmlAnimationGroup @@ -418,7 +412,6 @@ protected: QmlMetaProperties &modified, TransitionDirection direction); virtual QAbstractAnimation *qtAnimation(); - virtual void prepare(QmlMetaProperty &); }; QT_END_NAMESPACE diff --git a/src/declarative/util/qmlanimation_p_p.h b/src/declarative/util/qmlanimation_p_p.h index d680194..2dc59f9 100644 --- a/src/declarative/util/qmlanimation_p_p.h +++ b/src/declarative/util/qmlanimation_p_p.h @@ -151,6 +151,8 @@ public: { if (state() == Running) stop(); + if (policy == DeleteWhenStopped) + delete animValue; animValue = value; policy = p; } @@ -165,16 +167,17 @@ protected: animValue->setValue(value.toReal()); } virtual void updateState(State newState, State oldState) - { + { QVariantAnimation::updateState(newState, oldState); if (newState == Running) { //check for new from every loop if (fromSourced) *fromSourced = false; - } else if (newState == Stopped && policy == DeleteWhenStopped) { + } /*else if (newState == Stopped && policy == DeleteWhenStopped) { delete animValue; animValue = 0; - } + }*/ //### we get a stop each loop if we are in a group + //### top-level animation is the only reliable one for this } private: @@ -265,7 +268,7 @@ class QmlPropertyActionPrivate : public QmlAbstractAnimationPrivate Q_DECLARE_PUBLIC(QmlPropertyAction) public: QmlPropertyActionPrivate() - : QmlAbstractAnimationPrivate(), target(0), proxy(this), spa(0) {} + : QmlAbstractAnimationPrivate(), target(0), spa(0) {} void init(); @@ -277,10 +280,6 @@ public: QmlNullableValue value; - void doAction(); - - QAnimationActionProxy proxy; QActionAnimation *spa; }; @@ -289,12 +288,11 @@ class QmlParentActionPrivate : public QmlAbstractAnimationPrivate Q_DECLARE_PUBLIC(QmlParentAction) public: QmlParentActionPrivate() - : QmlAbstractAnimationPrivate(), pcTarget(0), pcMatchTarget(0), pcParent(0) {} + : QmlAbstractAnimationPrivate(), pcTarget(0), pcParent(0) {} void init(); QmlGraphicsItem *pcTarget; - QmlGraphicsItem *pcMatchTarget; QmlGraphicsItem *pcParent; void doAction(); @@ -346,8 +344,7 @@ class QmlPropertyAnimationPrivate : public QmlAbstractAnimationPrivate public: QmlPropertyAnimationPrivate() : QmlAbstractAnimationPrivate(), target(0), fromSourced(false), fromIsDefined(false), toIsDefined(false), - rangeIsSet(false), defaultToInterpolatorType(0), interpolatorType(0), interpolator(0), va(0), - value(this, &QmlPropertyAnimationPrivate::valueChanged) {} + rangeIsSet(false), defaultToInterpolatorType(0), interpolatorType(0), interpolator(0), va(0) {} void init(); @@ -371,9 +368,6 @@ public: QVariantAnimation::Interpolator interpolator; QmlTimeLineValueAnimator *va; - virtual void valueChanged(qreal); - - QmlTimeLineValueProxy value; static QVariant interpolateVariant(const QVariant &from, const QVariant &to, qreal progress); static void convertVariant(QVariant &variant, int type); diff --git a/src/declarative/util/qmlbehavior.cpp b/src/declarative/util/qmlbehavior.cpp index e8feeaa..5e11dea 100644 --- a/src/declarative/util/qmlbehavior.cpp +++ b/src/declarative/util/qmlbehavior.cpp @@ -125,7 +125,7 @@ void QmlBehavior::setAnimation(QmlAbstractAnimation *animation) d->animation = animation; if (d->animation) - d->animation->setTarget(d->property); + d->animation->setDefaultTarget(d->property); } /*! @@ -183,7 +183,7 @@ void QmlBehavior::setTarget(const QmlMetaProperty &property) d->property = property; d->currentValue = property.read(); if (d->animation) - d->animation->setTarget(property); + d->animation->setDefaultTarget(property); } QT_END_NAMESPACE diff --git a/src/declarative/util/qmlstateoperations.cpp b/src/declarative/util/qmlstateoperations.cpp index cefe2bc..b68a59c 100644 --- a/src/declarative/util/qmlstateoperations.cpp +++ b/src/declarative/util/qmlstateoperations.cpp @@ -403,7 +403,7 @@ QString QmlStateChangeScript::typeName() const so you can animate them as you would normally changes to these properties: \qml //animate our anchor changes - NumberAnimation { matchTargets: content; matchProperties: "x,y,width,height" } + NumberAnimation { targets: content; properties: "x,y,width,height" } \endqml For more information on anchors see \l {anchor-layout}{Anchor Layouts}. diff --git a/tests/auto/declarative/qmlanimations/data/badtype4.qml b/tests/auto/declarative/qmlanimations/data/badtype4.qml index a4cf265..2ffed37 100644 --- a/tests/auto/declarative/qmlanimations/data/badtype4.qml +++ b/tests/auto/declarative/qmlanimations/data/badtype4.qml @@ -21,7 +21,7 @@ Rectangle { } transitions: Transition { //comment out each in turn to make sure each only animates the relevant property - ColorAnimation { matchProperties: "x,color"; duration: 1000 } //x is real, color is color - NumberAnimation { matchProperties: "x,color"; duration: 1000 } //x is real, color is color + ColorAnimation { properties: "x,color"; duration: 1000 } //x is real, color is color + NumberAnimation { properties: "x,color"; duration: 1000 } //x is real, color is color } } diff --git a/tests/auto/declarative/qmlanimations/data/dontAutoStart.qml b/tests/auto/declarative/qmlanimations/data/dontAutoStart.qml new file mode 100644 index 0000000..d9660b6 --- /dev/null +++ b/tests/auto/declarative/qmlanimations/data/dontAutoStart.qml @@ -0,0 +1,18 @@ +import Qt 4.6 + +Rectangle { + id: wrapper + width: 600 + height: 400 + + Rectangle { + id: redRect + width: 100; height: 100 + color: Qt.rgba(1,0,0) + x: Behavior { + NumberAnimation { objectName: "MyAnim"; target: redRect; property: "y"; to: 300; repeat: true} + } + + } + +} diff --git a/tests/auto/declarative/qmlanimations/data/dotproperty.qml b/tests/auto/declarative/qmlanimations/data/dotproperty.qml index 369491f..08bb5d8 100644 --- a/tests/auto/declarative/qmlanimations/data/dotproperty.qml +++ b/tests/auto/declarative/qmlanimations/data/dotproperty.qml @@ -19,6 +19,6 @@ Rectangle { PropertyChanges { target: myRect; border.color: "blue" } } transitions: Transition { - ColorAnimation { matchProperties: "border.color"; duration: 1000 } + ColorAnimation { properties: "border.color"; duration: 1000 } } } diff --git a/tests/auto/declarative/qmlanimations/data/mixedtype1.qml b/tests/auto/declarative/qmlanimations/data/mixedtype1.qml index 87f4f16..b46270c 100644 --- a/tests/auto/declarative/qmlanimations/data/mixedtype1.qml +++ b/tests/auto/declarative/qmlanimations/data/mixedtype1.qml @@ -20,6 +20,6 @@ Rectangle { PropertyChanges { target: myRect; x: 200; border.width: 10 } } transitions: Transition { - PropertyAnimation { matchProperties: "x,border.width"; duration: 1000 } //x is real, border.width is int + PropertyAnimation { properties: "x,border.width"; duration: 1000 } //x is real, border.width is int } } diff --git a/tests/auto/declarative/qmlanimations/data/mixedtype2.qml b/tests/auto/declarative/qmlanimations/data/mixedtype2.qml index d555abd..15537f1 100644 --- a/tests/auto/declarative/qmlanimations/data/mixedtype2.qml +++ b/tests/auto/declarative/qmlanimations/data/mixedtype2.qml @@ -20,6 +20,6 @@ Rectangle { PropertyChanges { target: myRect; x: 200; color: "blue" } } transitions: Transition { - PropertyAnimation { matchProperties: "x,color"; duration: 1000 } //x is real, color is color + PropertyAnimation { properties: "x,color"; duration: 1000 } //x is real, color is color } } diff --git a/tests/auto/declarative/qmlanimations/data/properties2.qml b/tests/auto/declarative/qmlanimations/data/properties2.qml index 86568ca..6c96155 100644 --- a/tests/auto/declarative/qmlanimations/data/properties2.qml +++ b/tests/auto/declarative/qmlanimations/data/properties2.qml @@ -9,6 +9,6 @@ Rectangle { color: "red" width: 50; height: 50 x: 100; y: 100 - x: NumberAnimation { matchTargets: theRect; matchProperties: "x"; to: 200; } + x: NumberAnimation { targets: theRect; properties: "x"; to: 200; } } } diff --git a/tests/auto/declarative/qmlanimations/data/properties5.qml b/tests/auto/declarative/qmlanimations/data/properties5.qml index 56e0be8..38396b1 100644 --- a/tests/auto/declarative/qmlanimations/data/properties5.qml +++ b/tests/auto/declarative/qmlanimations/data/properties5.qml @@ -9,6 +9,6 @@ Rectangle { color: "red" width: 50; height: 50 x: 100; y: 100 - x: NumberAnimation { matchTargets: theRect; matchProperties: "y"; to: 200; } + x: NumberAnimation { targets: theRect; properties: "y"; to: 200; } } } diff --git a/tests/auto/declarative/qmlanimations/data/propertiesTransition.qml b/tests/auto/declarative/qmlanimations/data/propertiesTransition.qml index 75603b9..2f7fd4a 100644 --- a/tests/auto/declarative/qmlanimations/data/propertiesTransition.qml +++ b/tests/auto/declarative/qmlanimations/data/propertiesTransition.qml @@ -19,7 +19,7 @@ Rectangle { } } transitions: Transition { - NumberAnimation { matchTargets: theRect; matchProperties: "x" } + NumberAnimation { targets: theRect; properties: "x" } } MouseRegion { diff --git a/tests/auto/declarative/qmlanimations/data/propertiesTransition3.qml b/tests/auto/declarative/qmlanimations/data/propertiesTransition3.qml index eedba7b..5aaaab8 100644 --- a/tests/auto/declarative/qmlanimations/data/propertiesTransition3.qml +++ b/tests/auto/declarative/qmlanimations/data/propertiesTransition3.qml @@ -19,7 +19,7 @@ Rectangle { } } transitions: Transition { - NumberAnimation { matchTargets: theRect; matchProperties: "y" } + NumberAnimation { targets: theRect; properties: "y" } } MouseRegion { diff --git a/tests/auto/declarative/qmlanimations/data/propertiesTransition4.qml b/tests/auto/declarative/qmlanimations/data/propertiesTransition4.qml index 301f796..b7ebb1b 100644 --- a/tests/auto/declarative/qmlanimations/data/propertiesTransition4.qml +++ b/tests/auto/declarative/qmlanimations/data/propertiesTransition4.qml @@ -19,7 +19,7 @@ Rectangle { } } transitions: Transition { - NumberAnimation { target: theRect; matchProperties: "x" } + NumberAnimation { target: theRect; properties: "x" } } MouseRegion { diff --git a/tests/auto/declarative/qmlanimations/data/propertiesTransition5.qml b/tests/auto/declarative/qmlanimations/data/propertiesTransition5.qml index 565c519..9034fc5 100644 --- a/tests/auto/declarative/qmlanimations/data/propertiesTransition5.qml +++ b/tests/auto/declarative/qmlanimations/data/propertiesTransition5.qml @@ -19,7 +19,7 @@ Rectangle { } } transitions: Transition { - NumberAnimation { matchTargets: theRect; property: "x" } + NumberAnimation { targets: theRect; property: "x" } } MouseRegion { diff --git a/tests/auto/declarative/qmlanimations/data/propertiesTransition6.qml b/tests/auto/declarative/qmlanimations/data/propertiesTransition6.qml index b541dab..3d8be51 100644 --- a/tests/auto/declarative/qmlanimations/data/propertiesTransition6.qml +++ b/tests/auto/declarative/qmlanimations/data/propertiesTransition6.qml @@ -19,7 +19,7 @@ Rectangle { } } transitions: Transition { - NumberAnimation { matchTargets: theItem; matchProperties: "x" } + NumberAnimation { targets: theItem; properties: "x" } } MouseRegion { diff --git a/tests/auto/declarative/qmlanimations/tst_qmlanimations.cpp b/tests/auto/declarative/qmlanimations/tst_qmlanimations.cpp index 92b0bf2..0f39c9d 100644 --- a/tests/auto/declarative/qmlanimations/tst_qmlanimations.cpp +++ b/tests/auto/declarative/qmlanimations/tst_qmlanimations.cpp @@ -312,14 +312,12 @@ void tst_qmlanimations::badProperties() QmlComponent c1(&engine, QUrl::fromLocalFile(SRCDIR "/data/badproperty1.qml")); QByteArray message = "QML ColorAnimation (" + QUrl::fromLocalFile(SRCDIR "/data/badproperty1.qml").toString().toUtf8() + ":18:9) Cannot animate non-existent property \"border.colr\""; QTest::ignoreMessage(QtWarningMsg, message); - QTest::ignoreMessage(QtWarningMsg, message); // why twice? QmlGraphicsRectangle *rect = qobject_cast(c1.create()); QVERIFY(rect); QmlComponent c2(&engine, QUrl::fromLocalFile(SRCDIR "/data/badproperty2.qml")); message = "QML ColorAnimation (" + QUrl::fromLocalFile(SRCDIR "/data/badproperty2.qml").toString().toUtf8() + ":18:9) Cannot animate read-only property \"border\""; QTest::ignoreMessage(QtWarningMsg, message); - QTest::ignoreMessage(QtWarningMsg, message); // why twice? rect = qobject_cast(c2.create()); QVERIFY(rect); @@ -427,9 +425,8 @@ void tst_qmlanimations::properties() QmlGraphicsRectangle *myRect = rect->findChild("TheRect"); QVERIFY(myRect); QTest::qWait(waitDuration); - QEXPECT_FAIL("", "QTBUG-8072", Continue); QTIMED_COMPARE(myRect->x(),qreal(100)); - QTIMED_COMPARE(myRect->y(),qreal(100)); + QTIMED_COMPARE(myRect->y(),qreal(200)); } } @@ -472,9 +469,9 @@ void tst_qmlanimations::propertiesTransition() QmlGraphicsRectangle *myRect = rect->findChild("TheRect"); QVERIFY(myRect); - QTest::ignoreMessage(QtWarningMsg, "QML NumberAnimation (" + QUrl::fromLocalFile(SRCDIR "/data/propertiesTransition4.qml").toString().toUtf8() + ":22:9) matchTargets/matchProperties/exclude and target/property are mutually exclusive."); rect->setState("moved"); QCOMPARE(myRect->x(),qreal(200)); + QCOMPARE(myRect->y(),qreal(100)); } { @@ -485,9 +482,10 @@ void tst_qmlanimations::propertiesTransition() QmlGraphicsRectangle *myRect = rect->findChild("TheRect"); QVERIFY(myRect); - QTest::ignoreMessage(QtWarningMsg, "QML NumberAnimation (" + QUrl::fromLocalFile(SRCDIR "/data/propertiesTransition5.qml").toString().toUtf8() + ":22:9) matchTargets/matchProperties/exclude and target/property are mutually exclusive."); rect->setState("moved"); - QCOMPARE(myRect->x(),qreal(200)); + QCOMPARE(myRect->x(),qreal(100)); + QTest::qWait(waitDuration); + QTIMED_COMPARE(myRect->x(),qreal(200)); } { @@ -496,12 +494,27 @@ void tst_qmlanimations::propertiesTransition() QmlGraphicsRectangle *rect = qobject_cast(c.create()); QVERIFY(rect); - //### should output warning at some point -- theItem doesn't exist QmlGraphicsRectangle *myRect = rect->findChild("TheRect"); QVERIFY(myRect); rect->setState("moved"); - QCOMPARE(myRect->x(),qreal(200)); + QCOMPARE(myRect->x(),qreal(100)); + QTest::qWait(waitDuration); + QTIMED_COMPARE(myRect->x(),qreal(200)); } + + /*{ + QmlEngine engine; + QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/propertiesTransition6.qml")); + QmlGraphicsRectangle *rect = qobject_cast(c.create()); + QVERIFY(rect); + + QmlGraphicsRectangle *myRect = rect->findChild("TheRect"); + QVERIFY(myRect); + rect->setState("moved"); + QCOMPARE(myRect->x(),qreal(100)); + QTest::qWait(waitDuration); + QTIMED_COMPARE(myRect->x(),qreal(100)); + }*/ } void tst_qmlanimations::easingStringConversion() @@ -606,6 +619,19 @@ void tst_qmlanimations::propertyValueSourceDefaultStart() QVERIFY(myAnim); QVERIFY(myAnim->isRunning() == false); } + + { + QmlEngine engine; + + QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/dontAutoStart.qml")); + + QmlGraphicsRectangle *rect = qobject_cast(c.create()); + QVERIFY(rect); + + QmlAbstractAnimation *myAnim = rect->findChild("MyAnim"); + QVERIFY(myAnim && myAnim->qtAnimation()); + QVERIFY(myAnim->qtAnimation()->state() == QAbstractAnimation::Stopped); + } } QTEST_MAIN(tst_qmlanimations) diff --git a/tests/auto/declarative/qmlbehaviors/data/explicit.qml b/tests/auto/declarative/qmlbehaviors/data/explicit.qml new file mode 100644 index 0000000..ba36d93 --- /dev/null +++ b/tests/auto/declarative/qmlbehaviors/data/explicit.qml @@ -0,0 +1,26 @@ +import Qt 4.6 +Rectangle { + width: 400 + height: 400 + Rectangle { + id: rect + objectName: "MyRect" + width: 100; height: 100; color: "green" + x: Behavior { + objectName: "MyBehavior"; + NumberAnimation { target: rect; property: "x"; duration: 200; } + } + } + MouseRegion { + id: clicker + anchors.fill: parent + } + states: State { + name: "moved" + when: clicker.pressed + PropertyChanges { + target: rect + x: 200 + } + } +} diff --git a/tests/auto/declarative/qmlbehaviors/data/nonSelecting.qml b/tests/auto/declarative/qmlbehaviors/data/nonSelecting.qml deleted file mode 100644 index ba36d93..0000000 --- a/tests/auto/declarative/qmlbehaviors/data/nonSelecting.qml +++ /dev/null @@ -1,26 +0,0 @@ -import Qt 4.6 -Rectangle { - width: 400 - height: 400 - Rectangle { - id: rect - objectName: "MyRect" - width: 100; height: 100; color: "green" - x: Behavior { - objectName: "MyBehavior"; - NumberAnimation { target: rect; property: "x"; duration: 200; } - } - } - MouseRegion { - id: clicker - anchors.fill: parent - } - states: State { - name: "moved" - when: clicker.pressed - PropertyChanges { - target: rect - x: 200 - } - } -} diff --git a/tests/auto/declarative/qmlbehaviors/data/nonSelecting2.qml b/tests/auto/declarative/qmlbehaviors/data/nonSelecting2.qml index e9849eb..59cbd1a 100644 --- a/tests/auto/declarative/qmlbehaviors/data/nonSelecting2.qml +++ b/tests/auto/declarative/qmlbehaviors/data/nonSelecting2.qml @@ -8,7 +8,7 @@ Rectangle { width: 100; height: 100; color: "green" x: Behavior { objectName: "MyBehavior"; - NumberAnimation { matchTargets: rect; matchProperties: "y"; duration: 200; } + NumberAnimation { targets: rect; properties: "y"; duration: 200; } } } MouseRegion { diff --git a/tests/auto/declarative/qmlbehaviors/tst_qmlbehaviors.cpp b/tests/auto/declarative/qmlbehaviors/tst_qmlbehaviors.cpp index aa8d057..47bd329 100644 --- a/tests/auto/declarative/qmlbehaviors/tst_qmlbehaviors.cpp +++ b/tests/auto/declarative/qmlbehaviors/tst_qmlbehaviors.cpp @@ -63,6 +63,7 @@ private slots: //void transitionOverrides(); void group(); void emptyBehavior(); + void explicitSelection(); void nonSelectingBehavior(); void reassignedAnimation(); void disabled(); @@ -225,19 +226,23 @@ void tst_qmlbehaviors::emptyBehavior() QCOMPARE(x, qreal(200)); //should change immediately } -void tst_qmlbehaviors::nonSelectingBehavior() +void tst_qmlbehaviors::explicitSelection() { { QmlEngine engine; - QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/nonSelecting.qml")); + QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/explicit.qml")); QmlGraphicsRectangle *rect = qobject_cast(c.create()); QVERIFY(rect); rect->setState("moved"); + QTest::qWait(100); qreal x = qobject_cast(rect->findChild("MyRect"))->x(); - QCOMPARE(x, qreal(200)); //should change immediately + QVERIFY(x > 0 && x < 200); //i.e. the behavior has been triggered } +} +void tst_qmlbehaviors::nonSelectingBehavior() +{ { QmlEngine engine; QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/nonSelecting2.qml")); diff --git a/tests/auto/declarative/qmlgraphicspositioners/data/grid-animated.qml b/tests/auto/declarative/qmlgraphicspositioners/data/grid-animated.qml index 022019c..f6376a1 100644 --- a/tests/auto/declarative/qmlgraphicspositioners/data/grid-animated.qml +++ b/tests/auto/declarative/qmlgraphicspositioners/data/grid-animated.qml @@ -7,12 +7,12 @@ Item { columns: 3 add: Transition { NumberAnimation { - matchProperties: "x,y"; + properties: "x,y"; } } move: Transition { NumberAnimation { - matchProperties: "x,y"; + properties: "x,y"; } } Rectangle { diff --git a/tests/auto/declarative/qmlgraphicspositioners/data/horizontal-animated.qml b/tests/auto/declarative/qmlgraphicspositioners/data/horizontal-animated.qml index eba165c..c113a36 100644 --- a/tests/auto/declarative/qmlgraphicspositioners/data/horizontal-animated.qml +++ b/tests/auto/declarative/qmlgraphicspositioners/data/horizontal-animated.qml @@ -6,12 +6,12 @@ Item { Row { add: Transition { NumberAnimation { - matchProperties: "x"; + properties: "x"; } } move: Transition { NumberAnimation { - matchProperties: "x"; + properties: "x"; } } Rectangle { diff --git a/tests/auto/declarative/qmlgraphicspositioners/data/vertical-animated.qml b/tests/auto/declarative/qmlgraphicspositioners/data/vertical-animated.qml index 8e3abbd..10f6cbb 100644 --- a/tests/auto/declarative/qmlgraphicspositioners/data/vertical-animated.qml +++ b/tests/auto/declarative/qmlgraphicspositioners/data/vertical-animated.qml @@ -6,12 +6,12 @@ Item { Column { add: Transition { NumberAnimation { - matchProperties: "y"; + properties: "y"; } } move: Transition { NumberAnimation { - matchProperties: "y"; + properties: "y"; } } Rectangle { diff --git a/tests/auto/declarative/visual/Package_Views/packageviews.qml b/tests/auto/declarative/visual/Package_Views/packageviews.qml index c8016b6..dcfe7de 100644 --- a/tests/auto/declarative/visual/Package_Views/packageviews.qml +++ b/tests/auto/declarative/visual/Package_Views/packageviews.qml @@ -64,7 +64,7 @@ Rectangle { from: "*"; to: "*" SequentialAnimation { ParentAction{} - NumberAnimation { matchProperties: "x,y,width"; easing: "easeInOutQuad" } + NumberAnimation { properties: "x,y,width"; easing: "easeInOutQuad" } } } ] diff --git a/tests/auto/declarative/visual/animation/bindinganimation/bindinganimation.qml b/tests/auto/declarative/visual/animation/bindinganimation/bindinganimation.qml index 732eb59..5230ca4 100644 --- a/tests/auto/declarative/visual/animation/bindinganimation/bindinganimation.qml +++ b/tests/auto/declarative/visual/animation/bindinganimation/bindinganimation.qml @@ -28,7 +28,7 @@ Rectangle { transitions: [ Transition { NumberAnimation { - matchProperties: "x" + properties: "x" } } ] diff --git a/tests/auto/declarative/visual/animation/easing/easing.qml b/tests/auto/declarative/visual/animation/easing/easing.qml index 1e8e907..f81400b 100644 --- a/tests/auto/declarative/visual/animation/easing/easing.qml +++ b/tests/auto/declarative/visual/animation/easing/easing.qml @@ -176,7 +176,7 @@ Rectangle { to: "to" reversible: true NumberAnimation { - matchProperties: "x" + properties: "x" easing: type duration: 1000 } diff --git a/tests/auto/declarative/visual/animation/loop/data/loop.0.png b/tests/auto/declarative/visual/animation/loop/data/loop.0.png new file mode 100644 index 0000000..f4301d3 Binary files /dev/null and b/tests/auto/declarative/visual/animation/loop/data/loop.0.png differ diff --git a/tests/auto/declarative/visual/animation/loop/data/loop.1.png b/tests/auto/declarative/visual/animation/loop/data/loop.1.png new file mode 100644 index 0000000..ceb0e20 Binary files /dev/null and b/tests/auto/declarative/visual/animation/loop/data/loop.1.png differ diff --git a/tests/auto/declarative/visual/animation/loop/data/loop.2.png b/tests/auto/declarative/visual/animation/loop/data/loop.2.png new file mode 100644 index 0000000..197c8c0 Binary files /dev/null and b/tests/auto/declarative/visual/animation/loop/data/loop.2.png differ diff --git a/tests/auto/declarative/visual/animation/loop/data/loop.3.png b/tests/auto/declarative/visual/animation/loop/data/loop.3.png new file mode 100644 index 0000000..3a4327e Binary files /dev/null and b/tests/auto/declarative/visual/animation/loop/data/loop.3.png differ diff --git a/tests/auto/declarative/visual/animation/loop/data/loop.4.png b/tests/auto/declarative/visual/animation/loop/data/loop.4.png new file mode 100644 index 0000000..2397719 Binary files /dev/null and b/tests/auto/declarative/visual/animation/loop/data/loop.4.png differ diff --git a/tests/auto/declarative/visual/animation/loop/data/loop.5.png b/tests/auto/declarative/visual/animation/loop/data/loop.5.png new file mode 100644 index 0000000..70d91a2 Binary files /dev/null and b/tests/auto/declarative/visual/animation/loop/data/loop.5.png differ diff --git a/tests/auto/declarative/visual/animation/loop/data/loop.qml b/tests/auto/declarative/visual/animation/loop/data/loop.qml new file mode 100644 index 0000000..8804d44 --- /dev/null +++ b/tests/auto/declarative/visual/animation/loop/data/loop.qml @@ -0,0 +1,1471 @@ +import Qt.VisualTest 4.6 + +VisualTest { + Frame { + msec: 0 + } + Frame { + msec: 16 + hash: "eff7cc4b163dceb6084270cc589393f1" + } + Frame { + msec: 32 + hash: "1012b52727ae98522061945e32a6269a" + } + Frame { + msec: 48 + hash: "06c3f3c1fa014b0eb7341e0a45ca16e4" + } + Frame { + msec: 64 + hash: "71ecb0af25649c056310d3b865d4144d" + } + Frame { + msec: 80 + hash: "e249fe5b113797433f96a2f84d47e42b" + } + Frame { + msec: 96 + hash: "2a7256921c25c79c22263f2b48d4e98c" + } + Frame { + msec: 112 + hash: "8657944b456402622f2991a0c9acc2fb" + } + Frame { + msec: 128 + hash: "c919a94cd7afb1fbad4c88537af00869" + } + Frame { + msec: 144 + hash: "303b5057d94e328f9447a01d54eea93d" + } + Frame { + msec: 160 + hash: "72eb974dc008c9454935b18b47d4d9e6" + } + Frame { + msec: 176 + hash: "545f258cb0ec7f5d951b74cc7d3f4f0d" + } + Frame { + msec: 192 + hash: "3b3d6046fb01adf7c8a7f67bbc46d28e" + } + Frame { + msec: 208 + hash: "12f7556076cf7a4c2f029dab80e666e7" + } + Frame { + msec: 224 + hash: "fab272c7dce2bbee4042764d38c7ceb5" + } + Frame { + msec: 240 + hash: "ff8addee408527bbaed1819bae07c23f" + } + Frame { + msec: 256 + hash: "53eb6f575db2af3635139e5ddbd7b2f9" + } + Frame { + msec: 272 + hash: "a2fa1cf169acb8ff26a2c5ec1f1d5c81" + } + Frame { + msec: 288 + hash: "ab8d5d6d146ed11b92bc93e78f28e50c" + } + Frame { + msec: 304 + hash: "0fbfc6609b082008e44592067b18ab63" + } + Frame { + msec: 320 + hash: "7fbeda19c19c62a0af5f7f98e633993f" + } + Frame { + msec: 336 + hash: "1882b591bc9d4e79d69d0baecb78b700" + } + Frame { + msec: 352 + hash: "dde429007f876206f3ec0c68d239983e" + } + Frame { + msec: 368 + hash: "b656bdba2978a9a1af511cc2bb0cb59a" + } + Frame { + msec: 384 + hash: "1f6573bf67b2893c94f0c2d40213dc73" + } + Frame { + msec: 400 + hash: "f5786fb532300a1b2f820251fc17c775" + } + Frame { + msec: 416 + hash: "a0e9c4bd3b6c4cdadd40bdf3ca5e2986" + } + Frame { + msec: 432 + hash: "073f74ab23a1173025b3c63424ce2697" + } + Frame { + msec: 448 + hash: "1ac1367d21e346c6c652a88b9ea25bfc" + } + Frame { + msec: 464 + hash: "f62720308dc9ae67c3856bc3afb32b75" + } + Frame { + msec: 480 + hash: "066476a57efba802d2497bc3731a3583" + } + Frame { + msec: 496 + hash: "fb965028a760e8d0a4d81fd982a18ff3" + } + Frame { + msec: 512 + hash: "ba008abd1a7a73c750b909d57c043649" + } + Frame { + msec: 528 + hash: "4c974470953f74d1ee7bcd0f4a4c48cf" + } + Frame { + msec: 544 + hash: "ea233f3476da26c90d67b7775b718aa2" + } + Frame { + msec: 560 + hash: "e12c3b810c0aa628d7a3827453bea9f3" + } + Frame { + msec: 576 + hash: "7451954ca0465c430fc4bae84f6d97cb" + } + Frame { + msec: 592 + hash: "503e40f193a8b099daa4013eddc2f664" + } + Frame { + msec: 608 + hash: "1f81acf94f325a51faa7aa61e73f8a25" + } + Frame { + msec: 624 + hash: "0257d7d53eda8afe182a9f97ef451679" + } + Frame { + msec: 640 + hash: "cfc260bdc977ef16311840022cc85378" + } + Frame { + msec: 656 + hash: "27483f0b89d727b32722ea153fad30ad" + } + Frame { + msec: 672 + hash: "355afa11b8e7b24a353d1aa79daf7564" + } + Frame { + msec: 688 + hash: "bbc1d55f346719476f471a2294227bda" + } + Frame { + msec: 704 + hash: "9bbab5ff75219d8bd65022c6d061e57a" + } + Frame { + msec: 720 + hash: "ff0699f02845f3c5cf5aabb19198c346" + } + Frame { + msec: 736 + hash: "26768e09270ade4c5b484154e7042f43" + } + Frame { + msec: 752 + hash: "31c9ae63071de3fb2f7e1836a22515cb" + } + Frame { + msec: 768 + hash: "783ce2acdae8d87883151532c9293336" + } + Frame { + msec: 784 + hash: "86b9fd739f437127e0cc4d7dcd4284bd" + } + Frame { + msec: 800 + hash: "5e1d6e164dd184cc197d514e5ff60a4c" + } + Frame { + msec: 816 + hash: "13063a8d73704165d64dd2a95803ec0f" + } + Frame { + msec: 832 + hash: "c244e0c0d60f4be2e017bba21a17ab3f" + } + Frame { + msec: 848 + hash: "b3bd657873f1b49c888b9b98d8c0e23f" + } + Frame { + msec: 864 + hash: "65a011e4f62ecddd820bdbdeb0084b65" + } + Frame { + msec: 880 + hash: "86018de7b4a93b267fe94c4de9e61bab" + } + Frame { + msec: 896 + hash: "44827055c99ae3ed924c101c9d1be5c5" + } + Frame { + msec: 912 + hash: "1c31fcb20ec1abc7ea815b703ae05363" + } + Frame { + msec: 928 + hash: "9d7825b7b05ca696846a4116ab27f966" + } + Frame { + msec: 944 + hash: "61b6690dd14fc76dbac4d785bbddb8ee" + } + Frame { + msec: 960 + image: "loop.0.png" + } + Frame { + msec: 976 + hash: "2cc40e1119060483ae067f3881af0391" + } + Frame { + msec: 992 + hash: "9747fdff3429f7a2dbc9e3173ad43a67" + } + Frame { + msec: 1008 + hash: "e68058b9565138f2d7f0f96b74c38dec" + } + Frame { + msec: 1024 + hash: "f32aceabb929471dffd73bf0290e75a2" + } + Frame { + msec: 1040 + hash: "9112838cc8f9a0cfb94e0ef6ca7eca71" + } + Frame { + msec: 1056 + hash: "53bd2c46e3a11db0ee151a6a0311b3a8" + } + Frame { + msec: 1072 + hash: "d5105f958a592324e53aae4a83beb049" + } + Frame { + msec: 1088 + hash: "862249432e6fc6114b63284ad9c97cb6" + } + Frame { + msec: 1104 + hash: "3e6a6f505aa146a6789434d265ad4d3b" + } + Frame { + msec: 1120 + hash: "0f5b2b05f72b86bd2b0a6d0ea2b6bf37" + } + Frame { + msec: 1136 + hash: "922520f7ec954d6d1061208cbd63877e" + } + Frame { + msec: 1152 + hash: "d1c02f3ce4bcc96e0c3d2503a0e9aa48" + } + Frame { + msec: 1168 + hash: "ebb41112b687ecb062dedc3b49cb93fc" + } + Frame { + msec: 1184 + hash: "7bc87d71d532aa52abc26ac9c1cbb665" + } + Frame { + msec: 1200 + hash: "1a7a81f851c8817cac3cc0cb7ac07971" + } + Frame { + msec: 1216 + hash: "ca17c870c55f2947bb5f85d28f30ee7c" + } + Frame { + msec: 1232 + hash: "48b123cfd6d2ea1c2bc9f2ba822ec7bf" + } + Frame { + msec: 1248 + hash: "2a6b8aecef26793e200993dc1e25fd95" + } + Frame { + msec: 1264 + hash: "f10a0a11ed54a910fe434311f67343a4" + } + Frame { + msec: 1280 + hash: "47b6e1beabdcd3cd3d21d77c62e5bed8" + } + Frame { + msec: 1296 + hash: "1eea7eb2853a9e7a1a69738667457b7a" + } + Frame { + msec: 1312 + hash: "9e018f9e7a5ba22bbb9be3049373124a" + } + Frame { + msec: 1328 + hash: "d63069a8e7b0eb5611cc34caaecef2fb" + } + Frame { + msec: 1344 + hash: "def9383a090e4454343725f1a7c4fb3d" + } + Frame { + msec: 1360 + hash: "fd3036e559fd31eeadb0032666a95864" + } + Frame { + msec: 1376 + hash: "cf9f82b9e2a03f63f75b6ac113b3d4e5" + } + Frame { + msec: 1392 + hash: "346e7f597cfb4fc51d5393e705deddd5" + } + Frame { + msec: 1408 + hash: "0d6d6cb2ca808f5a57acfa32e10fc335" + } + Frame { + msec: 1424 + hash: "9a660a0fed41211a37d3ac82be40f81a" + } + Frame { + msec: 1440 + hash: "df3fd60ecbd517879e00e8112c49bed4" + } + Frame { + msec: 1456 + hash: "cd86fe5894e5d061f7ffe37913f00ce6" + } + Frame { + msec: 1472 + hash: "a5fdb825c18d43f3ae18f5c28e715174" + } + Frame { + msec: 1488 + hash: "0fdfb5f9463def560da6c19acf96bafb" + } + Frame { + msec: 1504 + hash: "8849a36af064503dbccad69a35b6ab03" + } + Frame { + msec: 1520 + hash: "baeb4f90b0e2efc09225dbb5dd003e9e" + } + Frame { + msec: 1536 + hash: "86922e71c80976ef3aa2cab18f86c010" + } + Frame { + msec: 1552 + hash: "10d166d7da9949370a66251415522186" + } + Frame { + msec: 1568 + hash: "ada1608055b221dc9f1f7650a9764930" + } + Frame { + msec: 1584 + hash: "dd25ffb9a6bf009139b2942f9cc1f8e7" + } + Frame { + msec: 1600 + hash: "dc4a1c44d08328965b53ff079a8fa57b" + } + Frame { + msec: 1616 + hash: "d3d88cf635ba38e5035732cb36014417" + } + Frame { + msec: 1632 + hash: "be5e44f6b9978ba3b9ae878ae5758a96" + } + Frame { + msec: 1648 + hash: "34f193daf199ab45310be2b407499e57" + } + Frame { + msec: 1664 + hash: "d87c854e1c16642dba0d87e25f0e416f" + } + Frame { + msec: 1680 + hash: "08c404f4efd27695071ad52fbfa57c0b" + } + Frame { + msec: 1696 + hash: "84828f8e0cace1a39d9b7f19b6e4cbaa" + } + Frame { + msec: 1712 + hash: "8a0c6e1f597e699c3e2be816ae4e1dd4" + } + Frame { + msec: 1728 + hash: "9aecb0c464fb140725f34ad94ede367a" + } + Frame { + msec: 1744 + hash: "a298b3ab2939819ced7e7f903ec63be4" + } + Frame { + msec: 1760 + hash: "99789b6e168355a3960986c7d1f21f82" + } + Frame { + msec: 1776 + hash: "ebd37ee719ca460480521fd4ec284a3f" + } + Frame { + msec: 1792 + hash: "9c9b3fb5b623d3deaf9920c99279d71b" + } + Frame { + msec: 1808 + hash: "8f0be6d4d6fd7f66a43fd604e17717dd" + } + Frame { + msec: 1824 + hash: "854defd35cf3315e4501583756814ff6" + } + Frame { + msec: 1840 + hash: "fd7157aef6dfb303472cd33b176f91d8" + } + Frame { + msec: 1856 + hash: "e6521a3c74c190c193af2c913e5326e2" + } + Frame { + msec: 1872 + hash: "19862dcb88fcbbb2c4ecdc42821c7fef" + } + Frame { + msec: 1888 + hash: "5e29a9f9c6c4131c5b71f84d24503ad2" + } + Frame { + msec: 1904 + hash: "140e63c071ef77d26034d0bb6a5d5b7a" + } + Frame { + msec: 1920 + image: "loop.1.png" + } + Frame { + msec: 1936 + hash: "7f79dd50a0af8e8871191ee80afcad0f" + } + Frame { + msec: 1952 + hash: "a5eb3334044999f56c759ce8727d627f" + } + Frame { + msec: 1968 + hash: "3fb70a7591b6decfa44f7cad18f73855" + } + Frame { + msec: 1984 + hash: "3fab99be73f7f12b9463dea359fc86d2" + } + Frame { + msec: 2000 + hash: "50ce6b869e42c949b84cf2dd0cca3af9" + } + Frame { + msec: 2016 + hash: "5369125b23e2f954c18f2fd4e0ba6f6a" + } + Frame { + msec: 2032 + hash: "a76f624be0db97ec4450b10f748065df" + } + Frame { + msec: 2048 + hash: "3fb70a7591b6decfa44f7cad18f73855" + } + Frame { + msec: 2064 + hash: "dada267799b6e57acfcc5de3b8822c7c" + } + Frame { + msec: 2080 + hash: "72c0bf8225504e86ff023242b84513a8" + } + Frame { + msec: 2096 + hash: "1e8b095c39bd359637b1b9c975ee514c" + } + Frame { + msec: 2112 + hash: "19862dcb88fcbbb2c4ecdc42821c7fef" + } + Frame { + msec: 2128 + hash: "60c95993a894e1c6e2d476db365b7746" + } + Frame { + msec: 2144 + hash: "854defd35cf3315e4501583756814ff6" + } + Frame { + msec: 2160 + hash: "15e8959bfa4d206b2f0607322b21cba6" + } + Frame { + msec: 2176 + hash: "ebd37ee719ca460480521fd4ec284a3f" + } + Frame { + msec: 2192 + hash: "6d278926822d044fff04c3f182dcb058" + } + Frame { + msec: 2208 + hash: "9aecb0c464fb140725f34ad94ede367a" + } + Frame { + msec: 2224 + hash: "b36f70f138e6deecf5b105bcd89d1a15" + } + Frame { + msec: 2240 + hash: "08c404f4efd27695071ad52fbfa57c0b" + } + Frame { + msec: 2256 + hash: "6469d0bee7ab280639b565ebf174f251" + } + Frame { + msec: 2272 + hash: "be5e44f6b9978ba3b9ae878ae5758a96" + } + Frame { + msec: 2288 + hash: "5214e578bc78b729ddf35c140093c0da" + } + Frame { + msec: 2304 + hash: "dd25ffb9a6bf009139b2942f9cc1f8e7" + } + Frame { + msec: 2320 + hash: "2ddf31aeac4815be56848703a9b5aa14" + } + Frame { + msec: 2336 + hash: "86922e71c80976ef3aa2cab18f86c010" + } + Frame { + msec: 2352 + hash: "d8415ba4fb19b62b838ef2e09ae7607a" + } + Frame { + msec: 2368 + hash: "0fdfb5f9463def560da6c19acf96bafb" + } + Frame { + msec: 2384 + hash: "68fac60713af7cb130e92fa381be411c" + } + Frame { + msec: 2400 + hash: "df3fd60ecbd517879e00e8112c49bed4" + } + Frame { + msec: 2416 + hash: "64e49282d97ba864d2f6be632ae048e4" + } + Frame { + msec: 2432 + hash: "346e7f597cfb4fc51d5393e705deddd5" + } + Frame { + msec: 2448 + hash: "f302a9ce45187ff1001c967a4c753b2b" + } + Frame { + msec: 2464 + hash: "def9383a090e4454343725f1a7c4fb3d" + } + Frame { + msec: 2480 + hash: "fd177a7ae3b5b9205fd38e955be327e0" + } + Frame { + msec: 2496 + hash: "1eea7eb2853a9e7a1a69738667457b7a" + } + Frame { + msec: 2512 + hash: "32b16dd62ccf06e44be38fd5885f297e" + } + Frame { + msec: 2528 + hash: "2a6b8aecef26793e200993dc1e25fd95" + } + Frame { + msec: 2544 + hash: "8637606843905d6ae3f95fcb745f2a6e" + } + Frame { + msec: 2560 + hash: "1a7a81f851c8817cac3cc0cb7ac07971" + } + Frame { + msec: 2576 + hash: "704ca30ddc0a637f3d1cd4926a6f7983" + } + Frame { + msec: 2592 + hash: "d1c02f3ce4bcc96e0c3d2503a0e9aa48" + } + Frame { + msec: 2608 + hash: "7759418b4fe412857ab8e7294f5a3206" + } + Frame { + msec: 2624 + hash: "3e6a6f505aa146a6789434d265ad4d3b" + } + Frame { + msec: 2640 + hash: "3e6089b47573cd53b0a220275202c80b" + } + Frame { + msec: 2656 + hash: "53bd2c46e3a11db0ee151a6a0311b3a8" + } + Frame { + msec: 2672 + hash: "f30202ae354a587c5949a16c1f8b95c3" + } + Frame { + msec: 2688 + hash: "66f78a34fe9d297af1ae8e98f84ead55" + } + Frame { + msec: 2704 + hash: "3e2fc29876812fe57ea008a71db299a4" + } + Frame { + msec: 2720 + hash: "7234b6df2220e418ef8ebe8f1c82bf26" + } + Frame { + msec: 2736 + hash: "82dd491c3b34e702a24ece8e55761a6f" + } + Frame { + msec: 2752 + hash: "d7f1065f5c42088dfc5ce36687fd8010" + } + Frame { + msec: 2768 + hash: "15bfbb0261b66ccbe3b34d0ac807165c" + } + Frame { + msec: 2784 + hash: "69963ce07eb434d787588b21fd020fa3" + } + Frame { + msec: 2800 + hash: "2fb9e078573ebd1a5cf0f615c97f1d20" + } + Frame { + msec: 2816 + hash: "31fa31ed47ea16390be8ea9d41f483e7" + } + Frame { + msec: 2832 + hash: "0f9ed8cd5cfbdab03bcb05cf6dd92620" + } + Frame { + msec: 2848 + hash: "a0e737132ae642c465e991e770ab3e34" + } + Frame { + msec: 2864 + hash: "d57cc5045f01ab4e7eb72575aef22a10" + } + Frame { + msec: 2880 + image: "loop.2.png" + } + Frame { + msec: 2896 + hash: "df41be1fa564353ceb2088af209610d3" + } + Frame { + msec: 2912 + hash: "2d294613ed10dfdbca829b43b6990574" + } + Frame { + msec: 2928 + hash: "0a278a4ec3626442c94ef2da30771171" + } + Frame { + msec: 2944 + hash: "7071526c830fdfde9d520ad1578d27a8" + } + Frame { + msec: 2960 + hash: "ad02e7b90f223d3fc5a433bc4ffbee9e" + } + Frame { + msec: 2976 + hash: "e7ef412697c7df3887980ed1b079ffd5" + } + Frame { + msec: 2992 + hash: "ebda21f95079b37f4862b42523bbc1c0" + } + Frame { + msec: 3008 + hash: "6e8889e9b44ff8ed44e228d97fb5034c" + } + Frame { + msec: 3024 + hash: "f32aceabb929471dffd73bf0290e75a2" + } + Frame { + msec: 3040 + hash: "9112838cc8f9a0cfb94e0ef6ca7eca71" + } + Frame { + msec: 3056 + hash: "53bd2c46e3a11db0ee151a6a0311b3a8" + } + Frame { + msec: 3072 + hash: "d5105f958a592324e53aae4a83beb049" + } + Frame { + msec: 3088 + hash: "862249432e6fc6114b63284ad9c97cb6" + } + Frame { + msec: 3104 + hash: "3e6a6f505aa146a6789434d265ad4d3b" + } + Frame { + msec: 3120 + hash: "0f5b2b05f72b86bd2b0a6d0ea2b6bf37" + } + Frame { + msec: 3136 + hash: "922520f7ec954d6d1061208cbd63877e" + } + Frame { + msec: 3152 + hash: "d1c02f3ce4bcc96e0c3d2503a0e9aa48" + } + Frame { + msec: 3168 + hash: "ebb41112b687ecb062dedc3b49cb93fc" + } + Frame { + msec: 3184 + hash: "7bc87d71d532aa52abc26ac9c1cbb665" + } + Frame { + msec: 3200 + hash: "1a7a81f851c8817cac3cc0cb7ac07971" + } + Frame { + msec: 3216 + hash: "ca17c870c55f2947bb5f85d28f30ee7c" + } + Frame { + msec: 3232 + hash: "48b123cfd6d2ea1c2bc9f2ba822ec7bf" + } + Frame { + msec: 3248 + hash: "2a6b8aecef26793e200993dc1e25fd95" + } + Frame { + msec: 3264 + hash: "f10a0a11ed54a910fe434311f67343a4" + } + Frame { + msec: 3280 + hash: "47b6e1beabdcd3cd3d21d77c62e5bed8" + } + Frame { + msec: 3296 + hash: "1eea7eb2853a9e7a1a69738667457b7a" + } + Frame { + msec: 3312 + hash: "9e018f9e7a5ba22bbb9be3049373124a" + } + Frame { + msec: 3328 + hash: "d63069a8e7b0eb5611cc34caaecef2fb" + } + Frame { + msec: 3344 + hash: "def9383a090e4454343725f1a7c4fb3d" + } + Frame { + msec: 3360 + hash: "fd3036e559fd31eeadb0032666a95864" + } + Frame { + msec: 3376 + hash: "cf9f82b9e2a03f63f75b6ac113b3d4e5" + } + Frame { + msec: 3392 + hash: "346e7f597cfb4fc51d5393e705deddd5" + } + Frame { + msec: 3408 + hash: "0d6d6cb2ca808f5a57acfa32e10fc335" + } + Frame { + msec: 3424 + hash: "9a660a0fed41211a37d3ac82be40f81a" + } + Frame { + msec: 3440 + hash: "df3fd60ecbd517879e00e8112c49bed4" + } + Frame { + msec: 3456 + hash: "cd86fe5894e5d061f7ffe37913f00ce6" + } + Frame { + msec: 3472 + hash: "a5fdb825c18d43f3ae18f5c28e715174" + } + Frame { + msec: 3488 + hash: "0fdfb5f9463def560da6c19acf96bafb" + } + Frame { + msec: 3504 + hash: "8849a36af064503dbccad69a35b6ab03" + } + Frame { + msec: 3520 + hash: "baeb4f90b0e2efc09225dbb5dd003e9e" + } + Frame { + msec: 3536 + hash: "86922e71c80976ef3aa2cab18f86c010" + } + Frame { + msec: 3552 + hash: "10d166d7da9949370a66251415522186" + } + Frame { + msec: 3568 + hash: "ada1608055b221dc9f1f7650a9764930" + } + Frame { + msec: 3584 + hash: "dd25ffb9a6bf009139b2942f9cc1f8e7" + } + Frame { + msec: 3600 + hash: "dc4a1c44d08328965b53ff079a8fa57b" + } + Frame { + msec: 3616 + hash: "d3d88cf635ba38e5035732cb36014417" + } + Frame { + msec: 3632 + hash: "be5e44f6b9978ba3b9ae878ae5758a96" + } + Frame { + msec: 3648 + hash: "34f193daf199ab45310be2b407499e57" + } + Frame { + msec: 3664 + hash: "d87c854e1c16642dba0d87e25f0e416f" + } + Frame { + msec: 3680 + hash: "08c404f4efd27695071ad52fbfa57c0b" + } + Frame { + msec: 3696 + hash: "84828f8e0cace1a39d9b7f19b6e4cbaa" + } + Frame { + msec: 3712 + hash: "8a0c6e1f597e699c3e2be816ae4e1dd4" + } + Frame { + msec: 3728 + hash: "9aecb0c464fb140725f34ad94ede367a" + } + Frame { + msec: 3744 + hash: "a298b3ab2939819ced7e7f903ec63be4" + } + Frame { + msec: 3760 + hash: "99789b6e168355a3960986c7d1f21f82" + } + Frame { + msec: 3776 + hash: "ebd37ee719ca460480521fd4ec284a3f" + } + Frame { + msec: 3792 + hash: "9c9b3fb5b623d3deaf9920c99279d71b" + } + Frame { + msec: 3808 + hash: "8f0be6d4d6fd7f66a43fd604e17717dd" + } + Frame { + msec: 3824 + hash: "854defd35cf3315e4501583756814ff6" + } + Frame { + msec: 3840 + image: "loop.3.png" + } + Frame { + msec: 3856 + hash: "e6521a3c74c190c193af2c913e5326e2" + } + Frame { + msec: 3872 + hash: "19862dcb88fcbbb2c4ecdc42821c7fef" + } + Frame { + msec: 3888 + hash: "5e29a9f9c6c4131c5b71f84d24503ad2" + } + Frame { + msec: 3904 + hash: "140e63c071ef77d26034d0bb6a5d5b7a" + } + Frame { + msec: 3920 + hash: "72c0bf8225504e86ff023242b84513a8" + } + Frame { + msec: 3936 + hash: "7f79dd50a0af8e8871191ee80afcad0f" + } + Frame { + msec: 3952 + hash: "a5eb3334044999f56c759ce8727d627f" + } + Frame { + msec: 3968 + hash: "3fb70a7591b6decfa44f7cad18f73855" + } + Frame { + msec: 3984 + hash: "3fab99be73f7f12b9463dea359fc86d2" + } + Frame { + msec: 4000 + hash: "50ce6b869e42c949b84cf2dd0cca3af9" + } + Frame { + msec: 4016 + hash: "5369125b23e2f954c18f2fd4e0ba6f6a" + } + Frame { + msec: 4032 + hash: "a76f624be0db97ec4450b10f748065df" + } + Frame { + msec: 4048 + hash: "3fb70a7591b6decfa44f7cad18f73855" + } + Frame { + msec: 4064 + hash: "dada267799b6e57acfcc5de3b8822c7c" + } + Frame { + msec: 4080 + hash: "72c0bf8225504e86ff023242b84513a8" + } + Frame { + msec: 4096 + hash: "1e8b095c39bd359637b1b9c975ee514c" + } + Frame { + msec: 4112 + hash: "19862dcb88fcbbb2c4ecdc42821c7fef" + } + Frame { + msec: 4128 + hash: "60c95993a894e1c6e2d476db365b7746" + } + Frame { + msec: 4144 + hash: "854defd35cf3315e4501583756814ff6" + } + Frame { + msec: 4160 + hash: "15e8959bfa4d206b2f0607322b21cba6" + } + Frame { + msec: 4176 + hash: "ebd37ee719ca460480521fd4ec284a3f" + } + Frame { + msec: 4192 + hash: "6d278926822d044fff04c3f182dcb058" + } + Frame { + msec: 4208 + hash: "9aecb0c464fb140725f34ad94ede367a" + } + Frame { + msec: 4224 + hash: "b36f70f138e6deecf5b105bcd89d1a15" + } + Frame { + msec: 4240 + hash: "08c404f4efd27695071ad52fbfa57c0b" + } + Frame { + msec: 4256 + hash: "6469d0bee7ab280639b565ebf174f251" + } + Frame { + msec: 4272 + hash: "be5e44f6b9978ba3b9ae878ae5758a96" + } + Frame { + msec: 4288 + hash: "5214e578bc78b729ddf35c140093c0da" + } + Frame { + msec: 4304 + hash: "dd25ffb9a6bf009139b2942f9cc1f8e7" + } + Frame { + msec: 4320 + hash: "2ddf31aeac4815be56848703a9b5aa14" + } + Frame { + msec: 4336 + hash: "86922e71c80976ef3aa2cab18f86c010" + } + Frame { + msec: 4352 + hash: "d8415ba4fb19b62b838ef2e09ae7607a" + } + Frame { + msec: 4368 + hash: "0fdfb5f9463def560da6c19acf96bafb" + } + Frame { + msec: 4384 + hash: "68fac60713af7cb130e92fa381be411c" + } + Frame { + msec: 4400 + hash: "df3fd60ecbd517879e00e8112c49bed4" + } + Frame { + msec: 4416 + hash: "64e49282d97ba864d2f6be632ae048e4" + } + Frame { + msec: 4432 + hash: "346e7f597cfb4fc51d5393e705deddd5" + } + Frame { + msec: 4448 + hash: "f302a9ce45187ff1001c967a4c753b2b" + } + Frame { + msec: 4464 + hash: "def9383a090e4454343725f1a7c4fb3d" + } + Frame { + msec: 4480 + hash: "fd177a7ae3b5b9205fd38e955be327e0" + } + Frame { + msec: 4496 + hash: "1eea7eb2853a9e7a1a69738667457b7a" + } + Frame { + msec: 4512 + hash: "32b16dd62ccf06e44be38fd5885f297e" + } + Frame { + msec: 4528 + hash: "2a6b8aecef26793e200993dc1e25fd95" + } + Frame { + msec: 4544 + hash: "8637606843905d6ae3f95fcb745f2a6e" + } + Frame { + msec: 4560 + hash: "1a7a81f851c8817cac3cc0cb7ac07971" + } + Frame { + msec: 4576 + hash: "704ca30ddc0a637f3d1cd4926a6f7983" + } + Frame { + msec: 4592 + hash: "d1c02f3ce4bcc96e0c3d2503a0e9aa48" + } + Frame { + msec: 4608 + hash: "7759418b4fe412857ab8e7294f5a3206" + } + Frame { + msec: 4624 + hash: "3e6a6f505aa146a6789434d265ad4d3b" + } + Frame { + msec: 4640 + hash: "3e6089b47573cd53b0a220275202c80b" + } + Frame { + msec: 4656 + hash: "53bd2c46e3a11db0ee151a6a0311b3a8" + } + Frame { + msec: 4672 + hash: "f30202ae354a587c5949a16c1f8b95c3" + } + Frame { + msec: 4688 + hash: "66f78a34fe9d297af1ae8e98f84ead55" + } + Frame { + msec: 4704 + hash: "3e2fc29876812fe57ea008a71db299a4" + } + Frame { + msec: 4720 + hash: "7234b6df2220e418ef8ebe8f1c82bf26" + } + Frame { + msec: 4736 + hash: "82dd491c3b34e702a24ece8e55761a6f" + } + Frame { + msec: 4752 + hash: "d7f1065f5c42088dfc5ce36687fd8010" + } + Frame { + msec: 4768 + hash: "15bfbb0261b66ccbe3b34d0ac807165c" + } + Frame { + msec: 4784 + hash: "69963ce07eb434d787588b21fd020fa3" + } + Frame { + msec: 4800 + image: "loop.4.png" + } + Frame { + msec: 4816 + hash: "31fa31ed47ea16390be8ea9d41f483e7" + } + Frame { + msec: 4832 + hash: "0f9ed8cd5cfbdab03bcb05cf6dd92620" + } + Frame { + msec: 4848 + hash: "a0e737132ae642c465e991e770ab3e34" + } + Frame { + msec: 4864 + hash: "d57cc5045f01ab4e7eb72575aef22a10" + } + Frame { + msec: 4880 + hash: "d57e1a10e48938e1f7fc219220fe1204" + } + Frame { + msec: 4896 + hash: "df41be1fa564353ceb2088af209610d3" + } + Frame { + msec: 4912 + hash: "2d294613ed10dfdbca829b43b6990574" + } + Frame { + msec: 4928 + hash: "0a278a4ec3626442c94ef2da30771171" + } + Frame { + msec: 4944 + hash: "7071526c830fdfde9d520ad1578d27a8" + } + Frame { + msec: 4960 + hash: "ad02e7b90f223d3fc5a433bc4ffbee9e" + } + Frame { + msec: 4976 + hash: "e7ef412697c7df3887980ed1b079ffd5" + } + Frame { + msec: 4992 + hash: "ebda21f95079b37f4862b42523bbc1c0" + } + Frame { + msec: 5008 + hash: "6e8889e9b44ff8ed44e228d97fb5034c" + } + Frame { + msec: 5024 + hash: "f32aceabb929471dffd73bf0290e75a2" + } + Frame { + msec: 5040 + hash: "9112838cc8f9a0cfb94e0ef6ca7eca71" + } + Frame { + msec: 5056 + hash: "53bd2c46e3a11db0ee151a6a0311b3a8" + } + Frame { + msec: 5072 + hash: "d5105f958a592324e53aae4a83beb049" + } + Frame { + msec: 5088 + hash: "862249432e6fc6114b63284ad9c97cb6" + } + Frame { + msec: 5104 + hash: "3e6a6f505aa146a6789434d265ad4d3b" + } + Frame { + msec: 5120 + hash: "0f5b2b05f72b86bd2b0a6d0ea2b6bf37" + } + Frame { + msec: 5136 + hash: "922520f7ec954d6d1061208cbd63877e" + } + Frame { + msec: 5152 + hash: "d1c02f3ce4bcc96e0c3d2503a0e9aa48" + } + Frame { + msec: 5168 + hash: "ebb41112b687ecb062dedc3b49cb93fc" + } + Frame { + msec: 5184 + hash: "7bc87d71d532aa52abc26ac9c1cbb665" + } + Frame { + msec: 5200 + hash: "1a7a81f851c8817cac3cc0cb7ac07971" + } + Frame { + msec: 5216 + hash: "ca17c870c55f2947bb5f85d28f30ee7c" + } + Frame { + msec: 5232 + hash: "48b123cfd6d2ea1c2bc9f2ba822ec7bf" + } + Frame { + msec: 5248 + hash: "2a6b8aecef26793e200993dc1e25fd95" + } + Frame { + msec: 5264 + hash: "f10a0a11ed54a910fe434311f67343a4" + } + Frame { + msec: 5280 + hash: "47b6e1beabdcd3cd3d21d77c62e5bed8" + } + Frame { + msec: 5296 + hash: "1eea7eb2853a9e7a1a69738667457b7a" + } + Frame { + msec: 5312 + hash: "9e018f9e7a5ba22bbb9be3049373124a" + } + Frame { + msec: 5328 + hash: "d63069a8e7b0eb5611cc34caaecef2fb" + } + Frame { + msec: 5344 + hash: "def9383a090e4454343725f1a7c4fb3d" + } + Frame { + msec: 5360 + hash: "fd3036e559fd31eeadb0032666a95864" + } + Frame { + msec: 5376 + hash: "cf9f82b9e2a03f63f75b6ac113b3d4e5" + } + Frame { + msec: 5392 + hash: "346e7f597cfb4fc51d5393e705deddd5" + } + Frame { + msec: 5408 + hash: "0d6d6cb2ca808f5a57acfa32e10fc335" + } + Frame { + msec: 5424 + hash: "9a660a0fed41211a37d3ac82be40f81a" + } + Frame { + msec: 5440 + hash: "df3fd60ecbd517879e00e8112c49bed4" + } + Frame { + msec: 5456 + hash: "cd86fe5894e5d061f7ffe37913f00ce6" + } + Frame { + msec: 5472 + hash: "a5fdb825c18d43f3ae18f5c28e715174" + } + Frame { + msec: 5488 + hash: "0fdfb5f9463def560da6c19acf96bafb" + } + Frame { + msec: 5504 + hash: "8849a36af064503dbccad69a35b6ab03" + } + Frame { + msec: 5520 + hash: "baeb4f90b0e2efc09225dbb5dd003e9e" + } + Frame { + msec: 5536 + hash: "86922e71c80976ef3aa2cab18f86c010" + } + Frame { + msec: 5552 + hash: "10d166d7da9949370a66251415522186" + } + Frame { + msec: 5568 + hash: "ada1608055b221dc9f1f7650a9764930" + } + Frame { + msec: 5584 + hash: "dd25ffb9a6bf009139b2942f9cc1f8e7" + } + Frame { + msec: 5600 + hash: "dc4a1c44d08328965b53ff079a8fa57b" + } + Frame { + msec: 5616 + hash: "d3d88cf635ba38e5035732cb36014417" + } + Frame { + msec: 5632 + hash: "be5e44f6b9978ba3b9ae878ae5758a96" + } + Frame { + msec: 5648 + hash: "34f193daf199ab45310be2b407499e57" + } + Frame { + msec: 5664 + hash: "d87c854e1c16642dba0d87e25f0e416f" + } + Frame { + msec: 5680 + hash: "08c404f4efd27695071ad52fbfa57c0b" + } + Frame { + msec: 5696 + hash: "84828f8e0cace1a39d9b7f19b6e4cbaa" + } + Frame { + msec: 5712 + hash: "8a0c6e1f597e699c3e2be816ae4e1dd4" + } + Frame { + msec: 5728 + hash: "9aecb0c464fb140725f34ad94ede367a" + } + Frame { + msec: 5744 + hash: "a298b3ab2939819ced7e7f903ec63be4" + } + Frame { + msec: 5760 + image: "loop.5.png" + } + Frame { + msec: 5776 + hash: "ebd37ee719ca460480521fd4ec284a3f" + } + Frame { + msec: 5792 + hash: "9c9b3fb5b623d3deaf9920c99279d71b" + } + Frame { + msec: 5808 + hash: "8f0be6d4d6fd7f66a43fd604e17717dd" + } + Frame { + msec: 5824 + hash: "854defd35cf3315e4501583756814ff6" + } + Frame { + msec: 5840 + hash: "fd7157aef6dfb303472cd33b176f91d8" + } + Frame { + msec: 5856 + hash: "e6521a3c74c190c193af2c913e5326e2" + } +} diff --git a/tests/auto/declarative/visual/animation/loop/loop.qml b/tests/auto/declarative/visual/animation/loop/loop.qml new file mode 100644 index 0000000..f6049ae --- /dev/null +++ b/tests/auto/declarative/visual/animation/loop/loop.qml @@ -0,0 +1,24 @@ +import Qt 4.6 + +Rectangle { + id: wrapper + width: 600 + height: 100 + + Rectangle { + id: redRect + width: 100; height: 100 + color: Qt.rgba(1,0,0) + /* This should produce an animation that starts at 0, animates smoothly + to 100, jumps to 200, animates smoothly to 400, animates smoothly + back to 100, jumps to 200, and so on. + */ + x: SequentialAnimation { + repeat: true + NumberAnimation { to: 100; duration: 1000 } + NumberAnimation { from: 200; to: 400; duration: 1000 } + } + + } + +} diff --git a/tests/auto/declarative/visual/animation/parallelAnimation/parallelAnimation.qml b/tests/auto/declarative/visual/animation/parallelAnimation/parallelAnimation.qml index 9e0422f..7021e05 100644 --- a/tests/auto/declarative/visual/animation/parallelAnimation/parallelAnimation.qml +++ b/tests/auto/declarative/visual/animation/parallelAnimation/parallelAnimation.qml @@ -34,10 +34,10 @@ Rectangle { } transitions: Transition { - PropertyAnimation { matchTargets: redRect; matchProperties: "x,color"; duration: 300 } + PropertyAnimation { targets: redRect; properties: "x,color"; duration: 300 } ParallelAnimation { - NumberAnimation { matchTargets: redRect2; matchProperties: "x"; duration: 300 } - ColorAnimation { matchTargets: redRect2; matchProperties: "color"; duration: 300 } + NumberAnimation { targets: redRect2; properties: "x"; duration: 300 } + ColorAnimation { targets: redRect2; properties: "color"; duration: 300 } } } } diff --git a/tests/auto/declarative/visual/animation/parentAction/parentAction.qml b/tests/auto/declarative/visual/animation/parentAction/parentAction.qml index 1e3f402..e4f4406 100644 --- a/tests/auto/declarative/visual/animation/parentAction/parentAction.qml +++ b/tests/auto/declarative/visual/animation/parentAction/parentAction.qml @@ -49,7 +49,7 @@ Rectangle { SequentialAnimation { ColorAnimation { duration: 500} ParentAction {} - NumberAnimation { matchProperties: "rotation, scale"; duration: 1000 } + NumberAnimation { properties: "rotation, scale"; duration: 1000 } } } } diff --git a/tests/auto/declarative/visual/animation/propertyAction/propertyAction.qml b/tests/auto/declarative/visual/animation/propertyAction/propertyAction.qml index b670166..68671e1 100644 --- a/tests/auto/declarative/visual/animation/propertyAction/propertyAction.qml +++ b/tests/auto/declarative/visual/animation/propertyAction/propertyAction.qml @@ -27,8 +27,8 @@ Rectangle { reversible: true SequentialAnimation { ColorAnimation {} - PropertyAction { matchProperties: "x" } - NumberAnimation { matchProperties: "y"; easing: "InOutQuad" } + PropertyAction { properties: "x" } + NumberAnimation { properties: "y"; easing: "InOutQuad" } } } } diff --git a/tests/auto/declarative/visual/animation/reanchor/reanchor.qml b/tests/auto/declarative/visual/animation/reanchor/reanchor.qml index 1cc68a9..359346f 100644 --- a/tests/auto/declarative/visual/animation/reanchor/reanchor.qml +++ b/tests/auto/declarative/visual/animation/reanchor/reanchor.qml @@ -52,7 +52,7 @@ Rectangle { }] transitions: Transition { - NumberAnimation { matchProperties: "x,y,width,height" } + NumberAnimation { properties: "x,y,width,height" } } MouseRegion { diff --git a/tests/auto/declarative/visual/animation/scriptAction/scriptAction.qml b/tests/auto/declarative/visual/animation/scriptAction/scriptAction.qml index 872701b..f121906 100644 --- a/tests/auto/declarative/visual/animation/scriptAction/scriptAction.qml +++ b/tests/auto/declarative/visual/animation/scriptAction/scriptAction.qml @@ -27,9 +27,9 @@ Rectangle { transitions: Transition { SequentialAnimation { - NumberAnimation { matchProperties: "x"; easing: "InOutQuad" } + NumberAnimation { properties: "x"; easing: "InOutQuad" } ScriptAction { stateChangeScriptName: "setColor" } - NumberAnimation { matchProperties: "y"; easing: "InOutQuad" } + NumberAnimation { properties: "y"; easing: "InOutQuad" } } } } diff --git a/tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-vertical.qml b/tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-vertical.qml index c376e39..db70298 100644 --- a/tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-vertical.qml +++ b/tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-vertical.qml @@ -7034,4 +7034,4 @@ VisualTest { } Frame { msec: 23264 - hash: "8443c45791c906a9fe23831844f48a1c \ No newline at end of file + hash: "8443c45791c906a9fe23831844f48a1c diff --git a/tests/auto/declarative/visual/qmlgraphicsflipable/test-flipable.qml b/tests/auto/declarative/visual/qmlgraphicsflipable/test-flipable.qml index 64adb61..c33a319 100644 --- a/tests/auto/declarative/visual/qmlgraphicsflipable/test-flipable.qml +++ b/tests/auto/declarative/visual/qmlgraphicsflipable/test-flipable.qml @@ -36,7 +36,7 @@ Rectangle { } transitions: Transition { - NumberAnimation { easing: "easeInOutQuad"; matchProperties: "angle"; duration: 3000 } + NumberAnimation { easing: "easeInOutQuad"; properties: "angle"; duration: 3000 } } } @@ -64,7 +64,7 @@ Rectangle { } transitions: Transition { - NumberAnimation { easing: "easeInOutQuad"; matchProperties: "angle"; duration: 3000 } + NumberAnimation { easing: "easeInOutQuad"; properties: "angle"; duration: 3000 } } } diff --git a/tests/auto/declarative/visual/qmlgraphicspositioners/dynamic.qml b/tests/auto/declarative/visual/qmlgraphicspositioners/dynamic.qml index 4b03749..f45e9a4 100644 --- a/tests/auto/declarative/visual/qmlgraphicspositioners/dynamic.qml +++ b/tests/auto/declarative/visual/qmlgraphicspositioners/dynamic.qml @@ -37,7 +37,7 @@ Item { Row{ y:20 id: row2 - move: Transition{NumberAnimation{matchProperties:"x"}} + move: Transition{NumberAnimation{properties:"x"}} Repeater{ id: repeater model: 0; @@ -48,7 +48,7 @@ Item { Rectangle{id: r2c; width:20; height:20; color: "blue"} } Row{ - move: Transition{NumberAnimation{matchProperties:"x"}} + move: Transition{NumberAnimation{properties:"x"}} y:40 id: row3 Rectangle{id: r3a; width:20; height:20; color: "red"} diff --git a/tests/auto/declarative/visual/qmlgraphicstextedit/cursorDelegate.qml b/tests/auto/declarative/visual/qmlgraphicstextedit/cursorDelegate.qml index 2faefc1..e0c5db4 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextedit/cursorDelegate.qml +++ b/tests/auto/declarative/visual/qmlgraphicstextedit/cursorDelegate.qml @@ -11,8 +11,8 @@ import Qt 4.6 Rectangle { id:bottom; color: "black"; width: 3; height: 1; x: -1; anchors.bottom: parent.bottom;} opacity: 1 opacity: SequentialAnimation { running: cPage.parent.focus == true; repeat: true; - NumberAnimation { matchProperties: "opacity"; to: 1; duration: 500; easing: "easeInQuad"} - NumberAnimation { matchProperties: "opacity"; to: 0; duration: 500; easing: "easeOutQuad"} + NumberAnimation { properties: "opacity"; to: 1; duration: 500; easing: "easeInQuad"} + NumberAnimation { properties: "opacity"; to: 0; duration: 500; easing: "easeOutQuad"} } } width: 1; diff --git a/tests/auto/declarative/visual/qmlgraphicstextinput/cursorDelegate.qml b/tests/auto/declarative/visual/qmlgraphicstextinput/cursorDelegate.qml index d10755c..0038664 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextinput/cursorDelegate.qml +++ b/tests/auto/declarative/visual/qmlgraphicstextinput/cursorDelegate.qml @@ -11,8 +11,8 @@ import Qt 4.6 Rectangle { id:bottom; color: "black"; width: 3; height: 1; x: -1; anchors.bottom: parent.bottom;} opacity: 1 opacity: SequentialAnimation { running: cPage.parent.focus == true; repeat: true; - NumberAnimation { matchProperties: "opacity"; to: 1; duration: 500; easing: "easeInQuad"} - NumberAnimation { matchProperties: "opacity"; to: 0; duration: 500; easing: "easeOutQuad"} + NumberAnimation { properties: "opacity"; to: 1; duration: 500; easing: "easeInQuad"} + NumberAnimation { properties: "opacity"; to: 0; duration: 500; easing: "easeOutQuad"} } } width: 1; -- cgit v0.12 From 32898d39fbbe0939b6bb21da7f3ad725fb8e0ee3 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Tue, 16 Feb 2010 15:59:50 +1000 Subject: Minor animation class cleanup. --- src/declarative/util/qmlanimation.cpp | 44 +++++++++++++++------------------ src/declarative/util/qmlanimation_p.h | 1 - src/declarative/util/qmlanimation_p_p.h | 9 ++++--- 3 files changed, 25 insertions(+), 29 deletions(-) diff --git a/src/declarative/util/qmlanimation.cpp b/src/declarative/util/qmlanimation.cpp index e36a1cc..cdd5e9a 100644 --- a/src/declarative/util/qmlanimation.cpp +++ b/src/declarative/util/qmlanimation.cpp @@ -210,10 +210,16 @@ bool QmlAbstractAnimation::isRunning() const return d->running; } +//commence is called to start an animation when it is used as a +//simple animation, and not as part of a transition void QmlAbstractAnimationPrivate::commence() { Q_Q(QmlAbstractAnimation); - q->prepare(userProperty.value); + + QmlStateActions actions; + QmlMetaProperties properties; + q->transition(actions, properties, QmlAbstractAnimation::Forward); + q->qtAnimation()->start(); if (q->qtAnimation()->state() != QAbstractAnimation::Running) { running = false; @@ -313,7 +319,7 @@ void QmlAbstractAnimation::setPaused(bool p) else qtAnimation()->resume(); - emit pausedChanged(d->running); + emit pausedChanged(d->paused); } void QmlAbstractAnimation::classBegin() @@ -532,8 +538,7 @@ void QmlAbstractAnimation::complete() void QmlAbstractAnimation::setTarget(const QmlMetaProperty &p) { Q_D(QmlAbstractAnimation); - if (d->userProperty.isNull) - d->userProperty = p; + d->defaultProperty = p; if (!d->avoidPropertyValueSourceStart) setRunning(true); @@ -545,16 +550,7 @@ void QmlAbstractAnimation::setTarget(const QmlMetaProperty &p) void QmlAbstractAnimation::setDefaultTarget(const QmlMetaProperty &p) { Q_D(QmlAbstractAnimation); - d->userProperty = p; -} - -//prepare is called before an animation begins -//(when an animation is used as a simple animation, and not as part of a transition) -void QmlAbstractAnimation::prepare(QmlMetaProperty &) -{ - QmlStateActions actions; - QmlMetaProperties properties; - transition(actions, properties, QmlAbstractAnimation::Forward); + d->defaultProperty = p; } void QmlAbstractAnimation::transition(QmlStateActions &actions, @@ -1012,9 +1008,9 @@ void QmlPropertyAction::transition(QmlStateActions &actions, bool hasSelectors = !props.isEmpty() || !targets.isEmpty() || !d->exclude.isEmpty(); - if (d->userProperty.isValid() && !hasSelectors) { - props << d->userProperty.value.name(); - targets << d->userProperty.value.object(); + if (d->defaultProperty.isValid() && !hasSelectors) { + props << d->defaultProperty.name(); + targets << d->defaultProperty.object(); } QmlSetPropertyAnimationAction *data = new QmlSetPropertyAnimationAction; @@ -1467,10 +1463,10 @@ void QmlSequentialAnimation::transition(QmlStateActions &actions, from = d->animations.count() - 1; } - bool valid = d->userProperty.isValid(); + bool valid = d->defaultProperty.isValid(); for (int ii = from; ii < d->animations.count() && ii >= 0; ii += inc) { if (valid) - d->animations.at(ii)->setDefaultTarget(d->userProperty); + d->animations.at(ii)->setDefaultTarget(d->defaultProperty); d->animations.at(ii)->transition(actions, modified, direction); } } @@ -1523,10 +1519,10 @@ void QmlParallelAnimation::transition(QmlStateActions &actions, TransitionDirection direction) { Q_D(QmlAnimationGroup); - bool valid = d->userProperty.isValid(); + bool valid = d->defaultProperty.isValid(); for (int ii = 0; ii < d->animations.count(); ++ii) { if (valid) - d->animations.at(ii)->setDefaultTarget(d->userProperty); + d->animations.at(ii)->setDefaultTarget(d->defaultProperty); d->animations.at(ii)->transition(actions, modified, direction); } } @@ -2140,9 +2136,9 @@ void QmlPropertyAnimation::transition(QmlStateActions &actions, bool hasSelectors = !props.isEmpty() || !targets.isEmpty() || !d->exclude.isEmpty(); bool useType = (props.isEmpty() && d->propertyName.isEmpty() && d->defaultToInterpolatorType) ? true : false; - if (d->userProperty.isValid() && !hasSelectors) { - props << d->userProperty.value.name(); - targets << d->userProperty.value.object(); + if (d->defaultProperty.isValid() && !hasSelectors) { + props << d->defaultProperty.name(); + targets << d->defaultProperty.object(); } PropertyUpdater *data = new PropertyUpdater; diff --git a/src/declarative/util/qmlanimation_p.h b/src/declarative/util/qmlanimation_p.h index cd4f575..4e8102c 100644 --- a/src/declarative/util/qmlanimation_p.h +++ b/src/declarative/util/qmlanimation_p.h @@ -124,7 +124,6 @@ public: virtual void transition(QmlStateActions &actions, QmlMetaProperties &modified, TransitionDirection direction); - void prepare(QmlMetaProperty &); //### make private virtual QAbstractAnimation *qtAnimation() = 0; private Q_SLOTS: diff --git a/src/declarative/util/qmlanimation_p_p.h b/src/declarative/util/qmlanimation_p_p.h index 2dc59f9..91f9f88 100644 --- a/src/declarative/util/qmlanimation_p_p.h +++ b/src/declarative/util/qmlanimation_p_p.h @@ -108,6 +108,8 @@ public: { if (state() == Running) stop(); + if (policy == DeleteWhenStopped) + delete animAction; animAction = action; policy = p; } @@ -126,12 +128,12 @@ protected: animAction = 0; } } - } else if (newState == Stopped && policy == DeleteWhenStopped) { + } /*else if (newState == Stopped && policy == DeleteWhenStopped) { if (!running) { delete animAction; animAction = 0; } - } + }*/ } private: @@ -222,9 +224,8 @@ public: void commence(); - QmlNullableValue userProperty; + QmlMetaProperty defaultProperty; - QmlMetaProperty property; QmlAnimationGroup *group; static QmlMetaProperty createProperty(QObject *obj, const QString &str, QObject *infoObj); -- cgit v0.12 From 408cd434e8399cc26f7a7b0a29e0cc6e32786029 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Wed, 17 Feb 2010 09:32:08 +1000 Subject: Minor transition cleanup. --- src/declarative/util/qmltransition.cpp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/declarative/util/qmltransition.cpp b/src/declarative/util/qmltransition.cpp index 215fc91..f077982 100644 --- a/src/declarative/util/qmltransition.cpp +++ b/src/declarative/util/qmltransition.cpp @@ -86,6 +86,7 @@ public: , reversed(false), reversible(false), endState(0) { animations.parent = this; + group.trans = this; } QString fromState; @@ -95,11 +96,6 @@ public: ParallelAnimationWrapper group; QmlTransitionManager *endState; - void init() - { - group.trans = this; - } - void complete() { endState->complete(); @@ -139,8 +135,6 @@ QML_DEFINE_TYPE(Qt,4,6,Transition,QmlTransition) QmlTransition::QmlTransition(QObject *parent) : QObject(*(new QmlTransitionPrivate), parent) { - Q_D(QmlTransition); - d->init(); } QmlTransition::~QmlTransition() -- cgit v0.12 From e0b9742450222bdd835358604f70f5a2d13207a9 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Wed, 17 Feb 2010 10:01:40 +1000 Subject: Animation's setTarget should only be called via QmlValueSource*. We rely on this to know whether to autostart. Disallow easy access to setTarget by making it private. --- src/declarative/util/qmlanimation_p.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/declarative/util/qmlanimation_p.h b/src/declarative/util/qmlanimation_p.h index 4e8102c..74330da 100644 --- a/src/declarative/util/qmlanimation_p.h +++ b/src/declarative/util/qmlanimation_p.h @@ -94,7 +94,6 @@ public: QmlAnimationGroup *group() const; void setGroup(QmlAnimationGroup *); - virtual void setTarget(const QmlMetaProperty &); //###make private? void setDefaultTarget(const QmlMetaProperty &); void classBegin(); @@ -128,6 +127,9 @@ public: private Q_SLOTS: void timelineComplete(); + +private: + virtual void setTarget(const QmlMetaProperty &); }; class QmlPauseAnimationPrivate; -- cgit v0.12 From 2ea6cf7976fc9a2d8a67b32ba4854c9eeb583c81 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Wed, 17 Feb 2010 10:20:47 +1000 Subject: Make test more reliable. --- tests/auto/declarative/qmlanimations/tst_qmlanimations.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/auto/declarative/qmlanimations/tst_qmlanimations.cpp b/tests/auto/declarative/qmlanimations/tst_qmlanimations.cpp index 0f39c9d..b4759d4 100644 --- a/tests/auto/declarative/qmlanimations/tst_qmlanimations.cpp +++ b/tests/auto/declarative/qmlanimations/tst_qmlanimations.cpp @@ -219,7 +219,7 @@ void tst_qmlanimations::resume() QVERIFY(animation.from() == 10); animation.start(); - QTest::qWait(50); + QTest::qWait(100); animation.pause(); qreal x = rect.x(); QVERIFY(x != qreal(200)); @@ -229,7 +229,7 @@ void tst_qmlanimations::resume() animation.resume(); QVERIFY(animation.isRunning()); QVERIFY(!animation.isPaused()); - QTest::qWait(50); + QTest::qWait(100); animation.stop(); QVERIFY(rect.x() > x); } @@ -330,7 +330,7 @@ void tst_qmlanimations::badProperties() //for example, int + real; color + real; etc void tst_qmlanimations::mixedTypes() { - //assumes border.width stats a real -- not real robust + //assumes border.width stays a real -- not real robust { QmlEngine engine; QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/mixedtype1.qml")); -- cgit v0.12 From 9fb06ea43e807f2bbb40de89e9af5f2cca02212f Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Wed, 17 Feb 2010 12:13:29 +1000 Subject: Transitions and Behaviors should exclusively control their animations. Don't allow manual control (starting, stopping, etc) of animations in a Behavior or Transition. --- src/declarative/util/qmlanimation.cpp | 23 ++++++++++++++++++----- src/declarative/util/qmlanimation_p.h | 1 + src/declarative/util/qmlanimation_p_p.h | 4 ++-- src/declarative/util/qmlbehavior.cpp | 4 +++- src/declarative/util/qmltransition.cpp | 1 + 5 files changed, 25 insertions(+), 8 deletions(-) diff --git a/src/declarative/util/qmlanimation.cpp b/src/declarative/util/qmlanimation.cpp index cdd5e9a..dd783ca 100644 --- a/src/declarative/util/qmlanimation.cpp +++ b/src/declarative/util/qmlanimation.cpp @@ -249,7 +249,7 @@ void QmlAbstractAnimation::setRunning(bool r) if (d->running == r) return; - if (d->group) { + if (d->group || d->disableUserControl) { qWarning("QmlAbstractAnimation: setRunning() cannot be used on non-root animation nodes"); return; } @@ -308,7 +308,7 @@ void QmlAbstractAnimation::setPaused(bool p) if (d->paused == p) return; - if (d->group) { + if (d->group || d->disableUserControl) { qWarning("QmlAbstractAnimation: setPaused() cannot be used on non-root animation nodes"); return; } @@ -544,15 +544,28 @@ void QmlAbstractAnimation::setTarget(const QmlMetaProperty &p) setRunning(true); } -//we rely on setTarget only being called when used as a value source -//so this function allows us to do the same thing as setTarget without -//that assumption +/* + we rely on setTarget only being called when used as a value source + so this function allows us to do the same thing as setTarget without + that assumption +*/ void QmlAbstractAnimation::setDefaultTarget(const QmlMetaProperty &p) { Q_D(QmlAbstractAnimation); d->defaultProperty = p; } +/* + don't allow start/stop/pause/resume to be manually invoked, + because something else (like a Behavior) already has control + over the animation. +*/ +void QmlAbstractAnimation::setDisableUserControl() +{ + Q_D(QmlAbstractAnimation); + d->disableUserControl = true; +} + void QmlAbstractAnimation::transition(QmlStateActions &actions, QmlMetaProperties &modified, TransitionDirection direction) diff --git a/src/declarative/util/qmlanimation_p.h b/src/declarative/util/qmlanimation_p.h index 74330da..791a127 100644 --- a/src/declarative/util/qmlanimation_p.h +++ b/src/declarative/util/qmlanimation_p.h @@ -95,6 +95,7 @@ public: void setGroup(QmlAnimationGroup *); void setDefaultTarget(const QmlMetaProperty &); + void setDisableUserControl(); void classBegin(); void componentComplete(); diff --git a/src/declarative/util/qmlanimation_p_p.h b/src/declarative/util/qmlanimation_p_p.h index 91f9f88..288aaa8 100644 --- a/src/declarative/util/qmlanimation_p_p.h +++ b/src/declarative/util/qmlanimation_p_p.h @@ -210,17 +210,17 @@ public: QmlAbstractAnimationPrivate() : running(false), paused(false), alwaysRunToEnd(false), repeat(false), connectedTimeLine(false), componentComplete(true), startOnCompletion(false), - avoidPropertyValueSourceStart(false), group(0) {} + avoidPropertyValueSourceStart(false), disableUserControl(false), group(0) {} bool running:1; bool paused:1; bool alwaysRunToEnd:1; bool repeat:1; bool connectedTimeLine:1; - bool componentComplete:1; bool startOnCompletion:1; bool avoidPropertyValueSourceStart:1; + bool disableUserControl:1; void commence(); diff --git a/src/declarative/util/qmlbehavior.cpp b/src/declarative/util/qmlbehavior.cpp index 5e11dea..276e2d0 100644 --- a/src/declarative/util/qmlbehavior.cpp +++ b/src/declarative/util/qmlbehavior.cpp @@ -124,8 +124,10 @@ void QmlBehavior::setAnimation(QmlAbstractAnimation *animation) } d->animation = animation; - if (d->animation) + if (d->animation) { d->animation->setDefaultTarget(d->property); + d->animation->setDisableUserControl(); + } } /*! diff --git a/src/declarative/util/qmltransition.cpp b/src/declarative/util/qmltransition.cpp index f077982..d9e4bed 100644 --- a/src/declarative/util/qmltransition.cpp +++ b/src/declarative/util/qmltransition.cpp @@ -117,6 +117,7 @@ void QmlTransitionPrivate::AnimationList::append(QmlAbstractAnimation *a) { QmlConcreteList::append(a); parent->group.addAnimation(a->qtAnimation()); + a->setDisableUserControl(); } void ParallelAnimationWrapper::updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState) -- cgit v0.12 From 05cbd2fe4b5d9cbdef3be52b6d14d2d20255641a Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Wed, 17 Feb 2010 13:21:46 +1000 Subject: Fix bugs and add tests related to manual start/stop control of animations. This better enforces the restriction on starting an animation that is not top-level, or is part of a Transition or Behavior. --- src/declarative/util/qmlanimation.cpp | 19 +++++++------ src/declarative/util/qmlanimation_p_p.h | 3 +- .../declarative/qmlanimations/data/dontStart.qml | 19 +++++++++++++ .../declarative/qmlanimations/data/dontStart2.qml | 19 +++++++++++++ .../qmlanimations/tst_qmlanimations.cpp | 33 ++++++++++++++++++++++ .../declarative/qmlbehaviors/data/dontStart.qml | 18 ++++++++++++ .../declarative/qmlbehaviors/tst_qmlbehaviors.cpp | 15 ++++++++++ 7 files changed, 116 insertions(+), 10 deletions(-) create mode 100644 tests/auto/declarative/qmlanimations/data/dontStart.qml create mode 100644 tests/auto/declarative/qmlanimations/data/dontStart2.qml create mode 100644 tests/auto/declarative/qmlbehaviors/data/dontStart.qml diff --git a/src/declarative/util/qmlanimation.cpp b/src/declarative/util/qmlanimation.cpp index dd783ca..4b33af0 100644 --- a/src/declarative/util/qmlanimation.cpp +++ b/src/declarative/util/qmlanimation.cpp @@ -243,8 +243,12 @@ QmlMetaProperty QmlAbstractAnimationPrivate::createProperty(QObject *obj, const void QmlAbstractAnimation::setRunning(bool r) { Q_D(QmlAbstractAnimation); - if (r == false) - d->avoidPropertyValueSourceStart = true; + if (!d->componentComplete) { + d->running = r; + if (r == false) + d->avoidPropertyValueSourceStart = true; + return; + } if (d->running == r) return; @@ -266,10 +270,7 @@ void QmlAbstractAnimation::setRunning(bool r) this, SLOT(timelineComplete())); d->connectedTimeLine = true; } - if (d->componentComplete) - d->commence(); - else - d->startOnCompletion = true; + d->commence(); emit started(); } else { if (d->alwaysRunToEnd) { @@ -331,9 +332,11 @@ void QmlAbstractAnimation::classBegin() void QmlAbstractAnimation::componentComplete() { Q_D(QmlAbstractAnimation); - if (d->startOnCompletion) - d->commence(); d->componentComplete = true; + if (d->running) { + d->running = false; + setRunning(true); + } } /*! diff --git a/src/declarative/util/qmlanimation_p_p.h b/src/declarative/util/qmlanimation_p_p.h index 288aaa8..ee0c291 100644 --- a/src/declarative/util/qmlanimation_p_p.h +++ b/src/declarative/util/qmlanimation_p_p.h @@ -209,7 +209,7 @@ class QmlAbstractAnimationPrivate : public QObjectPrivate public: QmlAbstractAnimationPrivate() : running(false), paused(false), alwaysRunToEnd(false), repeat(false), - connectedTimeLine(false), componentComplete(true), startOnCompletion(false), + connectedTimeLine(false), componentComplete(true), avoidPropertyValueSourceStart(false), disableUserControl(false), group(0) {} bool running:1; @@ -218,7 +218,6 @@ public: bool repeat:1; bool connectedTimeLine:1; bool componentComplete:1; - bool startOnCompletion:1; bool avoidPropertyValueSourceStart:1; bool disableUserControl:1; diff --git a/tests/auto/declarative/qmlanimations/data/dontStart.qml b/tests/auto/declarative/qmlanimations/data/dontStart.qml new file mode 100644 index 0000000..36417db --- /dev/null +++ b/tests/auto/declarative/qmlanimations/data/dontStart.qml @@ -0,0 +1,19 @@ +import Qt 4.6 + +Rectangle { + id: wrapper + width: 600 + height: 400 + + Rectangle { + id: redRect + width: 100; height: 100 + color: Qt.rgba(1,0,0) + x: SequentialAnimation { + running: false + NumberAnimation { objectName: "MyAnim"; running: true } + } + + } + +} diff --git a/tests/auto/declarative/qmlanimations/data/dontStart2.qml b/tests/auto/declarative/qmlanimations/data/dontStart2.qml new file mode 100644 index 0000000..1a6540f --- /dev/null +++ b/tests/auto/declarative/qmlanimations/data/dontStart2.qml @@ -0,0 +1,19 @@ +import Qt 4.6 + +Rectangle { + id: wrapper + width: 600 + height: 400 + + Rectangle { + id: redRect + width: 100; height: 100 + color: Qt.rgba(1,0,0) + + transitions: Transition { + SequentialAnimation { + NumberAnimation { id: myAnim; objectName: "MyAnim"; running: true } + } + } + } +} diff --git a/tests/auto/declarative/qmlanimations/tst_qmlanimations.cpp b/tests/auto/declarative/qmlanimations/tst_qmlanimations.cpp index b4759d4..54e6e27 100644 --- a/tests/auto/declarative/qmlanimations/tst_qmlanimations.cpp +++ b/tests/auto/declarative/qmlanimations/tst_qmlanimations.cpp @@ -71,6 +71,7 @@ private slots: void invalidDuration(); void attached(); void propertyValueSourceDefaultStart(); + void dontStart(); }; #define QTIMED_COMPARE(lhs, rhs) do { \ @@ -634,6 +635,38 @@ void tst_qmlanimations::propertyValueSourceDefaultStart() } } + +void tst_qmlanimations::dontStart() +{ + { + QmlEngine engine; + + QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/dontStart.qml")); + + QTest::ignoreMessage(QtWarningMsg, "QmlAbstractAnimation: setRunning() cannot be used on non-root animation nodes"); + QmlGraphicsRectangle *rect = qobject_cast(c.create()); + QVERIFY(rect); + + QmlAbstractAnimation *myAnim = rect->findChild("MyAnim"); + QVERIFY(myAnim && myAnim->qtAnimation()); + QVERIFY(myAnim->qtAnimation()->state() == QAbstractAnimation::Stopped); + } + + { + QmlEngine engine; + + QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/dontStart2.qml")); + + QTest::ignoreMessage(QtWarningMsg, "QmlAbstractAnimation: setRunning() cannot be used on non-root animation nodes"); + QmlGraphicsRectangle *rect = qobject_cast(c.create()); + QVERIFY(rect); + + QmlAbstractAnimation *myAnim = rect->findChild("MyAnim"); + QVERIFY(myAnim && myAnim->qtAnimation()); + QVERIFY(myAnim->qtAnimation()->state() == QAbstractAnimation::Stopped); + } +} + QTEST_MAIN(tst_qmlanimations) #include "tst_qmlanimations.moc" diff --git a/tests/auto/declarative/qmlbehaviors/data/dontStart.qml b/tests/auto/declarative/qmlbehaviors/data/dontStart.qml new file mode 100644 index 0000000..ba7cc9c --- /dev/null +++ b/tests/auto/declarative/qmlbehaviors/data/dontStart.qml @@ -0,0 +1,18 @@ +import Qt 4.6 + +Rectangle { + id: wrapper + width: 600 + height: 400 + + Rectangle { + id: redRect + width: 100; height: 100 + color: Qt.rgba(1,0,0) + x: Behavior { + NumberAnimation { objectName: "MyAnim"; running: true } + } + + } + +} diff --git a/tests/auto/declarative/qmlbehaviors/tst_qmlbehaviors.cpp b/tests/auto/declarative/qmlbehaviors/tst_qmlbehaviors.cpp index 47bd329..5f199ef 100644 --- a/tests/auto/declarative/qmlbehaviors/tst_qmlbehaviors.cpp +++ b/tests/auto/declarative/qmlbehaviors/tst_qmlbehaviors.cpp @@ -67,6 +67,7 @@ private slots: void nonSelectingBehavior(); void reassignedAnimation(); void disabled(); + void dontStart(); }; void tst_qmlbehaviors::simpleBehavior() @@ -278,7 +279,21 @@ void tst_qmlbehaviors::disabled() rect->setState("moved"); qreal x = qobject_cast(rect->findChild("MyRect"))->x(); QCOMPARE(x, qreal(200)); //should change immediately +} + +void tst_qmlbehaviors::dontStart() +{ + QmlEngine engine; + + QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/dontStart.qml")); + + QTest::ignoreMessage(QtWarningMsg, "QmlAbstractAnimation: setRunning() cannot be used on non-root animation nodes"); + QmlGraphicsRectangle *rect = qobject_cast(c.create()); + QVERIFY(rect); + QmlAbstractAnimation *myAnim = rect->findChild("MyAnim"); + QVERIFY(myAnim && myAnim->qtAnimation()); + QVERIFY(myAnim->qtAnimation()->state() == QAbstractAnimation::Stopped); } QTEST_MAIN(tst_qmlbehaviors) -- cgit v0.12 From f1b1e45c3c66a9061becbee38aaabb3653a20d9d Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Thu, 18 Feb 2010 12:39:04 +1000 Subject: Remove unneeded comparison. d->propertyName is now included in props. --- src/declarative/util/qmlanimation.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/declarative/util/qmlanimation.cpp b/src/declarative/util/qmlanimation.cpp index 4b33af0..e1e247c 100644 --- a/src/declarative/util/qmlanimation.cpp +++ b/src/declarative/util/qmlanimation.cpp @@ -2150,7 +2150,7 @@ void QmlPropertyAnimation::transition(QmlStateActions &actions, targets.append(d->target); bool hasSelectors = !props.isEmpty() || !targets.isEmpty() || !d->exclude.isEmpty(); - bool useType = (props.isEmpty() && d->propertyName.isEmpty() && d->defaultToInterpolatorType) ? true : false; + bool useType = (props.isEmpty() && d->defaultToInterpolatorType) ? true : false; if (d->defaultProperty.isValid() && !hasSelectors) { props << d->defaultProperty.name(); -- cgit v0.12 From d031fce2871df878709ba5d67202a5edc08470fe Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Thu, 18 Feb 2010 13:12:34 +1000 Subject: Add a RotationAnimation element. This is needed to provide more control of rotation direction when animating. --- src/declarative/util/qmlanimation.cpp | 182 ++++++++++++++++++++++++++++++++ src/declarative/util/qmlanimation_p.h | 31 ++++++ src/declarative/util/qmlanimation_p_p.h | 10 ++ 3 files changed, 223 insertions(+) diff --git a/src/declarative/util/qmlanimation.cpp b/src/declarative/util/qmlanimation.cpp index e1e247c..7bae661 100644 --- a/src/declarative/util/qmlanimation.cpp +++ b/src/declarative/util/qmlanimation.cpp @@ -1414,6 +1414,177 @@ void QmlVector3dAnimation::setTo(QVector3D t) QML_DEFINE_TYPE(Qt,4,6,Vector3dAnimation,QmlVector3dAnimation) +/*! + \qmlclass RotationAnimation QmlRotationAnimation + \inherits PropertyAnimation + \brief The RotationAnimation element allows you to animate rotations. + + RotationAnimation is a specialized PropertyAnimation that gives control + over the direction of rotation. + + The RotationAnimation in the following example ensures that we always take + the shortest rotation path when switching between our states. + \qml + states: { + State { name: "180"; PropertyChanges { target: myItem; rotation: 180 } } + State { name: "-180"; PropertyChanges { target: myItem; rotation: -180 } } + State { name: "180"; PropertyChanges { target: myItem; rotation: 270 } } + } + transition: Transition { + RotationAnimation { direction: RotationAnimation.Shortest } + } + \endqml + + By default, when used in a transition RotationAnimation will rotate all + properties named "rotation" or "angle". You can override this by providing + your own properties via \c properties or \c property. +*/ + +/*! + \internal + \class QmlRotationAnimation +*/ + +QVariant _q_interpolateShortestRotation(qreal &f, qreal &t, qreal progress) +{ + qreal newt = t; + qreal diff = t-f; + while(diff > 180.0){ + newt -= 360.0; + diff -= 360.0; + } + while(diff < -180.0){ + newt += 360.0; + diff += 360.0; + } + return QVariant(f + (newt - f) * progress); +} + +QVariant _q_interpolateClockwiseRotation(qreal &f, qreal &t, qreal progress) +{ + qreal newt = t; + qreal diff = t-f; + while(diff < 0.0){ + newt += 360.0; + diff += 360.0; + } + return QVariant(f + (newt - f) * progress); +} + +QVariant _q_interpolateCounterclockwiseRotation(qreal &f, qreal &t, qreal progress) +{ + qreal newt = t; + qreal diff = t-f; + while(diff > 0.0){ + newt -= 360.0; + diff -= 360.0; + } + return QVariant(f + (newt - f) * progress); +} + +QmlRotationAnimation::QmlRotationAnimation(QObject *parent) +: QmlPropertyAnimation(*(new QmlRotationAnimationPrivate), parent) +{ + Q_D(QmlRotationAnimation); + d->interpolatorType = QMetaType::QReal; + d->interpolator = reinterpret_cast(&_q_interpolateShortestRotation); + d->defaultProperties = QLatin1String("rotation,angle"); +} + +QmlRotationAnimation::~QmlRotationAnimation() +{ +} + +/*! + \qmlproperty real RotationAnimation::from + This property holds the starting value. + If not set, then the value defined in the start state of the transition. +*/ +qreal QmlRotationAnimation::from() const +{ + Q_D(const QmlRotationAnimation); + return d->from.toReal(); +} + +void QmlRotationAnimation::setFrom(qreal f) +{ + QmlPropertyAnimation::setFrom(f); +} + +/*! + \qmlproperty real RotationAnimation::to + This property holds the ending value. + If not set, then the value defined in the end state of the transition or Behavior. +*/ +qreal QmlRotationAnimation::to() const +{ + Q_D(const QmlRotationAnimation); + return d->to.toReal(); +} + +void QmlRotationAnimation::setTo(qreal t) +{ + QmlPropertyAnimation::setTo(t); +} + +/*! + \qmlproperty enum RotationAnimation::direction + The direction in which to rotate. + Possible values are Numerical, Clockwise, Counterclockwise, + or Shortest. + + \list + \row + \o Numerical + \o Rotate by linearly interpolating between the two numbers. + A rotation from 10 to 350 will rotate 340 degrees clockwise. + \row + \o Clockwise + \o Rotate clockwise between the two values + \row + \o Counterclockwise + \o Rotate counterclockwise between the two values + \row + \o Shortest + \o Rotate in the direction that produces the shortest animation path. + A rotation from 10 to 350 will rotate 20 degrees counterclockwise. + \list + + The default direction is Shortest. +*/ +QmlRotationAnimation::RotationDirection QmlRotationAnimation::direction() const +{ + Q_D(const QmlRotationAnimation); + return d->direction; +} + +void QmlRotationAnimation::setDirection(QmlRotationAnimation::RotationDirection direction) +{ + Q_D(QmlRotationAnimation); + if (d->direction == direction) + return; + + d->direction = direction; + switch(d->direction) { + case Clockwise: + d->interpolator = reinterpret_cast(&_q_interpolateClockwiseRotation); + break; + case Counterclockwise: + d->interpolator = reinterpret_cast(&_q_interpolateCounterclockwiseRotation); + break; + case Shortest: + d->interpolator = reinterpret_cast(&_q_interpolateShortestRotation); + break; + default: + d->interpolator = QVariantAnimationPrivate::getInterpolator(d->interpolatorType); + break; + } + + emit directionChanged(); +} + +QML_DEFINE_TYPE(Qt,4,6,RotationAnimation,QmlRotationAnimation) + QmlAnimationGroup::QmlAnimationGroup(QObject *parent) : QmlAbstractAnimation(*(new QmlAnimationGroupPrivate), parent) { @@ -1661,6 +1832,13 @@ QmlPropertyAnimation::QmlPropertyAnimation(QObject *parent) d->init(); } +QmlPropertyAnimation::QmlPropertyAnimation(QmlPropertyAnimationPrivate &dd, QObject *parent) +: QmlAbstractAnimation(dd, parent) +{ + Q_D(QmlPropertyAnimation); + d->init(); +} + QmlPropertyAnimation::~QmlPropertyAnimation() { } @@ -2157,6 +2335,10 @@ void QmlPropertyAnimation::transition(QmlStateActions &actions, targets << d->defaultProperty.object(); } + if (props.isEmpty() && !d->defaultProperties.isEmpty()) { + props << d->defaultProperties.split(QLatin1Char(',')); + } + PropertyUpdater *data = new PropertyUpdater; data->interpolatorType = d->interpolatorType; data->interpolator = d->interpolator; diff --git a/src/declarative/util/qmlanimation_p.h b/src/declarative/util/qmlanimation_p.h index 791a127..02902b0 100644 --- a/src/declarative/util/qmlanimation_p.h +++ b/src/declarative/util/qmlanimation_p.h @@ -297,6 +297,7 @@ public: QList *exclude(); protected: + QmlPropertyAnimation(QmlPropertyAnimationPrivate &dd, QObject *parent); virtual void transition(QmlStateActions &actions, QmlMetaProperties &modified, TransitionDirection direction); @@ -367,6 +368,35 @@ public: void setTo(QVector3D); }; +class QmlRotationAnimationPrivate; +class Q_AUTOTEST_EXPORT QmlRotationAnimation : public QmlPropertyAnimation +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QmlRotationAnimation) + Q_ENUMS(RotationDirection) + + Q_PROPERTY(qreal from READ from WRITE setFrom NOTIFY fromChanged) + Q_PROPERTY(qreal to READ to WRITE setTo NOTIFY toChanged) + Q_PROPERTY(RotationDirection direction READ direction WRITE setDirection NOTIFY directionChanged) + +public: + QmlRotationAnimation(QObject *parent=0); + virtual ~QmlRotationAnimation(); + + qreal from() const; + void setFrom(qreal); + + qreal to() const; + void setTo(qreal); + + enum RotationDirection { Numerical, Shortest, Clockwise, Counterclockwise }; + RotationDirection direction() const; + void setDirection(RotationDirection direction); + +Q_SIGNALS: + void directionChanged(); +}; + class QmlAnimationGroupPrivate; class QmlAnimationGroup : public QmlAbstractAnimation { @@ -429,6 +459,7 @@ QML_DECLARE_TYPE(QmlNumberAnimation) QML_DECLARE_TYPE(QmlSequentialAnimation) QML_DECLARE_TYPE(QmlParallelAnimation) QML_DECLARE_TYPE(QmlVector3dAnimation) +QML_DECLARE_TYPE(QmlRotationAnimation) QT_END_HEADER diff --git a/src/declarative/util/qmlanimation_p_p.h b/src/declarative/util/qmlanimation_p_p.h index ee0c291..a1181ed 100644 --- a/src/declarative/util/qmlanimation_p_p.h +++ b/src/declarative/util/qmlanimation_p_p.h @@ -358,6 +358,7 @@ public: QString properties; QList targets; QList exclude; + QString defaultProperties; bool fromSourced; bool fromIsDefined:1; @@ -373,6 +374,15 @@ public: static void convertVariant(QVariant &variant, int type); }; +class QmlRotationAnimationPrivate : public QmlPropertyAnimationPrivate +{ + Q_DECLARE_PUBLIC(QmlRotationAnimation) +public: + QmlRotationAnimationPrivate() : direction(QmlRotationAnimation::Shortest) {} + + QmlRotationAnimation::RotationDirection direction; +}; + QT_END_NAMESPACE #endif // QMLANIMATION_P_H -- cgit v0.12 From b800e5a8803f2b39c0b8dce5a9509503672148d5 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Thu, 18 Feb 2010 15:09:07 +1000 Subject: Animation doc fix. --- src/declarative/util/qmlanimation.cpp | 35 +++++++++++------------------------ 1 file changed, 11 insertions(+), 24 deletions(-) diff --git a/src/declarative/util/qmlanimation.cpp b/src/declarative/util/qmlanimation.cpp index 7bae661..249bd8e 100644 --- a/src/declarative/util/qmlanimation.cpp +++ b/src/declarative/util/qmlanimation.cpp @@ -892,14 +892,6 @@ void QmlPropertyAction::setTarget(QObject *o) emit targetChanged(d->target, d->propertyName); } -/*! - \qmlproperty string PropertyAction::property - This property holds an explicit property to animated. - - The exact effect of the \c property property depends on how the animation - is being used. Refer to the \l animation documentation for details. -*/ - QString QmlPropertyAction::property() const { Q_D(const QmlPropertyAction); @@ -916,13 +908,19 @@ void QmlPropertyAction::setProperty(const QString &n) } /*! + \qmlproperty string PropertyAction::property \qmlproperty string PropertyAction::properties - This property holds a comma-separated list of property names this action - will affect. These names are used in conjunction with targets (and the - singular forms target and property) to create a list of properties that the - action will set. + \qmlproperty Object PropertyAction::target + \qmlproperty list PropertyAction::targets - \sa targets PropertyAnimation::properties + These properties are used as a set to determine which properties should be + affected by this action. + + The details of how these properties are interpreted in different situations + is covered in the \l{PropertyAnimation::properties}{corresponding} PropertyAnimation + documentation. + + \sa exclude */ QString QmlPropertyAction::properties() const { @@ -939,17 +937,6 @@ void QmlPropertyAction::setProperties(const QString &p) emit propertiesChanged(p); } -/*! - \qmlproperty list PropertyAction::targets - This property holds a list of objects this action will affect. - These objects are used in conjunction with properties (and their singular - forms property and target) to create a list of properties - that the action will set. - - If no targets are specificed, all changing targets will be animated. - - \sa exclude properties PropertyAnimation::targets -*/ QList *QmlPropertyAction::targets() { Q_D(QmlPropertyAction); -- cgit v0.12 From f9cf46d7198a47cbe50bcbf315b9d0718439086b Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Thu, 18 Feb 2010 15:14:36 +1000 Subject: Fix example after introduction of RotationAnimation. id can't be the same as a TypeName. --- demos/declarative/flickr/common/Loading.qml | 2 +- demos/declarative/twitter/content/Loading.qml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/demos/declarative/flickr/common/Loading.qml b/demos/declarative/flickr/common/Loading.qml index 64a04c4..174cd21 100644 --- a/demos/declarative/flickr/common/Loading.qml +++ b/demos/declarative/flickr/common/Loading.qml @@ -3,6 +3,6 @@ import Qt 4.6 Image { id: loading; source: "pics/loading.png"; transformOrigin: "Center" rotation: NumberAnimation { - id: "RotationAnimation"; from: 0; to: 360; running: loading.visible == true; repeat: true; duration: 900 + from: 0; to: 360; running: loading.visible == true; repeat: true; duration: 900 } } diff --git a/demos/declarative/twitter/content/Loading.qml b/demos/declarative/twitter/content/Loading.qml index 8b22e70..3151415 100644 --- a/demos/declarative/twitter/content/Loading.qml +++ b/demos/declarative/twitter/content/Loading.qml @@ -3,6 +3,6 @@ import Qt 4.6 Image { id: loading; source: "images/loading.png"; transformOrigin: "Center" rotation: NumberAnimation { - id: "RotationAnimation"; from: 0; to: 360; running: loading.visible == true; repeat: true; duration: 900 + from: 0; to: 360; running: loading.visible == true; repeat: true; duration: 900 } } -- cgit v0.12