Fix interaction with the menu bar on touchscreens
Ignore synthesized mouse move events whithout the left mouse button pressed. We receive such mouse move event on touch before the mouse press event, it causes the menu to show and then the subsequent mouse press event closes the menu. Also don't propagate mouse events after closing a popup to another popup, because they may close the latter one. Change-Id: I50a2d9b57da63d33ffe416161a09f1696d65c88f Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
This commit is contained in:
parent
e21d1d3856
commit
c5307203f5
@ -1209,8 +1209,15 @@ void QMenuBar::keyPressEvent(QKeyEvent *e)
|
||||
void QMenuBar::mouseMoveEvent(QMouseEvent *e)
|
||||
{
|
||||
Q_D(QMenuBar);
|
||||
if (!(e->buttons() & Qt::LeftButton))
|
||||
if (!(e->buttons() & Qt::LeftButton)) {
|
||||
d->mouseDown = false;
|
||||
// We receive mouse move and mouse press on touch.
|
||||
// Mouse move will open the menu and mouse press
|
||||
// will close it, so ignore mouse move.
|
||||
if (e->source() != Qt::MouseEventNotSynthesized)
|
||||
return;
|
||||
}
|
||||
|
||||
bool popupState = d->popupState || d->mouseDown;
|
||||
QAction *action = d->actionAt(e->pos());
|
||||
if ((action && d->isVisible(action)) || !popupState)
|
||||
|
Loading…
x
Reference in New Issue
Block a user