summaryrefslogtreecommitdiff
path: root/examples/declarative/listview
diff options
context:
space:
mode:
authorWarwick Allison <warwick.allison@nokia.com>2009-09-11 13:32:23 +1000
committerWarwick Allison <warwick.allison@nokia.com>2009-09-11 13:32:23 +1000
commit3a4eb09c502d2394b35b62ca12b28cba392dc270 (patch)
tree14456f504bf76a55db2a85fe9012d175e635beb3 /examples/declarative/listview
parentc818cc5c950580e796528110f64cf90a81f68d28 (diff)
downloadqt4-tools-3a4eb09c502d2394b35b62ca12b28cba392dc270.tar.gz
tweak
Diffstat (limited to 'examples/declarative/listview')
-rw-r--r--examples/declarative/listview/content/ClickAutoRepeating.qml29
-rw-r--r--examples/declarative/listview/dynamic.qml7
2 files changed, 34 insertions, 2 deletions
diff --git a/examples/declarative/listview/content/ClickAutoRepeating.qml b/examples/declarative/listview/content/ClickAutoRepeating.qml
new file mode 100644
index 0000000000..19dd6f6f4f
--- /dev/null
+++ b/examples/declarative/listview/content/ClickAutoRepeating.qml
@@ -0,0 +1,29 @@
+import Qt 4.6
+
+Item {
+ id: Page
+ property int repeatdelay: 300
+ property int repeatperiod: 75
+ property bool pressed: false
+ signal pressed
+ signal released
+ signal clicked
+ pressed: SequentialAnimation {
+ id: AutoRepeat
+ PropertyAction { target: Page; property: "pressed"; value: true }
+ ScriptAction { script: Page.onPressed }
+ ScriptAction { script: Page.onClicked }
+ PauseAnimation { duration: repeatdelay }
+ SequentialAnimation {
+ repeat: true
+ ScriptAction { script: Page.onClicked }
+ PauseAnimation { duration: repeatperiod }
+ }
+ }
+ MouseRegion {
+ id: MR
+ anchors.fill: parent
+ onPressed: AutoRepeat.start()
+ onReleased: { AutoRepeat.stop(); parent.pressed = false; Page.released }
+ }
+}
diff --git a/examples/declarative/listview/dynamic.qml b/examples/declarative/listview/dynamic.qml
index f615c241ef..dde24f6119 100644
--- a/examples/declarative/listview/dynamic.qml
+++ b/examples/declarative/listview/dynamic.qml
@@ -1,4 +1,5 @@
import Qt 4.6
+import "content"
Item {
width: 320
@@ -75,10 +76,12 @@ Item {
anchors.right: parent.right
width: childrenRect.width
Image { source: "content/pics/add.png"
- MouseRegion { anchors.fill: parent; onClicked: FruitModel.set(index,"cost",Number(cost)+0.25) }
+ ClickAutoRepeating { id: ClickUp; anchors.fill: parent; onClicked: FruitModel.set(index,"cost",Number(cost)+0.25) }
+ scale: ClickUp.pressed ? 0.9 : 1
}
Image { source: "content/pics/del.png"
- MouseRegion { anchors.fill: parent; onClicked: FruitModel.set(index,"cost",Number(cost)-0.25) }
+ ClickAutoRepeating { id: ClickDown; anchors.fill: parent; onClicked: FruitModel.set(index,"cost",Math.max(0,Number(cost)-0.25)) }
+ scale: ClickDown.pressed ? 0.9 : 1
}
Image { source: "content/pics/trash.png"
MouseRegion { anchors.fill: parent; onClicked: FruitModel.remove(index) }