示例#1
0
    def _aboutToShowTabsMenu(self):
        self._menuTabs.clear()

        for idx in range(self.count()):
            tab = self._weTab(idx)
            if not tab or tab.isPinned():
                continue

            action = QAction(self)
            action.setIcon(tab.icon())

            if idx == self.currentIndex():
                f = action.font()
                f.setBold(True)
                action.setFont(f)

            title = tab.title()
            title.replace('&', '&&')
            action.setText(gVar.appTools.truncatedText(title, 40))

            # TODO: QVariant::fromValue(qobject_cast<QWidget*>(tab)
            action.setData(tab)
            action.triggered.connect(self._actionChangeIndex)
            self._menuTabs.addAction(action)