summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gui/widgets/qmenu.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/gui/widgets/qmenu.cpp b/src/gui/widgets/qmenu.cpp
index fa40c1a..6e8c61c 100644
--- a/src/gui/widgets/qmenu.cpp
+++ b/src/gui/widgets/qmenu.cpp
@@ -578,6 +578,16 @@ void QMenuPrivate::setCurrentAction(QAction *action, int popup, SelectionReason
{
Q_Q(QMenu);
tearoffHighlighted = 0;
+ // Reselect the currently active action in case mouse moved over other menu items when
+ // moving from sub menu action to sub menu (QTBUG-20094).
+ if (reason != SelectedFromKeyboard && action == currentAction && !(action && action->menu() && action->menu() != activeMenu)) {
+ if (QMenu *menu = qobject_cast<QMenu*>(causedPopup.widget)) {
+ if (causedPopup.action && menu->d_func()->activeMenu == q)
+ menu->d_func()->setCurrentAction(causedPopup.action, 0, reason, false);
+ }
+ return;
+ }
+
if (currentAction)
q->update(actionRect(currentAction));