1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 10:46:35 +01:00

WebView: Fix finding rwhvqt with QtWebEngine 5.11

This commit is contained in:
David Rosca 2018-04-22 15:51:58 +02:00
parent 75d5f5d552
commit 9f0817ca71
No known key found for this signature in database
GPG Key ID: EBC3FC294452C6D8

View File

@ -76,22 +76,6 @@ WebView::WebView(QWidget* parent)
}
WebInspector::registerView(this);
// Hack to find widget that receives input events
QStackedLayout *l = qobject_cast<QStackedLayout*>(layout());
connect(l, &QStackedLayout::currentChanged, this, [this]() {
QTimer::singleShot(0, this, [this]() {
m_rwhvqt = focusProxy();
if (!m_rwhvqt) {
qCritical() << "Focus proxy is null!";
return;
}
m_rwhvqt->installEventFilter(this);
if (QQuickWidget *w = qobject_cast<QQuickWidget*>(m_rwhvqt)) {
w->setClearColor(palette().color(QPalette::Window));
}
});
});
}
WebView::~WebView()
@ -1307,6 +1291,15 @@ bool WebView::eventFilter(QObject *obj, QEvent *event)
parentWidget()->installEventFilter(this);
}
// Hack to find widget that receives input events
if (obj == this && event->type() == QEvent::ChildAdded && !m_rwhvqt && focusProxy()) {
m_rwhvqt = focusProxy();
m_rwhvqt->installEventFilter(this);
if (QQuickWidget *w = qobject_cast<QQuickWidget*>(m_rwhvqt)) {
w->setClearColor(palette().color(QPalette::Window));
}
}
// Forward events to WebView
#define HANDLE_EVENT(f, t) \
{ \