37 |
37 |
38 self.clickGroup.installEventFilter(self) |
38 self.clickGroup.installEventFilter(self) |
39 self.clearButton.installEventFilter(self) |
39 self.clearButton.installEventFilter(self) |
40 self.clickEdit.installEventFilter(self) |
40 self.clickEdit.installEventFilter(self) |
41 |
41 |
42 self.buttonBox.button(QDialogButtonBox.Ok).installEventFilter(self) |
42 self.buttonBox.button( |
43 self.buttonBox.button(QDialogButtonBox.Cancel).installEventFilter(self) |
43 QDialogButtonBox.StandardButton.Ok).installEventFilter(self) |
|
44 self.buttonBox.button( |
|
45 QDialogButtonBox.StandardButton.Cancel).installEventFilter(self) |
44 |
46 |
45 self.__modifiers = modifiers |
47 self.__modifiers = modifiers |
46 self.__button = button |
48 self.__button = button |
47 |
49 |
48 self.__showClickText() |
50 self.__showClickText() |
53 @pyqtSlot() |
55 @pyqtSlot() |
54 def on_clearButton_clicked(self): |
56 def on_clearButton_clicked(self): |
55 """ |
57 """ |
56 Private slot to clear the entered sequence. |
58 Private slot to clear the entered sequence. |
57 """ |
59 """ |
58 self.__modifiers = Qt.NoModifier |
60 self.__modifiers = Qt.KeyboardModifier.NoModifier |
59 self.__button = Qt.NoButton |
61 self.__button = Qt.MouseButton.NoButton |
60 self.__showClickText() |
62 self.__showClickText() |
61 |
63 |
62 def __showClickText(self): |
64 def __showClickText(self): |
63 """ |
65 """ |
64 Private method to show a string representing the entered mouse click |
66 Private method to show a string representing the entered mouse click |
65 sequence. |
67 sequence. |
66 """ |
68 """ |
67 if self.__button == Qt.NoButton: |
69 if self.__button == Qt.MouseButton.NoButton: |
68 self.clickEdit.setText("") |
70 self.clickEdit.setText("") |
69 else: |
71 else: |
70 self.clickEdit.setText(MouseUtilities.MouseButtonModifier2String( |
72 self.clickEdit.setText(MouseUtilities.MouseButtonModifier2String( |
71 self.__modifiers, self.__button)) |
73 self.__modifiers, self.__button)) |
72 |
74 |
80 @type QEvent |
82 @type QEvent |
81 @return flag indicating a handled event |
83 @return flag indicating a handled event |
82 @rtype bool |
84 @rtype bool |
83 """ |
85 """ |
84 if ( |
86 if ( |
85 event.type() == QEvent.MouseButtonRelease and |
87 event.type() == QEvent.Type.MouseButtonRelease and |
86 watched == self.clickEdit |
88 watched == self.clickEdit |
87 ): |
89 ): |
88 self.__modifiers = int(event.modifiers()) |
90 self.__modifiers = int(event.modifiers()) |
89 self.__button = int(event.button()) |
91 self.__button = int(event.button()) |
90 self.__showClickText() |
92 self.__showClickText() |