Fix incorrect usage of tab_id

This commit is contained in:
Jay Kamat 2018-05-27 17:09:18 -07:00
parent 28fce9a7cb
commit 5d38d28fee
No known key found for this signature in database
GPG Key ID: 5D2E399600F4F7B5

View File

@ -58,15 +58,22 @@ class ChildEventFilter(QObject):
if qtutils.version_check('5.11', compiled=False, exact=True):
# WORKAROUND for https://bugreports.qt.io/browse/QTBUG-68076
try:
# pylint: disable=protected-access
win_id = self._widget._win_id
PASSTHROUGH_MODES = [usertypes.KeyMode.command,
usertypes.KeyMode.prompt,
usertypes.KeyMode.yesno]
if modeman.instance(win_id).mode not in PASSTHROUGH_MODES:
tabbed_browser = objreg.get('tabbed-browser', scope='window',
# pylint: enable=protected-access
passthrough_modes = [usertypes.KeyMode.command,
usertypes.KeyMode.prompt,
usertypes.KeyMode.yesno]
if modeman.instance(win_id).mode not in passthrough_modes:
tabbed_browser = objreg.get('tabbed-browser',
scope='window',
window=win_id)
current_index = tabbed_browser.widget.currentIndex()
widget_index = self._widget.parent().tab_id
try:
widget_index = tabbed_browser.widget.indexOf(
self._widget.parent())
except RuntimeError:
widget_index = -1
if current_index == widget_index:
QTimer.singleShot(0, self._widget.setFocus)
except: