Index: sources/gui/qml/components/IconButton.qml =================================================================== diff -u -rca05e940ea4a0c567acb05c4c8777dea079b0f08 -r29331d6ae2d7af814a0f4a7a37390877a54f516d --- sources/gui/qml/components/IconButton.qml (.../IconButton.qml) (revision ca05e940ea4a0c567acb05c4c8777dea079b0f08) +++ sources/gui/qml/components/IconButton.qml (.../IconButton.qml) (revision 29331d6ae2d7af814a0f4a7a37390877a54f516d) @@ -30,6 +30,14 @@ radius : height border.color: "transparent" + signal hold() + + onPressed : _repeatTimer.start() + onReleased : _repeatTimer.stop() + onCanceled : _repeatTimer.stop() + + onActiveFocusChanged: if ( ! activeFocus ) _repeatTimer.stop() + Image { id : _iconImage anchors.centerIn: parent height : iconSize @@ -39,4 +47,20 @@ smooth: true mipmap: true } + + Timer { id: _repeatTimer + interval : 200 + repeat : true + + onTriggered: { + hold() + interval = Math.max(50, interval - 10) // accelerate + } + + onRunningChanged: { + if ( ! running ) + interval = 200 // reset when released + } + } + }