Improve RWHV typecheck for focusProxy

This commit is contained in:
Florian Bruhin 2018-06-08 15:13:48 +02:00
parent 9725d9ce33
commit cc497bf2ea

View File

@ -72,12 +72,10 @@ class WebEngineView(QWebEngineView):
if proxy is not None: if proxy is not None:
return proxy return proxy
# We only want the RenderWidgetHostViewQtDelegateWidget # We don't want e.g. a QMenu.
# (which is a QWidget) but not e.g. a QMenu. rwhv_class = 'QtWebEngineCore::RenderWidgetHostViewQtDelegateWidget'
# pylint: disable=unidiomatic-typecheck
children = [child for child in self.findChildren(QWidget) children = [child for child in self.findChildren(QWidget)
if type(child) == QWidget] if child.inherits(rwhv_class)]
# pylint: enable=unidiomatic-typecheck
if not children: if not children:
return None return None