Skip to content

Commit

Permalink
Merge pull request #3550 from ccordoba12/webengine-focus
Browse files Browse the repository at this point in the history
Prevent WebEngine to steal focus when setting html on the page
  • Loading branch information
ccordoba12 authored Oct 18, 2016
2 parents 1594423 + be410cd commit 1187575
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion spyder/widgets/browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,22 @@ def contextMenuEvent(self, event):
add_actions(menu, actions)
menu.popup(event.globalPos())
event.accept()


def setHtml(self, html, baseUrl=QUrl()):
"""
Reimplement Qt method to prevent WebEngine to steal focus
when setting html on the page
Solution taken from
https://bugreports.qt.io/browse/QTBUG-52999
"""
if WEBENGINE:
self.setEnabled(False)
super(WebView, self).setHtml(html, baseUrl)
self.setEnabled(True)
else:
super(WebView, self).setHtml(html, baseUrl)


class WebBrowser(QWidget):
"""
Expand Down

0 comments on commit 1187575

Please sign in to comment.