groupbutton: press and hold for alt action

This commit is contained in:
end-4
2025-07-23 09:00:54 +07:00
parent 574a2a11e7
commit 82506ae7cd
@@ -93,13 +93,23 @@ Button {
root.down = false root.down = false
if (event.button != Qt.LeftButton) return; if (event.button != Qt.LeftButton) return;
if (root.releaseAction) root.releaseAction(); if (root.releaseAction) root.releaseAction();
root.click() // Because the MouseArea already consumed the event }
onClicked: (event) => {
if (event.button != Qt.LeftButton) return;
root.click()
} }
onCanceled: (event) => { onCanceled: (event) => {
root.down = false root.down = false
} }
onPressAndHold: () => {
altAction();
root.down = false;
root.clicked = false;
};
} }
background: Rectangle { background: Rectangle {
id: buttonBackground id: buttonBackground
topLeftRadius: root.leftRadius topLeftRadius: root.leftRadius