components: Fix ExtendedAbstractButton pressAndHold

This commit is contained in:
Devin Lin 2022-06-22 10:48:59 -04:00
parent 9922c8d5d2
commit 304ba155b6

View file

@ -19,36 +19,10 @@ QQC2.AbstractButton {
*/
property alias cursorShape: mouseArea.cursorShape
/**
* This property holds the elapsed time in milliseconds before pressAndHold is emitted.
*/
property real pressAndHoldInterval: 1000
/**
* Signal that is emitted when the button has been held for a certain amount of time.
*/
signal pressAndHold()
/**
* Signal that is emitted when the right click button is pressed.
*/
signal rightClickPressed()
Timer {
id: timer
interval: pressAndHoldInterval
repeat: false
running: false
onTriggered: root.pressAndHold()
}
onPressedChanged: {
if (pressed) {
timer.restart();
} else {
timer.stop();
}
}
MouseArea {
id: mouseArea