mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
hack to prevent keys from leaking from other widgets
This commit is contained in:
parent
c8a43517c8
commit
f48b3b27da
1 changed files with 9 additions and 0 deletions
|
@ -53,7 +53,16 @@ class AnkiWebView(QWebView):
|
|||
self.setKeyHandler()
|
||||
self.connect(self, SIGNAL("linkClicked(QUrl)"), self._linkHandler)
|
||||
self.connect(self, SIGNAL("loadFinished(bool)"), self._loadFinished)
|
||||
self._curKey = None
|
||||
def keyPressEvent(self, evt):
|
||||
self._curKey = True
|
||||
return QWebView.keyPressEvent(self, evt)
|
||||
def keyReleaseEvent(self, evt):
|
||||
if not self._curKey:
|
||||
# event didn't start with us
|
||||
evt.ignore()
|
||||
return
|
||||
self._curKey = None
|
||||
if evt.matches(QKeySequence.Copy):
|
||||
self.triggerPageAction(QWebPage.Copy)
|
||||
evt.accept()
|
||||
|
|
Loading…
Reference in a new issue