summaryrefslogtreecommitdiffstats
path: root/examples/declarative/listview/content/ClickAutoRepeating.qml
blob: 19dd6f6f4f4ecc8221578df8fd31bc5272d58162 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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 }
    }
}