From ab43af9958a16cbead6a982248d68b52d1f4ee34 Mon Sep 17 00:00:00 2001 From: David Rosca Date: Sat, 26 Jan 2019 10:36:48 +0100 Subject: [PATCH] WebView: Fix detecting rwhvqt change with QtWebEngine 5.12 BUG: 402805 FIXED-IN: 3.1.0 --- src/lib/webengine/webview.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/lib/webengine/webview.cpp b/src/lib/webengine/webview.cpp index b965fe0b8..c82925913 100644 --- a/src/lib/webengine/webview.cpp +++ b/src/lib/webengine/webview.cpp @@ -1276,9 +1276,16 @@ bool WebView::eventFilter(QObject *obj, QEvent *event) // Hack to find widget that receives input events if (obj == this && event->type() == QEvent::ChildAdded) { +#if QTWEBENGINEWIDGETS_VERSION >= QT_VERSION_CHECK(5, 12, 0) + QPointer child = qobject_cast(static_cast(event)->child()); + QTimer::singleShot(0, this, [=]() { + if (child && child->inherits("QtWebEngineCore::RenderWidgetHostViewQtDelegateWidget")) { + m_rwhvqt = child; +#else QTimer::singleShot(0, this, [this]() { if (focusProxy() && m_rwhvqt != focusProxy()) { m_rwhvqt = focusProxy(); +#endif m_rwhvqt->installEventFilter(this); if (QQuickWidget *w = qobject_cast(m_rwhvqt)) { w->setClearColor(palette().color(QPalette::Window));