From 1e83a2d1b61b13323163dfe8cac64dad397cb202 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Wed, 25 May 2016 16:14:41 +0200 Subject: Propagate the view's screen coordinates on global position change Suppose having a QWebEngineView as one of many child widgets in a layout. Resize some child widget such that the position of the QWebEngineView changes (without changing the position of the top-level window). Chromium must be informed of the changed global position, otherwise popups will be opened at the old position. Also see commit 7f941a34, which originally introduced the coordinate propagation for top-level window moves. Task-number: QTBUG-51244 Change-Id: Ieb372e8d7554700d5e8d1e2148ab778094ea3878 Reviewed-by: Allan Sandfeld Jensen --- .../render_widget_host_view_qt_delegate_widget.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp') 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 2937c94b7..a8300aa05 100644 --- a/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp +++ b/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp @@ -266,6 +266,13 @@ QVariant RenderWidgetHostViewQtDelegateWidget::inputMethodQuery(Qt::InputMethodQ void RenderWidgetHostViewQtDelegateWidget::resizeEvent(QResizeEvent *resizeEvent) { QOpenGLWidget::resizeEvent(resizeEvent); + + const QPoint globalPos = mapToGlobal(pos()); + if (globalPos != m_lastGlobalPos) { + m_lastGlobalPos = globalPos; + m_client->windowBoundsChanged(); + } + m_client->notifyResize(); } @@ -384,6 +391,7 @@ void RenderWidgetHostViewQtDelegateWidget::paintGL() void RenderWidgetHostViewQtDelegateWidget::onWindowPosChanged() { + m_lastGlobalPos = mapToGlobal(pos()); m_client->windowBoundsChanged(); } -- cgit v1.2.3