Add Ctrl+Return shortcut to go to next item
offlate/window.py
93 | 93 | self.currentContent = list(self.content.keys())[self.filechooser.currentIndex()] | |
94 | 94 | self.updateContent() | |
95 | 95 | ||
96 | + | def nextItem(self): | |
97 | + | index = self.treeWidget.currentIndex() | |
98 | + | nextItem = self.treeWidget.itemFromIndex(self.treeWidget.indexBelow(index)) | |
99 | + | self.treeWidget.setCurrentItem(nextItem) | |
100 | + | ||
96 | 101 | def selectItem(self, current, old): | |
97 | 102 | if current == None: | |
98 | 103 | return | |
… | |||
472 | 477 | for i in range(0, self.tabs.count()): | |
473 | 478 | self.tabs.widget(i).setFont(self.monospaceAct.isChecked()) | |
474 | 479 | ||
480 | + | def nextItem(self): | |
481 | + | self.tabs.currentWidget().nextItem() | |
482 | + | ||
475 | 483 | def initUI(self): | |
476 | 484 | # Build menu | |
477 | 485 | exitAct = QAction(QIcon('exit.png'), self.tr('Exit'), self) | |
… | |||
521 | 529 | self.monospaceAct.setChecked(False) | |
522 | 530 | self.monospaceAct.triggered.connect(self.setFont) | |
523 | 531 | ||
532 | + | self.nextShortcut = QShortcut(QKeySequence("Ctrl+Return"), self) | |
533 | + | self.nextShortcut.activated.connect(self.nextItem) | |
534 | + | ||
524 | 535 | self.statusBar() | |
525 | 536 | ||
526 | 537 | openMenu = QMenu(self.tr('Open'), self) |