From 6a5a8bc606be9b3e6723e3a6fa4060d077365efe Mon Sep 17 00:00:00 2001 From: nikicc Date: Wed, 1 Feb 2017 18:19:40 +0100 Subject: [PATCH] WebviewWidget: WebEngine don't grab focus on setHtml If running on WebEngine the call to setHtml grabs focus and sets it to WebViewWidget. Prevent such behaviour. --- Orange/widgets/utils/webview.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Orange/widgets/utils/webview.py b/Orange/widgets/utils/webview.py index dd3647e549c..5ca26a3c6b5 100644 --- a/Orange/widgets/utils/webview.py +++ b/Orange/widgets/utils/webview.py @@ -518,3 +518,18 @@ def html(self): def exposeObject(self, name, obj): obj = _to_primitive_types(obj) self._jsobject_channel.send_object(name, obj) + + def setHtml(self, html, base_url=''): + # TODO: remove once anaconda will provide PyQt without this bug. + # + # At least on some installations of PyQt 5.6.0 with anaconda + # WebViewWidget grabs focus on setHTML which can be quite annoying. + # For example, if you have a line edit as filter and show results + # in WebWiew, then WebView grabs focus after every typed character. + # + # http://stackoverflow.com/questions/36609489 + # https://bugreports.qt.io/browse/QTBUG-52999 + initial_state = self.isEnabled() + self.setEnabled(False) + super().setHtml(html, base_url) + self.setEnabled(initial_state)