summaryrefslogtreecommitdiffstats
path: root/src/widgets/kernel/qwidgetwindow.cpp
diff options
context:
space:
mode:
authorPaul Olav Tvete <paul.tvete@qt.io>2018-11-05 15:56:47 +0100
committerLiang Qi <liang.qi@qt.io>2018-11-12 13:01:10 +0000
commitac4f075274414aac1b6cf2e8e854f0f21fee0761 (patch)
tree18a83dcd6d8ebcea5f410228d89074a326871e05 /src/widgets/kernel/qwidgetwindow.cpp
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 <shawn.rutledge@qt.io>
Diffstat (limited to 'src/widgets/kernel/qwidgetwindow.cpp')
-rw-r--r--src/widgets/kernel/qwidgetwindow.cpp3
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(),