summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@qt.io>2016-05-25 16:14:41 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2016-07-12 10:16:27 +0000
commit1e83a2d1b61b13323163dfe8cac64dad397cb202 (patch)
treebd933d2217a184be83bf60c957381a1b3e2cd447 /src
parent03e0f8043264f054564da9efe82b453e6bf11fc5 (diff)
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 <allan.jensen@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp8
-rw-r--r--src/webenginewidgets/render_widget_host_view_qt_delegate_widget.h1
2 files changed, 9 insertions, 0 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 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();
}
diff --git a/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.h b/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.h
index bccfeb0f4..ecf2d2d33 100644
--- a/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.h
+++ b/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.h
@@ -101,6 +101,7 @@ private:
QScopedPointer<QSGAbstractRenderer> m_sgRenderer;
bool m_isPopup;
QColor m_clearColor;
+ QPoint m_lastGlobalPos;
QList<QMetaObject::Connection> m_windowConnections;
};