Simplify KeyInfo.text()

This commit is contained in:
Florian Bruhin 2018-02-28 11:15:44 +01:00
parent 2ca15d7667
commit b4d232badd

View File

@ -252,13 +252,13 @@ class KeyInfo:
def text(self): def text(self):
"""Get the text which would be displayed when pressing this key.""" """Get the text which would be displayed when pressing this key."""
text = QKeySequence(self.key).toString()
if self.key == Qt.Key_Space: if self.key == Qt.Key_Space:
return ' ' return ' '
elif len(text) > 1: elif self.key > 0xff:
# Special key? # Unprintable keys
return '' return ''
text = QKeySequence(self.key).toString()
if not self.modifiers & Qt.ShiftModifier: if not self.modifiers & Qt.ShiftModifier:
text = text.lower() text = text.lower()
return text return text