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.6 6.5
Change-Id: I6f530fb6da67c735fe3aae4545c8040f49e8dc05
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
(cherry picked from commit 86081091f9
)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
ac4ff59e7b
commit
08b00cf7e3
|
@ -9,6 +9,7 @@ TapHandler {
|
|||
signal triggered(string text)
|
||||
|
||||
id: menuTap
|
||||
acceptedButtons: Qt.RightButton
|
||||
gesturePolicy: TapHandler.DragWithinBounds
|
||||
onPressedChanged: if (pressed) {
|
||||
impl.x = point.position.x - impl.width / 2
|
||||
|
@ -22,7 +23,10 @@ TapHandler {
|
|||
parent: menuTap.parent
|
||||
width: 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
|
||||
visible: menuTap.pressed
|
||||
property Shape highlightedShape: null
|
||||
|
|
Loading…
Reference in New Issue