Fix comments editor widget in the edit metadata dialog swallowing Tab key presses, preventing the use of the keyboard to move between widgets.

This commit is contained in:
Kovid Goyal 2014-10-08 16:08:50 +05:30
parent c6e2cbac2e
commit 650ea67660

View File

@ -382,17 +382,12 @@ class EditorWidget(QWebView): # {{{
body.setAttribute('style', style) body.setAttribute('style', style)
self.page().setContentEditable(not self.readonly) self.page().setContentEditable(not self.readonly)
def keyPressEvent(self, ev): def event(self, ev):
if ev.key() in (Qt.Key_Tab, Qt.Key_Escape, Qt.Key_Backtab): if ev.type() in (ev.KeyPress, ev.KeyRelease, ev.ShortcutOverride) and ev.key() in (
Qt.Key_Tab, Qt.Key_Escape, Qt.Key_Backtab):
ev.ignore() ev.ignore()
else: return False
return QWebView.keyPressEvent(self, ev) return QWebView.event(self, ev)
def keyReleaseEvent(self, ev):
if ev.key() in (Qt.Key_Tab, Qt.Key_Escape, Qt.Key_Backtab):
ev.ignore()
else:
return QWebView.keyReleaseEvent(self, ev)
def contextMenuEvent(self, ev): def contextMenuEvent(self, ev):
menu = self.page().createStandardContextMenu() menu = self.page().createStandardContextMenu()