summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarri Heine <harri.heine@nokia.com>2012-05-03 16:04:21 +0300
committerQt by Nokia <qt-info@nokia.com>2012-05-07 14:47:59 +0200
commitb58737deac93d7513cf66690ddc71b270ca02463 (patch)
treec8b4b54c44946e5a86c6b3cc00ccbfb09f248e48
parent7c6ae303947c46973135d9a40e06c7d8ded9c56e (diff)
Documentation: Adding snippets for QML docs
Change-Id: I54fb3ae0e9504cb9c6ed3f9704260e7cecb14a9e Reviewed-by: Jaakko Korpela <jaakko.korpela@nokia.com>
-rw-r--r--doc/src/snippets/declarative/declarative-feedback.qml46
1 files changed, 45 insertions, 1 deletions
diff --git a/doc/src/snippets/declarative/declarative-feedback.qml b/doc/src/snippets/declarative/declarative-feedback.qml
index 9a1e4ba..054a125 100644
--- a/doc/src/snippets/declarative/declarative-feedback.qml
+++ b/doc/src/snippets/declarative/declarative-feedback.qml
@@ -147,5 +147,49 @@ Rectangle {
}
}
- //![Theme]
+ //![Theme]
+
+ //! [Play the system theme button click effect]
+ import QtFeedback.ThemeEffect 5.0 as Effect
+
+ Rectangle {
+ width: 180; height: 20
+ radius:5
+ color: "lightgrey"
+ Text {
+ anchors.centerIn: parent
+ text: "Play Theme: Press"
+ }
+ MouseArea {
+ anchors.fill: parent
+ onClicked: {
+ Effect.play(Effect.Press)
+ }
+ }
+ }
+ //! [Play the system theme button click effect]
+
+ //! [Start playing a custom haptic effect]
+ rumble.start();
+ //! [Start playing a custom haptic effect]
+
+ //! [Pause a custom haptic effect]
+ rumble.pause();
+ //! [Pause a custom haptic effect]
+
+ //! [Stop playing a custom haptic effect]
+ rumble.stop();
+ //! [Stop playing a custom haptic effect]
+
+ //! [Query the state of a custom haptic effect]
+ if (rumble.state === Feedback.Stopped)
+ console.log("The device has stopped rumbling.")
+ //! [Query the state of a custom haptic effect]
+
+ //! [Set the actuator which should play the custom effect]
+ for (var i = 0; rumble.availableActuators[i]; i++) {
+ if (rumble.availableActuators[i].name === "ExampleActuatorName") {
+ rumble.actuator = rumble.availableActuators[i]
+ }
}
+ //! [Set the actuator which should play the custom effect]