summaryrefslogtreecommitdiffstats
path: root/src/widgets/kernel
diff options
context:
space:
mode:
authorJørgen Lind <jorgen.lind@digia.com>2014-10-21 13:47:01 +0200
committerJørgen Lind <jorgen.lind@digia.com>2014-11-07 13:24:07 +0100
commit190bfbae64006216b4114a02153c60d604ac24f7 (patch)
tree0538f90c5fd0888b0e7994abdb8d3a5498e71735 /src/widgets/kernel
parentef25d2efdbc74cd334f010649f1c155be529235d (diff)
Ensure that a leave event is sent to a popup that is being closed
If a context menu contains a menu item which will open a dialog, the context menu will never get the leave event, which might leave the menu in an invalid state. Synthetic leave events are sent to windows, but not to popups that are blocked by modal dialogs. Hovever, a popup is removed from the popup stack in QApplication before it receives the leave event. Therefore always give popups events, even when they are not visible. Task-number: QTBUG-38021 Change-Id: I63f6febed44f1e7c8f29e7a09af07f32b4ddbc82 Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
Diffstat (limited to 'src/widgets/kernel')
-rw-r--r--src/widgets/kernel/qapplication.cpp3
-rw-r--r--src/widgets/kernel/qwidgetwindow.cpp1
2 files changed, 3 insertions, 1 deletions
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index 6df1d735a1..9abec13b5b 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -64,6 +64,7 @@
#include <QtWidgets/qgraphicsproxywidget.h>
#include <QtGui/qstylehints.h>
#include <QtGui/qinputmethod.h>
+#include <QtGui/private/qwindow_p.h>
#include <qpa/qplatformtheme.h>
#ifndef QT_NO_WHATSTHIS
#include <QtWidgets/QWhatsThis>
@@ -2489,7 +2490,7 @@ bool QApplicationPrivate::isWindowBlocked(QWindow *window, QWindow **blockingWin
}
QWidget *popupWidget = QApplication::activePopupWidget();
QWindow *popupWindow = popupWidget ? popupWidget->windowHandle() : 0;
- if (popupWindow == window) {
+ if (popupWindow == window || (!popupWindow && QWindowPrivate::get(window)->isPopup())) {
*blockingWindow = 0;
return false;
}
diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp
index d40fc84d77..7b52638e28 100644
--- a/src/widgets/kernel/qwidgetwindow.cpp
+++ b/src/widgets/kernel/qwidgetwindow.cpp
@@ -403,6 +403,7 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event)
QGuiApplicationPrivate::setMouseEventSource(&e, QGuiApplicationPrivate::mouseEventSource(event));
e.setTimestamp(event->timestamp());
QApplicationPrivate::sendMouseEvent(receiver, &e, alien, m_widget, &qt_button_down, qt_last_mouse_receiver);
+ qt_last_mouse_receiver = receiver;
} else {
// close disabled popups when a mouse button is pressed or released
switch (event->type()) {