summaryrefslogtreecommitdiffstats
path: root/examples/declarative/tvtennis
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2010-03-04 05:19:45 (GMT)
committerMichael Brasser <michael.brasser@nokia.com>2010-03-04 05:21:56 (GMT)
commitce5b682b481e2da6fe12e2c57c4780edbfb2fb54 (patch)
tree01501a539bd0847812c787a372bf976122670243 /examples/declarative/tvtennis
parent78254634c87f8e1b9c79841d87c530d3af8c9734 (diff)
downloadQt-ce5b682b481e2da6fe12e2c57c4780edbfb2fb54.zip
Qt-ce5b682b481e2da6fe12e2c57c4780edbfb2fb54.tar.gz
Qt-ce5b682b481e2da6fe12e2c57c4780edbfb2fb54.tar.bz2
Remove Qt.playSound()
Use SoundEffect instead.
Diffstat (limited to 'examples/declarative/tvtennis')
-rw-r--r--examples/declarative/tvtennis/tvtennis.qml12
1 files changed, 8 insertions, 4 deletions
diff --git a/examples/declarative/tvtennis/tvtennis.qml b/examples/declarative/tvtennis/tvtennis.qml
index 1585c7b..6022a15 100644
--- a/examples/declarative/tvtennis/tvtennis.qml
+++ b/examples/declarative/tvtennis/tvtennis.qml
@@ -1,4 +1,5 @@
import Qt 4.6
+import Qt.multimedia 4.7
Rectangle {
id: page
@@ -15,14 +16,17 @@ Rectangle {
color: "Lime"
x: 20; width: 20; height: 20; z: 1
+ SoundEffect { id: paddle; source: "paddle.wav" }
+ SoundEffect { id: wall; source: "click.wav" }
+
// Move the ball to the right and back to the left repeatedly
SequentialAnimation on x {
repeat: true
NumberAnimation { to: page.width - 40; duration: 2000 }
- ScriptAction { script: Qt.playSound('paddle.wav') }
+ ScriptAction { script: paddle.play() }
PropertyAction { target: ball; property: "direction"; value: "left" }
NumberAnimation { to: 20; duration: 2000 }
- ScriptAction { script: Qt.playSound('paddle.wav') }
+ ScriptAction { script: paddle.play() }
PropertyAction { target: ball; property: "direction"; value: "right" }
}
@@ -32,10 +36,10 @@ Rectangle {
// Detect the ball hitting the top or bottom of the view and bounce it
onYChanged: {
if (y <= 0) {
- Qt.playSound('click.wav');
+ wall.play();
targetY = page.height - 20;
} else if (y >= page.height - 20) {
- Qt.playSound('click.wav');
+ wall.play();
targetY = 0;
}
}