mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Keyboard shortcuts: Allow use of symbol keys like >,*,etc. Fixes #847378 (Error in shortcut-handler)
This commit is contained in:
parent
7eadf1c5c1
commit
1ecfb81a07
@ -443,7 +443,13 @@ class Editor(QFrame): # {{{
|
||||
return QWidget.keyPressEvent(self, ev)
|
||||
button = getattr(self, 'button%d'%which)
|
||||
button.setStyleSheet('QPushButton { font-weight: normal}')
|
||||
sequence = QKeySequence(code|(int(ev.modifiers())&~Qt.KeypadModifier))
|
||||
mods = int(ev.modifiers()) & ~Qt.KeypadModifier
|
||||
txt = unicode(ev.text())
|
||||
if txt and txt.lower() == txt.upper():
|
||||
# We have a symbol like ! or > etc. In this case the value of code
|
||||
# already includes Shift, so remove it
|
||||
mods &= ~Qt.ShiftModifier
|
||||
sequence = QKeySequence(code|mods)
|
||||
button.setText(sequence.toString(QKeySequence.NativeText))
|
||||
self.capture = 0
|
||||
dup_desc = self.dup_check(sequence)
|
||||
|
Loading…
x
Reference in New Issue
Block a user