summaryrefslogtreecommitdiffstats
path: root/examples/declarative/listview/content/ClickAutoRepeating.qml
diff options
context:
space:
mode:
Diffstat (limited to 'examples/declarative/listview/content/ClickAutoRepeating.qml')
-rw-r--r--examples/declarative/listview/content/ClickAutoRepeating.qml30
1 files changed, 30 insertions, 0 deletions
diff --git a/examples/declarative/listview/content/ClickAutoRepeating.qml b/examples/declarative/listview/content/ClickAutoRepeating.qml
new file mode 100644
index 0000000..796f9e3
--- /dev/null
+++ b/examples/declarative/listview/content/ClickAutoRepeating.qml
@@ -0,0 +1,30 @@
+import Qt 4.6
+
+Item {
+ id: page
+ property int repeatdelay: 300
+ property int repeatperiod: 75
+ property bool isPressed: false
+
+ signal pressed
+ signal released
+ signal clicked
+
+ isPressed: SequentialAnimation {
+ id: autoRepeat
+ PropertyAction { target: page; property: "isPressed"; value: true }
+ ScriptAction { script: page.pressed() }
+ ScriptAction { script: page.clicked() }
+ PauseAnimation { duration: repeatdelay }
+ SequentialAnimation {
+ repeat: true
+ ScriptAction { script: page.clicked() }
+ PauseAnimation { duration: repeatperiod }
+ }
+ }
+ MouseRegion {
+ anchors.fill: parent
+ onPressed: autoRepeat.start()
+ onReleased: { autoRepeat.stop(); parent.isPressed = false; page.released() }
+ }
+}