From 7fffc04335fa63e754655bd15ff4286837d1737b Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Fri, 17 Feb 2017 11:34:40 +0100 Subject: Reset d->mouseDown only if it's the menu being hidden MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If the mouse cursor is over a menu entry with a submenu, and the submenu is open, quickly moving the mouse to a near menu entry and clicking it sometimes results in the click being eaten: this happens when the mouse is pressed before the submenu disappears and released after it disappeared: the submenu resets d->mouseDown that is a static, causing the mouse release event on the action we want to have no effect. Set d->mouseDown to 0 only when the window is hiding is the actual window that contains the mouseDown, otherwise is still valid. Change-Id: I2c981b9432728e9e7518c30a146c9595199f8afe Reviewed-by: Błażej Szczygieł Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/widgets/widgets/qmenu.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/widgets/widgets/qmenu.cpp') diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp index bdeb46e88a..a06b9b404f 100644 --- a/src/widgets/widgets/qmenu.cpp +++ b/src/widgets/widgets/qmenu.cpp @@ -2584,7 +2584,8 @@ void QMenu::hideEvent(QHideEvent *) if (QMenuBar *mb = qobject_cast(d->causedPopup.widget)) mb->d_func()->setCurrentAction(0); #endif - d->mouseDown = 0; + if (d->mouseDown == this) + d->mouseDown = 0; d->hasHadMouse = false; if (d->activeMenu) d->hideMenu(d->activeMenu); -- cgit v1.2.3