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 + } + } + } Index: sources/gui/qml/components/TouchRect.qml =================================================================== diff -u -rcb9c48c7c307690dcafcfd16ef412fe660291692 -r29331d6ae2d7af814a0f4a7a37390877a54f516d --- sources/gui/qml/components/TouchRect.qml (.../TouchRect.qml) (revision cb9c48c7c307690dcafcfd16ef412fe660291692) +++ sources/gui/qml/components/TouchRect.qml (.../TouchRect.qml) (revision 29331d6ae2d7af814a0f4a7a37390877a54f516d) @@ -114,6 +114,7 @@ signal released signal clicked signal pressAndHold + signal canceled width : Variables.touchRectWidth height : Variables.touchRectHeight @@ -139,5 +140,7 @@ onPressed : { if ( ! _private.pressDebouncing ) { onMouseEventLog("Pressed ") ; _private.pressed = true ; _root.pressed (); pressDebounceTimer.start(); } } onReleased : { if ( _private.pressed ) { onMouseEventLog("Released ") ; _private.pressed = false; _root.released (); pressDebounceTimer.start(); } } onPressAndHold : { onMouseEventLog("PressAndHold ") ; _root.pressAndHold(); } + onCanceled : { onMouseEventLog("Canceled ") ; _root.canceled() ; } + } } Index: sources/gui/qml/compounds/ValueAdjuster.qml =================================================================== diff -u -r56817942c7534dc34c2b0bce640534fa51671086 -r29331d6ae2d7af814a0f4a7a37390877a54f516d --- sources/gui/qml/compounds/ValueAdjuster.qml (.../ValueAdjuster.qml) (revision 56817942c7534dc34c2b0bce640534fa51671086) +++ sources/gui/qml/compounds/ValueAdjuster.qml (.../ValueAdjuster.qml) (revision 29331d6ae2d7af814a0f4a7a37390877a54f516d) @@ -47,6 +47,18 @@ function clear() { didActiveChange(false) } + function decrease() { + if ( ! isActive ) { didActiveChange(true); return } + + didChange(_rangedValue.decrementedValue()) + } + + function increase() { + if ( ! isActive ) { didActiveChange(true); return } + + didChange(_rangedValue.incrementedValue()) + } + RangedValue { id: _rangedValue objectName: "_rangedValue" } @@ -167,11 +179,8 @@ visible : _root.editable iconImageSource : enabled ? "qrc:/images/iArrowLeft" : "qrc:/images/iArrowLeftDisabled" - onClicked : { - if ( ! isActive ) { didActiveChange(true); return } - - didChange(_rangedValue.decrementedValue()) - } + onClicked : decrease() + onHold : decrease() } IconButton { id: _rightArrow @@ -185,10 +194,7 @@ visible : _root.editable iconImageSource : enabled ? "qrc:/images/iArrowRight" : "qrc:/images/iArrowRightDisabled" - onClicked : { - if ( ! isActive ) { didActiveChange(true); return } - - didChange(_rangedValue.incrementedValue()) - } + onClicked : increase() + onHold : increase() } }