Skip to content
This repository has been archived by the owner on May 10, 2018. It is now read-only.

Commit

Permalink
WebView: Workaround QtWebEngine issue where webview loses focus
Browse files Browse the repository at this point in the history
Closes #2625
  • Loading branch information
nowrep committed Mar 13, 2018
1 parent 1bd2b30 commit ae73219
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/lib/webengine/webview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1268,6 +1268,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());
Expand Down
2 changes: 2 additions & 0 deletions src/lib/webengine/webview.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ protected slots:
void resizeEvent(QResizeEvent *event);
void contextMenuEvent(QContextMenuEvent *event);

bool focusNextPrevChild(bool next) override;

virtual void _wheelEvent(QWheelEvent *event);
virtual void _mousePressEvent(QMouseEvent *event);
virtual void _mouseReleaseEvent(QMouseEvent *event);
Expand Down

0 comments on commit ae73219

Please sign in to comment.