From 2e1ad4335cb236e0b21f5b395cc8bc54cabedea9 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Fri, 11 Aug 2017 14:35:30 +0200 Subject: [PATCH] Don't send extra mouse press to popups on dblClick MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit QWidget::event() will turn an unhandled double click into a mouse press. Therefore, we must avoid sending a separate mouse press in that case. This copies the logic from 9063edef796ad10eb9ac2229627f36d60168f0e2, the previous fix for QTBUG-25831, which only applied to the non-popup case. Task-number: QTBUG-25831 Change-Id: I616f398a5ebe1f95d4b65b9f6ce2fe39a6fad83e Reviewed-by: Tor Arne Vestbø --- src/widgets/kernel/qwidgetwindow.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp index d5d4ae844b..d30154410c 100644 --- a/src/widgets/kernel/qwidgetwindow.cpp +++ b/src/widgets/kernel/qwidgetwindow.cpp @@ -527,12 +527,15 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event) } } #endif + if ((event->type() != QEvent::MouseButtonPress) + || !(event->flags().testFlag(Qt::MouseEventCreatedDoubleClick))) { - QMouseEvent e(event->type(), widgetPos, event->windowPos(), event->screenPos(), - event->button(), event->buttons(), event->modifiers(), event->source()); - e.setTimestamp(event->timestamp()); - QApplicationPrivate::sendMouseEvent(receiver, &e, receiver, receiver->window(), &qt_button_down, qt_last_mouse_receiver); - qt_last_mouse_receiver = receiver; + QMouseEvent e(event->type(), widgetPos, event->windowPos(), event->screenPos(), + event->button(), event->buttons(), event->modifiers(), event->source()); + e.setTimestamp(event->timestamp()); + QApplicationPrivate::sendMouseEvent(receiver, &e, receiver, receiver->window(), &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()) {