path: root/src
diff options
authorMiikka Heikkinen <>2012-10-30 15:54:43 +0200
committerThe Qt Project <>2012-11-07 08:44:38 +0100
commitdde3f6a934ae26c8e92b0132b1bb85c0aa841ac1 (patch)
tree5af8991258d8f6ad504b14ba499044ed3bf14f6e /src
parent6dcfbe552af519bc8cb9c9b4203c1a7d191fcdb2 (diff)
Fix excess enter events when showing modal dialog on button press
QApplicationPrivate::leaveAfterRelease was not properly cleared when mouse event handling was interrupted by a modal dialog, which caused every mouse move over the modal dialog to trigger enter event to the widget under cursor. Fixed by clearing QApplicationPrivate::leaveAfterRelease if mouse event without any buttons pressed is handled. Task-number: QTBUG-27643 Change-Id: I4f31daa656bc643c88e5338282a671ae2077e255 Reviewed-by: Friedemann Kleint <> Reviewed-by: Oliver Wolff <> Reviewed-by: Samuel Rødal <>
Diffstat (limited to 'src')
1 files changed, 6 insertions, 0 deletions
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index efa52456e8..4a5fe0e82b 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -2482,6 +2482,12 @@ bool QApplicationPrivate::sendMouseEvent(QWidget *receiver, QMouseEvent *event,
bool widgetUnderMouse = QRectF(receiver->rect()).contains(event->localPos());
+ // Clear the obsolete leaveAfterRelease value, if mouse button has been released but
+ // leaveAfterRelease has not been updated.
+ // This happens e.g. when modal dialog or popup is shown as a response to button click.
+ if (leaveAfterRelease && !*buttonDown && !event->buttons())
+ leaveAfterRelease = 0;
if (*buttonDown) {
if (!graphicsWidget) {
// Register the widget that shall receive a leave event