From 650ea6766025d0c89ff6d8951138accecb87a779 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 8 Oct 2014 16:08:50 +0530 Subject: [PATCH] Fix comments editor widget in the edit metadata dialog swallowing Tab key presses, preventing the use of the keyboard to move between widgets. --- src/calibre/gui2/comments_editor.py | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/calibre/gui2/comments_editor.py b/src/calibre/gui2/comments_editor.py index 6badbe6c5f..3ef60abd7a 100644 --- a/src/calibre/gui2/comments_editor.py +++ b/src/calibre/gui2/comments_editor.py @@ -382,17 +382,12 @@ class EditorWidget(QWebView): # {{{ body.setAttribute('style', style) self.page().setContentEditable(not self.readonly) - def keyPressEvent(self, ev): - if ev.key() in (Qt.Key_Tab, Qt.Key_Escape, Qt.Key_Backtab): + def event(self, ev): + 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() - else: - return QWebView.keyPressEvent(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) + return False + return QWebView.event(self, ev) def contextMenuEvent(self, ev): menu = self.page().createStandardContextMenu()