Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] WebviewWidget: WebEngine Don't Grab Focus on setHtml #1983

Merged
merged 1 commit into from
Feb 20, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions Orange/widgets/utils/webview.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)