# Buggy code
def eventFilter(self, obj, event):
    """Act on ChildAdded events."""
    if event.type() == QEvent.ChildAdded:
        child = event.child()
        log.mouse.debug("{} got new child {}, installing filter".format(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
            try:
                # pylint: disable=protected-access
                win_id = self._widget._win_id
                # 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()
                    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:
                # Something failed, let's just setFocus
                QTimer.singleShot(0, self._widget.setFocus)

    elif event.type() == QEvent.ChildRemoved:
        child = event.child()
        log.mouse.debug("{}: removed child {}".format(obj, child))

    return False


# Traceback (qutebrowser.config.configexc.ConfigFileErrors)
qutebrowser --version                                                                                                                                                                    [17:43:09]
17:43:35 ERROR: Error while loading config.py
Traceback (most recent call last):
File "/nix/store/cfcd2j5l3ff8j51r6ad60ka5qg043lgd-qutebrowser-1.3.0/lib/python3.6/site-packages/qutebrowser/config/configinit.py", line 60, in early_init
configfiles.read_config_py(config_file)
File "/nix/store/cfcd2j5l3ff8j51r6ad60ka5qg043lgd-qutebrowser-1.3.0/lib/python3.6/site-packages/qutebrowser/config/configfiles.py", line 569, in read_config_py
raise configexc.ConfigFileErrors('config.py', api.errors)
qutebrowser.config.configexc.ConfigFileErrors: Errors occurred while reading config.py:
While setting 'tabs.favicons.show': Invalid value 'True' - expected a value of type str but got bool.
While setting 'window.hide_wayland_decoration': No option 'window.hide_wayland_decoration' (this option was renamed to 'window.hide_decoration')
qutebrowser v1.3.0
Git commit:
Backend: QtWebEngine (Chromium 61.0.3163.140)

CPython: 3.6.5
Qt: 5.10.1
PyQt: 5.10.1

sip: 4.19.6
colorama: no
pypeg2: 2.15
jinja2: 2.10
pygments: 2.2.0
yaml: 3.12
cssutils: 1.0.2 $Id$
attr: 17.4.0
PyQt5.QtWebEngineWidgets: yes
PyQt5.QtWebKitWidgets: yes
pdf.js: no
sqlite: 3.22.0
QtNetwork SSL: OpenSSL 1.0.2o  27 Mar 2018

Style: QFusionStyle
Platform: Linux-4.16.7-x86_64-with-glibc2.3.4, 64bit
Linux distribution: NixOS 18.09.git.a931395 (Jellyfish) (unknown)
Frozen: False
Imported from /nix/store/cfcd2j5l3ff8j51r6ad60ka5qg043lgd-qutebrowser-1.3.0/lib/python3.6/site-packages/qutebrowser
Qt library executable path: /nix/store/q1bnn9w3kvlgxqmy62z9mcshhcdjwh7i-qtbase-5.10.1/libexec, data path: /nix/store/q1bnn9w3kvlgxqmy62z9mcshhcdjwh7i-qtbase-5.10.1
OS Version:

--- /etc/os-release ---
NAME=NixOS
ID=nixos
VERSION="18.09.git.a931395 (Jellyfish)"
VERSION_CODENAME=jellyfish
VERSION_ID="18.09.git.a931395"
PRETTY_NAME="NixOS 18.09.git.a931395 (Jellyfish)"

Paths:
cache: /home/bart/.cache/qutebrowser
config: /home/bart/.config/qutebrowser
data: /home/bart/.local/share/qutebrowser
runtime: /run/user/1000/qutebrowser

Uptime: 0:00:00

# Fixed code
def eventFilter(self, obj, event):
    """Act on ChildAdded events."""
    if event.type() == QEvent.ChildAdded:
        child = event.child()
        log.mouse.debug("{} got new child {}, installing filter".format(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
            pass_modes = [
                usertypes.KeyMode.command,
                usertypes.KeyMode.prompt,
                usertypes.KeyMode.yesno,
            ]
            if modeman.instance(self._win_id).mode not in pass_modes:
                tabbed_browser = objreg.get(
                    "tabbed-browser", scope="window", window=self._win_id
                )
                current_index = tabbed_browser.widget.currentIndex()
                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)

    elif event.type() == QEvent.ChildRemoved:
        child = event.child()
        log.mouse.debug("{}: removed child {}".format(obj, child))

    return False