Handle focusProxy being None

This fixes running with Qt 5.11

See https://codereview.qt-project.org/#/c/221408/10 and #3661:
https://github.com/qutebrowser/qutebrowser/issues/3661#issuecomment-375969315
This commit is contained in:
Florian Bruhin 2018-04-23 16:52:53 +02:00
parent 6640768860
commit bc9a8dd63f

View File

@ -755,7 +755,9 @@ class WebEngineTab(browsertab.AbstractTab):
scripts.insert(new_script)
def _install_event_filter(self):
self._widget.focusProxy().installEventFilter(self._mouse_event_filter)
fp = self._widget.focusProxy()
if fp is not None:
fp.installEventFilter(self._mouse_event_filter)
self._child_event_filter = mouse.ChildEventFilter(
eventfilter=self._mouse_event_filter, widget=self._widget,
parent=self)
@ -1102,4 +1104,6 @@ class WebEngineTab(browsertab.AbstractTab):
self.predicted_navigation.connect(self._on_predicted_navigation)
def event_target(self):
return self._widget.focusProxy()
fp = self._widget.focusProxy()
assert fp is not None
return fp