Don't send extra mouse press to popups on dblClick

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 9063edef79,
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ø <tor.arne.vestbo@qt.io>
This commit is contained in:
Paul Olav Tvete 2017-08-11 14:35:30 +02:00
parent 0dee566e98
commit 2e1ad4335c

View File

@ -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()) {