Add Ctrl+Return shortcut to go to next item

Julien LepillerWed Jun 20 23:29:09+0200 2018

bebf4c9

Add Ctrl+Return shortcut to go to next item

offlate/window.py

9393
        self.currentContent = list(self.content.keys())[self.filechooser.currentIndex()]
9494
        self.updateContent()
9595
96+
    def nextItem(self):
97+
        index = self.treeWidget.currentIndex()
98+
        nextItem = self.treeWidget.itemFromIndex(self.treeWidget.indexBelow(index))
99+
        self.treeWidget.setCurrentItem(nextItem)
100+
96101
    def selectItem(self, current, old):
97102
        if current == None:
98103
            return

472477
        for i in range(0, self.tabs.count()):
473478
            self.tabs.widget(i).setFont(self.monospaceAct.isChecked())
474479
480+
    def nextItem(self):
481+
        self.tabs.currentWidget().nextItem()
482+
475483
    def initUI(self):
476484
        # Build menu
477485
        exitAct = QAction(QIcon('exit.png'), self.tr('Exit'), self)

521529
        self.monospaceAct.setChecked(False)
522530
        self.monospaceAct.triggered.connect(self.setFont)
523531
532+
        self.nextShortcut = QShortcut(QKeySequence("Ctrl+Return"), self)
533+
        self.nextShortcut.activated.connect(self.nextItem)
534+
524535
        self.statusBar()
525536
526537
        openMenu = QMenu(self.tr('Open'), self)