Rectangle { width: 100; height: 100 color: "green" Timer { interval: 200 repeat: true id: timer onTriggered: counter.text = counter.count++ } MouseArea { anchors.fill: parent onPressed: timer.start() onReleased: timer.stop() } }
Timer { interval: 200 repeat: true running: area.pressed onTriggered: counter.text = counter.count++ } MouseArea { anchors.fill: parent id: area }