summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorThierry Bastian <thierry.bastian@nokia.com>2009-09-09 11:57:16 (GMT)
committerThierry Bastian <thierry.bastian@nokia.com>2009-09-09 11:58:44 (GMT)
commit21cf7b4c4317421da4b7ba63473b639e33386ffc (patch)
treeb8fef0235e00901b4ebcbc139d65bf17e3d39a69 /src/gui
parent342e87fab8d62a8b8795a916ceedba6bba69959f (diff)
downloadQt-21cf7b4c4317421da4b7ba63473b639e33386ffc.zip
Qt-21cf7b4c4317421da4b7ba63473b639e33386ffc.tar.gz
Qt-21cf7b4c4317421da4b7ba63473b639e33386ffc.tar.bz2
QMenubar could popup a menu when undocking a toolbar
This is due to the fact that it receives a mousemoveevent. But as it doesn't receive a mousepress event, we can detect whether it should popup or not. Task-number: 260873 Reviewed-by: prasanth
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/widgets/qmenubar.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/gui/widgets/qmenubar.cpp b/src/gui/widgets/qmenubar.cpp
index 720bd62..d5a7982 100644
--- a/src/gui/widgets/qmenubar.cpp
+++ b/src/gui/widgets/qmenubar.cpp
@@ -1094,6 +1094,8 @@ void QMenuBar::mousePressEvent(QMouseEvent *e)
if(e->button() != Qt::LeftButton)
return;
+ d->mouseDown = true;
+
QAction *action = d->actionAt(e->pos());
if (!action || !d->isVisible(action)) {
d->setCurrentAction(0);
@@ -1104,8 +1106,6 @@ void QMenuBar::mousePressEvent(QMouseEvent *e)
return;
}
- d->mouseDown = true;
-
if(d->currentAction == action && d->popupState) {
if(QMenu *menu = d->activeMenu) {
d->activeMenu = 0;
@@ -1252,10 +1252,11 @@ void QMenuBar::keyPressEvent(QKeyEvent *e)
void QMenuBar::mouseMoveEvent(QMouseEvent *e)
{
Q_D(QMenuBar);
- d->mouseDown = e->buttons() & Qt::LeftButton;
+ bool popupState = d->popupState || e->buttons() & Qt::LeftButton;
+ if (!d->mouseDown || !popupState)
+ return;
QAction *action = d->actionAt(e->pos());
- bool popupState = d->popupState || d->mouseDown;
- if ((action && d->isVisible(action)) || !popupState)
+ if (action && d->isVisible(action))
d->setCurrentAction(action, popupState);
}