summaryrefslogtreecommitdiffstats
path: root/examples/declarative/dynamic/qml
diff options
context:
space:
mode:
authormae <qt-info@nokia.com>2010-03-03 18:39:45 (GMT)
committermae <qt-info@nokia.com>2010-03-03 18:39:45 (GMT)
commit1a7df5ef1fc81fbf2d548c40e3feeb8ef3bb5a8c (patch)
treebd482c10ffde3ceefae5d4ed8f09f87f8c05bccf /examples/declarative/dynamic/qml
parenta2af08f9793b3884bdb770f89edd4754c0411654 (diff)
downloadQt-1a7df5ef1fc81fbf2d548c40e3feeb8ef3bb5a8c.zip
Qt-1a7df5ef1fc81fbf2d548c40e3feeb8ef3bb5a8c.tar.gz
Qt-1a7df5ef1fc81fbf2d548c40e3feeb8ef3bb5a8c.tar.bz2
make example work again
The code is now a bit on the imperative side, but that was the only working solution to remove the binding loops.
Diffstat (limited to 'examples/declarative/dynamic/qml')
-rw-r--r--examples/declarative/dynamic/qml/Sun.qml8
1 files changed, 4 insertions, 4 deletions
diff --git a/examples/declarative/dynamic/qml/Sun.qml b/examples/declarative/dynamic/qml/Sun.qml
index 796a370..81b6e9b 100644
--- a/examples/declarative/dynamic/qml/Sun.qml
+++ b/examples/declarative/dynamic/qml/Sun.qml
@@ -11,14 +11,14 @@ Image {
//x and y get set when instantiated
//head offscreen
- y: NumberAnimation {
- to: parent.height;
- duration: 10000;
+ NumberAnimation on y {
+ to: window.height / 2;
running: created
+ onRunningChanged: if (running) duration = (window.height - sun.y) * 10; else state = "OffScreen";
}
states: State {
- name: "OffScreen"; when: created && y > window.height / 2;//Below the ground
+ name: "OffScreen";
StateChangeScript { script: { sun.created = false; sun.destroy() } }
}
}