summaryrefslogtreecommitdiffstats
path: root/src/gui/widgets/qmenubar.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/widgets/qmenubar.cpp')
-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);
}