summaryrefslogtreecommitdiffstats
path: root/src/webenginewidgets
diff options
context:
space:
mode:
authorJocelyn Turcotte <jocelyn.turcotte@digia.com>2014-05-07 15:18:46 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-05-08 18:46:56 +0200
commit1ca3a574117bdd8e67381b178a823e7d695f4bfd (patch)
treea569ed9d732a88c16739d77938c4b32954f3cb54 /src/webenginewidgets
parent9648528ad6fbd66eeaae3189173a7d7b47b935ce (diff)
Fix double clicks needing three presses in QWebEngineView
Since Qt 5.3 QWidget has the same behavior as Qt 4 where it will replace a second MouseButtonPress event with a MouseButtonDblClick instead of sending both. Fix the issue by moving the MouseButtonDblClick ignore code up to the QtQuick code, assume that upper layers will not send MouseButtonDblClick events, and re-replace the MouseButtonDblClick event with a MouseButtonPress in the QtWidgets code. Change-Id: I529dad2de538f486b00eb900ea6d2ed849a3b1f0 Reviewed-by: Andras Becsi <andras.becsi@digia.com>
Diffstat (limited to 'src/webenginewidgets')
-rw-r--r--src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp b/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp
index 6c3f1cb1c..46f531e52 100644
--- a/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp
+++ b/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp
@@ -178,7 +178,20 @@ void RenderWidgetHostViewQtDelegateWidget::resizeEvent(QResizeEvent *resizeEvent
bool RenderWidgetHostViewQtDelegateWidget::event(QEvent *event)
{
- if (!m_client->forwardEvent(event))
+ bool handled = false;
+ if (event->type() == QEvent::MouseButtonDblClick) {
+ // QWidget keeps the Qt4 behavior where the DblClick event would replace the Press event.
+ // QtQuick is different by sending both the Press and DblClick events for the second press
+ // where we can simply ignore the DblClick event.
+ QMouseEvent *dblClick = static_cast<QMouseEvent *>(event);
+ QMouseEvent press(QEvent::MouseButtonPress, dblClick->localPos(), dblClick->windowPos(), dblClick->screenPos(),
+ dblClick->button(), dblClick->buttons(), dblClick->modifiers());
+ press.setTimestamp(dblClick->timestamp());
+ handled = m_client->forwardEvent(&press);
+ } else
+ handled = m_client->forwardEvent(event);
+
+ if (!handled)
return QOpenGLWidget::event(event);
return true;
}