Edit Book: Fix regression that caused copying of non-breaking spaces to not work when using the keyboard shortcuts

This commit is contained in:
Kovid Goyal 2015-04-10 20:52:02 +05:30
parent c60d39c519
commit 4c4f74fb5d

View File

@ -533,17 +533,16 @@ class TextEdit(PlainTextEdit):
self.show_tooltip(ev)
return True
if ev.type() == ev.ShortcutOverride:
if ev in (
# Let the global cut/copy/paste/undo/redo shortcuts work,this avoids the nbsp
# problem as well, since they use the overridden copy() method
# instead of the one from Qt, and allows proper customization
# of the shortcuts
QKeySequence.Copy, QKeySequence.Cut, QKeySequence.Paste, QKeySequence.Undo, QKeySequence.Redo
) or (
# This is used to convert typed hex codes into unicode
# characters
ev.key() == Qt.Key_X and ev.modifiers() == Qt.AltModifier
):
# Let the global cut/copy/paste/undo/redo shortcuts work, this avoids the nbsp
# problem as well, since they use the overridden copy() method
# instead of the one from Qt, and allows proper customization
# of the shortcuts
if ev in (QKeySequence.Copy, QKeySequence.Cut, QKeySequence.Paste, QKeySequence.Undo, QKeySequence.Redo):
ev.ignore()
return True
# This is used to convert typed hex codes into unicode
# characters
if ev.key() == Qt.Key_X and ev.modifiers() == Qt.AltModifier:
ev.accept()
return True
return QPlainTextEdit.event(self, ev)