tests/auto/quick/qquicksmoothedanimation/data/deleteOnUpdate.qml
raw| 1 | import QtQuick 2.0 |
| 2 | |
| 3 | Rectangle { |
| 4 | width: 300; height: 300; |
| 5 | |
| 6 | Rectangle { |
| 7 | color: "red" |
| 8 | width: 60; height: 60; |
| 9 | x: 100; y: 100; |
| 10 | |
| 11 | property real prevX: 100 |
| 12 | onXChanged: { |
| 13 | if (x - prevX > 10) { |
| 14 | anim.to += 5 |
| 15 | anim.restart(); //this can cause deletion of backend animation classes |
| 16 | prevX = x; |
| 17 | } |
| 18 | } |
| 19 | |
| 20 | SmoothedAnimation on x { |
| 21 | id: anim |
| 22 | objectName: "anim" |
| 23 | velocity: 100 |
| 24 | to: 150 |
| 25 | } |
| 26 | } |
| 27 | } |