diff --git a/src/lib/webengine/webview.cpp b/src/lib/webengine/webview.cpp index ed1b9a603..28cf11b05 100644 --- a/src/lib/webengine/webview.cpp +++ b/src/lib/webengine/webview.cpp @@ -230,7 +230,7 @@ void WebView::restoreHistory(const QByteArray &data) QWidget *WebView::inputWidget() const { - return qobject_cast(m_rwhvqt); + return m_rwhvqt; } // static @@ -1122,8 +1122,8 @@ bool WebView::eventFilter(QObject *obj, QEvent *event) { // Hack to find widget that receives input events if (obj == this && event->type() == QEvent::ChildAdded) { - QObject *child = static_cast(event)->child(); - if (qstrcmp(child->metaObject()->className(), "QtWebEngineCore::RenderWidgetHostViewQtDelegateWidget") == 0) { + QWidget *child = qobject_cast(static_cast(event)->child()); + if (child && child->inherits("QtWebEngineCore::RenderWidgetHostViewQtDelegateWidget")) { m_rwhvqt = child; m_rwhvqt->installEventFilter(this); } diff --git a/src/lib/webengine/webview.h b/src/lib/webengine/webview.h index 2be9a37f5..8fcb56d3e 100644 --- a/src/lib/webengine/webview.h +++ b/src/lib/webengine/webview.h @@ -183,7 +183,7 @@ private: WebPage* m_page; bool m_firstLoad; - QObject *m_rwhvqt; + QWidget *m_rwhvqt; static bool s_forceContextMenuOnMouseRelease; };