Commits

Virgil Dupras committed fa7715f

[#346] Added arrow-based next/prev tab shortcuts on Qt.

  • Participants
  • Parent commits 5c89a45

Comments (0)

Files changed (1)

File qt/controller/main_window.py

 from PyQt4 import QtGui
 from PyQt4.QtCore import Qt, QProcess, QUrl, QRect, QSize
 from PyQt4.QtGui import (QMainWindow, QPrintDialog, QMessageBox, QIcon, QPixmap,
-    QDesktopServices, QTabBar, QSizePolicy, QHBoxLayout, QPushButton, QMenu, QAction, QMenuBar)
+    QDesktopServices, QTabBar, QSizePolicy, QHBoxLayout, QPushButton, QMenu, QAction, QMenuBar,
+    QShortcut, QKeySequence)
 
 from qtlib.recent import Recent
 from qtlib.search_edit import SearchEdit
         self.tabBar.setMovable(True)
         self.tabBar.setTabsClosable(True)
         
+        seq = QKeySequence(Qt.CTRL + Qt.SHIFT + Qt.Key_Right)
+        self._shortcutNextTab = QShortcut(seq, self)
+        seq = QKeySequence(Qt.CTRL + Qt.SHIFT + Qt.Key_Left)
+        self._shortcutPrevTab = QShortcut(seq, self)
+        
         # Linux setup
         if ISLINUX:
             self.actionCheckForUpdate.setVisible(False) # This only works on Windows
         self.actionAbout.triggered.connect(self.aboutTriggered)
         self.actionOpenDebugLog.triggered.connect(self.openDebugLogTriggered)
         self.actionQuit.triggered.connect(self.close)
+        
+        # Extra Shortcuts
+        self._shortcutNextTab.activated.connect(self.showNextViewTriggered)
+        self._shortcutPrevTab.activated.connect(self.showPreviousViewTriggered)
     
     #--- QWidget overrides
     def closeEvent(self, event):