--- a/eric6/Preferences/ShortcutDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Preferences/ShortcutDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -36,7 +36,7 @@ self.setObjectName(name) self.setModal(modal) self.setupUi(self) - self.setWindowFlags(Qt.Window) + self.setWindowFlags(Qt.WindowType.Window) self.keyIndex = 0 self.keys = [0, 0, 0, 0] @@ -56,8 +56,10 @@ self.keyEdit.installEventFilter(self) self.alternateKeyEdit.installEventFilter(self) - self.buttonBox.button(QDialogButtonBox.Ok).installEventFilter(self) - self.buttonBox.button(QDialogButtonBox.Cancel).installEventFilter(self) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).installEventFilter(self) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).installEventFilter(self) msh = self.minimumSizeHint() self.resize(max(self.width(), msh.width()), msh.height()) @@ -124,7 +126,7 @@ @param event the event that occurred @return always False """ - if event.type() == QEvent.KeyPress: + if event.type() == QEvent.Type.KeyPress: self.keyPressEvent(event) return True @@ -136,28 +138,34 @@ @param evt the key event (QKeyEvent) """ - if evt.key() in [Qt.Key_Control, Qt.Key_Meta, Qt.Key_Shift, Qt.Key_Alt, - Qt.Key_Menu, Qt.Key_Hyper_L, Qt.Key_Hyper_R, - Qt.Key_Super_L, Qt.Key_Super_R]: + if evt.key() in [ + Qt.Key.Key_Control, Qt.Key.Key_Meta, Qt.Key.Key_Shift, + Qt.Key.Key_Alt, Qt.Key.Key_Menu, + Qt.Key.Key_Hyper_L, Qt.Key.Key_Hyper_R, + Qt.Key.Key_Super_L, Qt.Key.Key_Super_R + ]: return if self.keyIndex == 4: self.keyIndex = 0 self.keys = [0, 0, 0, 0] - if evt.key() == Qt.Key_Backtab and evt.modifiers() & Qt.ShiftModifier: - self.keys[self.keyIndex] = Qt.Key_Tab + if ( + evt.key() == Qt.Key.Key_Backtab and + evt.modifiers() & Qt.KeyboardModifier.ShiftModifier + ): + self.keys[self.keyIndex] = Qt.Key.Key_Tab else: self.keys[self.keyIndex] = evt.key() - if evt.modifiers() & Qt.ShiftModifier: - self.keys[self.keyIndex] += Qt.SHIFT - if evt.modifiers() & Qt.ControlModifier: - self.keys[self.keyIndex] += Qt.CTRL - if evt.modifiers() & Qt.AltModifier: - self.keys[self.keyIndex] += Qt.ALT - if evt.modifiers() & Qt.MetaModifier: - self.keys[self.keyIndex] += Qt.META + if evt.modifiers() & Qt.KeyboardModifier.ShiftModifier: + self.keys[self.keyIndex] += Qt.Modifier.SHIFT + if evt.modifiers() & Qt.KeyboardModifier.ControlModifier: + self.keys[self.keyIndex] += Qt.Modifier.CTRL + if evt.modifiers() & Qt.KeyboardModifier.AltModifier: + self.keys[self.keyIndex] += Qt.Modifier.ALT + if evt.modifiers() & Qt.KeyboardModifier.MetaModifier: + self.keys[self.keyIndex] += Qt.Modifier.META self.keyIndex += 1