shim only the keys we actually use

This commit is contained in:
KIU Shueng Chuan 2021-02-14 07:56:05 +08:00
parent 6ad1d752fe
commit a1f9100ef1

View File

@ -425,7 +425,10 @@ if QT_LIB == PYQT6:
# QKeyEvent::key() returns an int # QKeyEvent::key() returns an int
# so comparison with a Key_* enum will always be False # so comparison with a Key_* enum will always be False
# here we convert the enum to its int value # here we convert the enum to its int value
for e in QtCore.Qt.Key: keys = ['Up', 'Down', 'Right', 'Left', 'Return', 'Enter', 'Delete', 'Backspace',
'PageUp', 'PageDown', 'Home', 'End', 'Tab', 'Backtab', 'Escape', 'Space']
for name in keys:
e = getattr(QtCore.Qt.Key, 'Key_' + name)
setattr(QtCore.Qt, e.name, e.value) setattr(QtCore.Qt, e.name, e.value)
# shim the old names for QPointF mouse coords # shim the old names for QPointF mouse coords