Make PieMenu in pointer handlers example work with mouse right-click
It opens instantly with right-click; whereas it animates open with a finger or stylus, to avoid accidental activation, as before. Pick-to: 6.5 Change-Id: I6f530fb6da67c735fe3aae4545c8040f49e8dc05 Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io> (cherry picked from commit86081091f9
) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> (cherry picked from commit08b00cf7e3
)
This commit is contained in:
parent
22b81f1bb8
commit
4465415de1
|
@ -9,6 +9,7 @@ TapHandler {
|
||||||
signal triggered(string text)
|
signal triggered(string text)
|
||||||
|
|
||||||
id: menuTap
|
id: menuTap
|
||||||
|
acceptedButtons: Qt.RightButton
|
||||||
gesturePolicy: TapHandler.DragWithinBounds
|
gesturePolicy: TapHandler.DragWithinBounds
|
||||||
onPressedChanged: if (pressed) {
|
onPressedChanged: if (pressed) {
|
||||||
impl.x = point.position.x - impl.width / 2
|
impl.x = point.position.x - impl.width / 2
|
||||||
|
@ -22,7 +23,10 @@ TapHandler {
|
||||||
parent: menuTap.parent
|
parent: menuTap.parent
|
||||||
width: 100
|
width: 100
|
||||||
height: 100
|
height: 100
|
||||||
scale: Math.min(1, Math.max(0, menuTap.timeHeld * 4))
|
// with touchscreen or stylus, long-press slowly expands the menu to size
|
||||||
|
// with mouse or touchpad right-click, it opens instantly
|
||||||
|
scale: menuTap.point.device.pointerType === PointerDevice.Generic ?
|
||||||
|
1 : Math.min(1, Math.max(0, menuTap.timeHeld * 4))
|
||||||
opacity: scale * 2
|
opacity: scale * 2
|
||||||
visible: menuTap.pressed
|
visible: menuTap.pressed
|
||||||
property Shape highlightedShape: null
|
property Shape highlightedShape: null
|
||||||
|
|
Loading…
Reference in New Issue