From 0a91c9df01ec8f0c4aef9ce6e5e9bc3804fb80c2 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 30 Oct 2012 11:26:40 +0100 Subject: Fix submenu navigation. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bring back code that was removed in Qt 4: 60324267fbb8a8554e62aaf9ef01360709292320 for QTBUG-7411 . This code reselects the submenu action of a currently opened popup when the mouse is moved to the submenu crossing other actions. In addition, make sure it only triggers when the reason is not keyboard selection. Task-number: QTBUG-20094 Change-Id: Ibb73f83e86635083aad8b1e79fc0fdd512c65754 Reviewed-by: Samuel Rødal --- src/widgets/widgets/qmenu.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp index fe7e444e86..47ffdda3b6 100644 --- a/src/widgets/widgets/qmenu.cpp +++ b/src/widgets/widgets/qmenu.cpp @@ -543,6 +543,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(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)); -- cgit v1.2.3