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>
This commit is contained in:
parent
ecfb5d2d15
commit
4292ad0292
@ -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());
|
||||
|
Loading…
Reference in New Issue
Block a user