tests/auto/declarative/qmlvisual/animation/scriptAction/scriptAction-visual.qml
branchGCC_SURGE
changeset 31 5daf16870df6
parent 30 5dc02b23752f
equal deleted inserted replaced
27:93b982ccede2 31:5daf16870df6
       
     1 import Qt 4.7
       
     2 
       
     3 /*
       
     4 This test starts with a red rectangle at 0,0. It should animate moving 50 pixels right,
       
     5 then immediately change blue, and then animate moving 50 pixels down.
       
     6 */
       
     7 
       
     8 Rectangle {
       
     9     width: 400; height: 400
       
    10     Rectangle {
       
    11         id: myRect
       
    12         width: 100; height: 100
       
    13         color: "red"
       
    14     }
       
    15     MouseArea {
       
    16         id: clickable
       
    17         anchors.fill: parent
       
    18     }
       
    19 
       
    20     states: State {
       
    21         name: "state1"
       
    22         when: clickable.pressed
       
    23         PropertyChanges {
       
    24             target: myRect
       
    25             x: 50; y: 50
       
    26         }
       
    27         StateChangeScript {
       
    28             name: "setColor"
       
    29             script: myRect.color = "blue"
       
    30         }
       
    31     }
       
    32 
       
    33     transitions: Transition {
       
    34         SequentialAnimation {
       
    35             NumberAnimation { properties: "x"; easing.type: "InOutQuad" }
       
    36             ScriptAction { scriptName: "setColor" }
       
    37             NumberAnimation { properties: "y"; easing.type: "InOutQuad" }
       
    38         }
       
    39     }
       
    40 }