Commits

Yuya Nishihara committed 12694d3

hgqt: use setShortcuts() to preserve secondary key of StandardKey (refs #2045)

setShortcut(QKeySequence) binds only primary one, because QKeySequence is
designed as such.

  • Participants
  • Parent commits edb5fdc

Comments (0)

Files changed (5)

File tortoisehg/hgqt/filedialogs.py

         self.editToolbar = QToolBar(self)
         self.editToolbar.setContextMenuPolicy(Qt.PreventContextMenu)
         self.addToolBar(Qt.ToolBarArea(Qt.TopToolBarArea), self.editToolbar)
-        self.actionClose = QAction(self, shortcut=QKeySequence.Close)
-        self.actionReload = QAction(self, shortcut=QKeySequence.Refresh)
+        self.actionClose = QAction(self)
+        self.actionClose.setShortcuts(QKeySequence.Close)
+        self.actionReload = QAction(self)
+        self.actionReload.setShortcuts(QKeySequence.Refresh)
         self.editToolbar.addAction(self.actionReload)
         self.addAction(self.actionClose)
 
         self.editToolbar = QToolBar(self)
         self.editToolbar.setContextMenuPolicy(Qt.PreventContextMenu)
         self.addToolBar(Qt.ToolBarArea(Qt.TopToolBarArea), self.editToolbar)
-        self.actionClose = QAction(self, shortcut=QKeySequence.Close)
-        self.actionReload = QAction(self, shortcut=QKeySequence.Refresh)
+        self.actionClose = QAction(self)
+        self.actionClose.setShortcuts(QKeySequence.Close)
+        self.actionReload = QAction(self)
+        self.actionReload.setShortcuts(QKeySequence.Refresh)
         self.editToolbar.addAction(self.actionReload)
         self.addAction(self.actionClose)
 

File tortoisehg/hgqt/fileview.py

         self.actionFind = self.searchbar.toggleViewAction()
         self.actionFind.setIcon(qtlib.geticon('edit-find'))
         self.actionFind.setToolTip(_('Toggle display of text search bar'))
-        self.actionFind.setShortcut(QKeySequence.Find)
+        self.actionFind.setShortcuts(QKeySequence.Find)
 
         self.actionShelf = QAction('Shelve', self)
         self.actionShelf.setIcon(qtlib.geticon('shelve'))

File tortoisehg/hgqt/qscilib.py

         else:
             self._stdMenu.clear()
         if not self.isReadOnly():
-            a = self._stdMenu.addAction(_('Undo'), self.undo, QKeySequence.Undo)
+            a = self._stdMenu.addAction(_('Undo'), self.undo)
+            a.setShortcuts(QKeySequence.Undo)
             a.setEnabled(self.isUndoAvailable())
-            a = self._stdMenu.addAction(_('Redo'), self.redo, QKeySequence.Redo)
+            a = self._stdMenu.addAction(_('Redo'), self.redo)
+            a.setShortcuts(QKeySequence.Redo)
             a.setEnabled(self.isRedoAvailable())
             self._stdMenu.addSeparator()
-            a = self._stdMenu.addAction(_('Cut'), self.cut, QKeySequence.Cut)
+            a = self._stdMenu.addAction(_('Cut'), self.cut)
+            a.setShortcuts(QKeySequence.Cut)
             a.setEnabled(self.hasSelectedText())
-        a = self._stdMenu.addAction(_('Copy'), self.copy, QKeySequence.Copy)
+        a = self._stdMenu.addAction(_('Copy'), self.copy)
+        a.setShortcuts(QKeySequence.Copy)
         a.setEnabled(self.hasSelectedText())
         if not self.isReadOnly():
-            self._stdMenu.addAction(_('Paste'), self.paste, QKeySequence.Paste)
-            a = self._stdMenu.addAction(_('Delete'), self.removeSelectedText,
-                               QKeySequence.Delete)
+            a = self._stdMenu.addAction(_('Paste'), self.paste)
+            a.setShortcuts(QKeySequence.Paste)
+            a = self._stdMenu.addAction(_('Delete'), self.removeSelectedText)
+            a.setShortcuts(QKeySequence.Delete)
             a.setEnabled(self.hasSelectedText())
         self._stdMenu.addSeparator()
-        self._stdMenu.addAction(_('Select All'),
-                                self.selectAll, QKeySequence.SelectAll)
+        a = self._stdMenu.addAction(_('Select All'), self.selectAll)
+        a.setShortcuts(QKeySequence.SelectAll)
         self._stdMenu.addSeparator()
         qsci = QsciScintilla
         wrapmenu = QMenu(_('Wrap'), self)

File tortoisehg/hgqt/shelve.py

         self.tbarhbox.addWidget(self.rbar)
         self.refreshAction = a = QAction(_('Refresh'), self)
         a.setIcon(qtlib.geticon('view-refresh'))
-        a.setShortcut(QKeySequence.Refresh)
+        a.setShortcuts(QKeySequence.Refresh)
         a.triggered.connect(self.refreshCombos)
         self.rbar.addAction(self.refreshAction)
         self.actionNew = a = QAction(_('New Shelf'), self)

File tortoisehg/hgqt/workbench.py

             else:
                 action.setIcon(qtlib.getmenuicon(icon))
         if shortcut:
-            action.setShortcut(qtlib.keysequence(shortcut))
+            keyseq = qtlib.keysequence(shortcut)
+            if isinstance(keyseq, QKeySequence.StandardKey):
+                action.setShortcuts(keyseq)
+            else:
+                action.setShortcut(keyseq)
         if tooltip:
             action.setToolTip(tooltip)
         if data is not None: