summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Bruhin <me@the-compiler.org>2023-08-16 21:13:48 +0200
committerFlorian Bruhin <me@the-compiler.org>2023-08-16 21:13:48 +0200
commita46e9f2036595e8d04cae68a719e5182718861bf (patch)
treea889246fabb503b69379d8f5a5b0977b57819dbd
parentd7b33759e537a759fb4cf90adfcc98f1a3ec7626 (diff)
downloadqutebrowser-a46e9f2036595e8d04cae68a719e5182718861bf.tar.gz
qutebrowser-a46e9f2036595e8d04cae68a719e5182718861bf.zip
child event filter: Ignore non-QQuickWidget children
When pressing buttons on some websites, or when starting to drag, it looks like the WebView gets new QObject children which are not actually their focus proxy. So far, this wasn't a big issue: We only ended up installing the tab event filter on objects where it doesn't belong. However, with the new focus workaround from #7820, we then ended up calling `.setFocus()` on those QObjects, causing an AttributeError. Thus, just don't do anything if we get new children that are not actually a QQuickWidget. Fixes #7831
-rw-r--r--qutebrowser/browser/eventfilter.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/qutebrowser/browser/eventfilter.py b/qutebrowser/browser/eventfilter.py
index 6404608b3..cd011e846 100644
--- a/qutebrowser/browser/eventfilter.py
+++ b/qutebrowser/browser/eventfilter.py
@@ -37,6 +37,10 @@ class ChildEventFilter(QObject):
"""Act on ChildAdded events."""
if event.type() == QEvent.Type.ChildAdded:
child = event.child()
+ if child.metaObject().className() != "QQuickWidget":
+ log.misc.debug(f"Ignoring new child {qtutils.qobj_repr(child)}")
+ return False
+
log.misc.debug(
f"{qtutils.qobj_repr(obj)} got new child {qtutils.qobj_repr(child)}, "
"installing filter")