def event(self, event): if event.type() == QEvent.ChildAdded: obj = event.child() if isinstance(obj, QWidget): obj.installEventFilter(self) return QWebEngineView.event(self, event)
def event(self, event): if event.type() == QEvent.Type.ChildPolished: child = event.child() if 'HostView' in child.metaObject().className(): self._host_widget = child self._host_widget.setFocus(Qt.FocusReason.OtherFocusReason) return QWebEngineView.event(self, event)