diff --git a/qutebrowser/browser/mouse.py b/qutebrowser/browser/mouse.py index 16a7f227e..43d234322 100644 --- a/qutebrowser/browser/mouse.py +++ b/qutebrowser/browser/mouse.py @@ -22,7 +22,7 @@ from PyQt5.QtCore import QObject, QEvent, Qt, QTimer from qutebrowser.config import config -from qutebrowser.utils import message, log, usertypes +from qutebrowser.utils import message, log, usertypes, qtutils from qutebrowser.keyinput import modeman @@ -54,6 +54,11 @@ class ChildEventFilter(QObject): obj, child)) assert obj is self._widget child.installEventFilter(self._filter) + + if qtutils.version_check('5.11', compiled=False, exact=True): + # WORKAROUND for https://bugreports.qt.io/browse/QTBUG-68076 + QTimer.singleShot(0, self._widget.setFocus) + return False diff --git a/qutebrowser/browser/webengine/webenginetab.py b/qutebrowser/browser/webengine/webenginetab.py index 1eba686c9..3fcc58738 100644 --- a/qutebrowser/browser/webengine/webenginetab.py +++ b/qutebrowser/browser/webengine/webenginetab.py @@ -789,8 +789,6 @@ class WebEngineTab(browsertab.AbstractTab): url: The QUrl to open. predict: If set to False, predicted_navigation is not emitted. """ - # WORKAROUND for https://bugreports.qt.io/browse/QTBUG-68076 - self._widget.setFocus() self._saved_zoom = self.zoom.factor() self._openurl_prepare(url, predict=predict) self._widget.load(url) diff --git a/qutebrowser/mainwindow/tabbedbrowser.py b/qutebrowser/mainwindow/tabbedbrowser.py index 2d674e280..a35e8d7ef 100644 --- a/qutebrowser/mainwindow/tabbedbrowser.py +++ b/qutebrowser/mainwindow/tabbedbrowser.py @@ -490,6 +490,7 @@ class TabbedBrowser(QWidget): else: self.widget.setCurrentWidget(tab) # WORKAROUND for https://bugreports.qt.io/browse/QTBUG-68076 + # Still seems to be needed with Qt 5.11.1 tab.setFocus() tab.show()