summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@trolltech.com>2009-09-14 16:53:49 (GMT)
committerOlivier Goffart <ogoffart@trolltech.com>2009-09-14 17:20:34 (GMT)
commit655e19b862e54ad61b7b2fa6d05463382c7baa61 (patch)
tree603e53ef6caca91a8e3f0021b4738ea7d9ca9691 /src
parentd1edbe110240e5ede67f10cf6620cc6eef26b359 (diff)
downloadQt-655e19b862e54ad61b7b2fa6d05463382c7baa61.zip
Qt-655e19b862e54ad61b7b2fa6d05463382c7baa61.tar.gz
Qt-655e19b862e54ad61b7b2fa6d05463382c7baa61.tar.bz2
Fix closing the menu of a QMenuBar with the mouse
Ammend commit 41dbc4406 and 21cf7b4c431742 We do not always get the mouseReleaseEvent (because the popups grabs the mouse. So set mouseDown to false in the mouseMoveEvent if no buttons are pressed. We also need to call setCurrentAction(0) in the case we are hovering on the empty area with no popup open. (in otder to remove the highlight) The code is now much closer to the code before the two previous commit Reviewed-by: Prasanth
Diffstat (limited to 'src')
-rw-r--r--src/gui/widgets/qmenubar.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/gui/widgets/qmenubar.cpp b/src/gui/widgets/qmenubar.cpp
index 8591a77..7b0f37e 100644
--- a/src/gui/widgets/qmenubar.cpp
+++ b/src/gui/widgets/qmenubar.cpp
@@ -1252,9 +1252,11 @@ void QMenuBar::keyPressEvent(QKeyEvent *e)
void QMenuBar::mouseMoveEvent(QMouseEvent *e)
{
Q_D(QMenuBar);
+ if (!(e->buttons() & Qt::LeftButton))
+ d->mouseDown = false;
bool popupState = d->popupState || d->mouseDown;
QAction *action = d->actionAt(e->pos());
- if (action && d->isVisible(action))
+ if ((action && d->isVisible(action)) || !popupState)
d->setCurrentAction(action, popupState);
}