summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2020-08-19 12:38:20 +0200
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2020-08-19 18:21:35 +0000
commit4292ad0292e719bf57b2bd1e8b2d1e156264faad (patch)
treef5be3cc2c6855426cfb1b18e3cb0433b903124ed /src
parentecfb5d2d15e586c40ca2e8b097fb77821be8c884 (diff)
QMenu: make less sensitive to mouse jitter
On systems where a right-press brings up the menu, the next mouse move will select an action, even if it's just a move by a single pixel. This makes it too easy to activate an action on e.g a context menu accidentially when the button is released. Ignore the first couple of mouse moves, using the same logic that prevents accidental tearing off. Change-Id: Ib4dd448ef2d6ae915b48da62666aa95b37145d63 Fixes: QTBUG-57849 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/widgets/widgets/qmenu.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp
index 9528be17b7..eba20445aa 100644
--- a/src/widgets/widgets/qmenu.cpp
+++ b/src/widgets/widgets/qmenu.cpp
@@ -3473,7 +3473,7 @@ void QMenu::mouseMoveEvent(QMouseEvent *e)
return;
d->motions++;
- if (d->motions == 0)
+ if (!d->hasMouseMoved(e->globalPosition().toPoint()))
return;
d->hasHadMouse = d->hasHadMouse || rect().contains(e->position().toPoint());