Commits

Steve Borho committed 181c004

branchop: use QShortcuts instead of reimplementing keyPressEvent

  • Participants
  • Parent commits 0cba1c9
  • Branches stable

Comments (0)

Files changed (1)

File tortoisehg/hgqt/branchop.py

         layout.addWidget(bb)
         self.bb = bb
         self.branchCombo = branchCombo
-
-    def keyPressEvent(self, event):
-        # todo - is this necessary for a derivation of QDialog?
-        if event.key() in (Qt.Key_Return, Qt.Key_Enter):
-            if event.modifiers() == Qt.ControlModifier:
-                self.accept()  # Ctrl+Enter
-            return
-        elif event.key() == Qt.Key_Escape:
-            self.reject()
-            return
-        return super(QDialog, self).keyPressEvent(event)
+        QShortcut(QKeySequence('Ctrl+Return'), self, self.accept)
+        QShortcut(QKeySequence('Escape'), self, self.reject)
 
     def accept(self):
         '''Branch operation is one of: