diff options
authorPaul Olav Tvete <>2018-11-05 15:56:47 +0100
committerLiang Qi <>2018-11-12 13:01:10 +0000
commitac4f075274414aac1b6cf2e8e854f0f21fee0761 (patch)
parent79ed504f10ba49b19fe9122ae3de4cf652130320 (diff)
Make sure mouse release events are delivered to correct widget
The initial mouse press should create an implicit mouse grab so that all subsequent mouse events are delivered to the widget that was pressed first. After commit a4f7bb8733e0, every mouse press would reset the implicit grab. This change checks the previous button state, and does not reset the mouse grab if other buttons are already pressed. Fixes: QTBUG-70816 Change-Id: Icdd215c2f4aaee3c3f34607d68c1d8878155ec17 Reviewed-by: Shawn Rutledge <>
1 files changed, 2 insertions, 1 deletions
diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp
index 0b2d72f330..279c6c0282 100644
--- a/src/widgets/kernel/qwidgetwindow.cpp
+++ b/src/widgets/kernel/qwidgetwindow.cpp
@@ -642,7 +642,8 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event)
if (!widget)
widget = m_widget;
- if (event->type() == QEvent::MouseButtonPress)
+ const bool initialPress = event->buttons() == event->button();
+ if (event->type() == QEvent::MouseButtonPress && initialPress)
qt_button_down = widget;
QWidget *receiver = QApplicationPrivate::pickMouseReceiver(m_widget, event->windowPos().toPoint(), &mapped, event->type(), event->buttons(),