Fix Cmd+Left/Right keyboard shortcut not working when editing items in the book list on OS X. Fixes #1469554 [Keyboard navigation when editing fields in main window](https://bugs.launchpad.net/calibre/+bug/1469554)

Workaround for yet another Qt OSX bug.
https://bugreports.qt.io/browse/QTBUG-46911
This commit is contained in:
Kovid Goyal 2015-06-29 09:51:05 +05:30
parent 7875a3de4f
commit dcf48d9945
2 changed files with 14 additions and 1 deletions

View File

@ -340,6 +340,13 @@ class LineEdit(QLineEdit, LineEditECM):
return property(fget=fget, fset=fset)
# }}}
def event(self, ev):
# See https://bugreports.qt.io/browse/QTBUG-46911
if ev.type() == ev.ShortcutOverride and (
ev.key() in (Qt.Key_Left, Qt.Key_Right) and (ev.modifiers() & ~Qt.KeypadModifier) == Qt.ControlModifier):
ev.accept()
return QLineEdit.event(self, ev)
def complete(self, show_all=False, select_first=True):
orig = None
if show_all:

View File

@ -480,7 +480,13 @@ class EnLineEdit(LineEditECM, QLineEdit): # {{{
Includes an extended content menu.
'''
pass
def event(self, ev):
# See https://bugreports.qt.io/browse/QTBUG-46911
if ev.type() == ev.ShortcutOverride and (
ev.key() in (Qt.Key_Left, Qt.Key_Right) and (ev.modifiers() & ~Qt.KeypadModifier) == Qt.ControlModifier):
ev.accept()
return QLineEdit.event(self, ev)
# }}}
class ItemsCompleter(QCompleter): # {{{