summaryrefslogtreecommitdiffstats
path: root/demos
diff options
context:
space:
mode:
authormae <qt-info@nokia.com>2010-08-03 09:08:35 (GMT)
committermae <qt-info@nokia.com>2010-08-03 09:09:16 (GMT)
commitde2f96f55bf7c30463eb4cea86aa6946b7e301cc (patch)
treefb5f26baa1e44c47bb3ad662bfbda9903a1f3c9c /demos
parentb5c6f77bf0a84e7411d64d6f486ffcbd79ad9494 (diff)
downloadQt-de2f96f55bf7c30463eb4cea86aa6946b7e301cc.zip
Qt-de2f96f55bf7c30463eb4cea86aa6946b7e301cc.tar.gz
Qt-de2f96f55bf7c30463eb4cea86aa6946b7e301cc.tar.bz2
Snake game cannot be restarted
Task-id: QT-3668
Diffstat (limited to 'demos')
-rw-r--r--demos/declarative/snake/snake.qml17
1 files changed, 15 insertions, 2 deletions
diff --git a/demos/declarative/snake/snake.qml b/demos/declarative/snake/snake.qml
index 46114f5..b1344af 100644
--- a/demos/declarative/snake/snake.qml
+++ b/demos/declarative/snake/snake.qml
@@ -208,17 +208,30 @@ Rectangle {
Keys.onUpPressed: if (state == "starting" || direction != 2) Logic.scheduleDirection(0);
Keys.onDownPressed: if (state == "starting" || direction != 0) Logic.scheduleDirection(2);
+ Connections {
+ target: startHeartbeatTimer
+ onRunningChanged: {
+ if (startHeartbeatTimer.running)
+ screen.state = "starting";
+ else
+ screen.state = "running"
+ }
+ }
+ Connections {
+ target: heartbeat
+ onRunningChanged: if (!heartbeat.running) screen.state = "";
+ }
+
+
states: [
State {
name: "starting"
- when: startHeartbeatTimer.running
PropertyChanges {target: progressIndicator; width: 200}
PropertyChanges {target: title; opacity: 0}
PropertyChanges {target: progressBar; opacity: 1}
},
State {
name: "running"
- when: (heartbeat.running && !startHeartbeatTimer.running)
PropertyChanges {target: progressIndicator; width: 200}
PropertyChanges {target: title; opacity: 0}
PropertyChanges {target: skull; row: 0; column: 0; }