~maliit-team/maliit-plugin-jp/trunk

« back to all changes in this revision

Viewing changes to src/maliit/qml/BaseAutoRepeatKey.qml

  • Committer: liang
  • Date: 2011-07-20 17:19:53 UTC
  • Revision ID: git-v1:c3d107a6b280a8d2c071bb1df794c7b0a4d4c703
package done

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
import Qt 4.7
 
2
 
 
3
BaseKey {
 
4
    id : key
 
5
    signal repeated
 
6
    property bool paused : false
 
7
    Timer {
 
8
        id : startTimer
 
9
        interval : 320
 
10
        repeat : false
 
11
        onTriggered : { paused = false ; repeated() ; repeatTimer.restart() }
 
12
    }
 
13
    Timer {
 
14
        id : repeatTimer
 
15
        interval : 40
 
16
        repeat : true
 
17
        onTriggered : { repeated() }
 
18
    }
 
19
    function pauseAutoRepeat() {
 
20
        paused = true
 
21
        repeatTimer.stop()
 
22
        startTimer.restart()
 
23
    }
 
24
    onMousePressed : { paused = false ; startTimer.restart() ; repeatTimer.stop() }
 
25
    onMouseReleased : { startTimer.stop() ; repeatTimer.stop() }
 
26
    onMouseExited : { startTimer.stop() ; repeatTimer.stop() }
 
27
}