diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2024-01-12 16:07:31 -0700 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2024-01-18 20:55:20 +0000 |
commit | 4465415de1534d45191b9ec58289b39eb64f250e (patch) | |
tree | a08ee0f3f4e7e5b353c5abc48d60d4949aad71f8 | |
parent | 22b81f1bb8f87092159e9f99f481428447913063 (diff) |
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 commit 86081091f9078f511bb9dec3f2b1ef53d7bf4ba9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 08b00cf7e338f5f9225a05704d64ffcdf5f5853c)
-rw-r--r-- | examples/quick/pointerhandlers/components/QuadPieMenu.qml | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/examples/quick/pointerhandlers/components/QuadPieMenu.qml b/examples/quick/pointerhandlers/components/QuadPieMenu.qml index 9c2364fea2..2e29677909 100644 --- a/examples/quick/pointerhandlers/components/QuadPieMenu.qml +++ b/examples/quick/pointerhandlers/components/QuadPieMenu.qml @@ -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 |