diff --git a/src/lib/webengine/webview.cpp b/src/lib/webengine/webview.cpp index bb17205af..09384be26 100644 --- a/src/lib/webengine/webview.cpp +++ b/src/lib/webengine/webview.cpp @@ -1243,6 +1243,17 @@ void WebView::contextMenuEvent(QContextMenuEvent *event) }); } +bool WebView::focusNextPrevChild(bool next) +{ + // QTBUG-67043 + // Workaround QtWebEngine issue where QWebEngineView loses focus on second load() call. + if (next) { + setFocus(); + return false; + } + return QWebEngineView::focusNextPrevChild(next); +} + void WebView::loadRequest(const LoadRequest &req) { QWebEngineView::load(req.webRequest()); diff --git a/src/lib/webengine/webview.h b/src/lib/webengine/webview.h index 6e7e76bb8..9893e798b 100644 --- a/src/lib/webengine/webview.h +++ b/src/lib/webengine/webview.h @@ -145,6 +145,8 @@ protected: void resizeEvent(QResizeEvent *event) override; void contextMenuEvent(QContextMenuEvent *event) override; + bool focusNextPrevChild(bool next) override; + virtual void _wheelEvent(QWheelEvent *event); virtual void _mousePressEvent(QMouseEvent *event); virtual void _mouseReleaseEvent(QMouseEvent *event);