def actions_for_context_menu(self, node): # type: (SchemeNode) -> List[QAction] """ Reimplemented from WidgetManager.actions_for_context_menu. Parameters ---------- node : SchemeNode Returns ------- actions : List[QAction] """ actions = [] widget = self.widget_for_node(node) if widget is not None: actions = [ a for a in widget.actions() if a.property("ext-workflow-node-menu-action") is True ] if log.isEnabledFor(logging.DEBUG): ac = QAction( self.tr("Show settings"), widget, objectName="show-settings", toolTip=self.tr("Show widget settings"), ) ac.setData(node) ac.triggered.connect(self.__dump_settings) actions.append(ac) return super().actions_for_context_menu(node) + actions
def create_action_for_item(self, item): """ Create a QAction instance for the widget description item. """ name = item.text() tooltip = item.toolTip() whatsThis = item.whatsThis() icon = item.icon() if icon: action = QAction(icon, name, self, toolTip=tooltip, whatsThis=whatsThis, statusTip=name) else: action = QAction(name, self, toolTip=tooltip, whatsThis=whatsThis, statusTip=name) widget_desc = item.data(self.WIDGET_DESC_ROLE) action.setData(widget_desc) action.setProperty("item", item) return action
def createActionForItem(self, item): """Create the QAction instance for item. """ action = QAction(item.icon(), item.text(), self, toolTip=item.toolTip()) action.setData(item) return action
def createActionForItem(self, index): """Create the QAction instance for item at `index` (`QModelIndex`). """ action = QAction( item_icon(index), item_text(index), self, toolTip=item_tooltip(index) ) action.setData(QPersistentModelIndex(index)) return action
def createActionForItem(self, index): """Create the QAction instance for item at `index` (`QModelIndex`). """ action = QAction(item_icon(index), item_text(index), self, toolTip=item_tooltip(index)) action.setData(QPersistentModelIndex(index)) return action
def addTab(self, widget, text, toolTip=None, icon=None): if self.__macUnified: action = QAction(text, self) if toolTip: action.setToolTip(toolTip) if icon: action.setIcon(toolTip) action.setData(len(self.tab.actions())) self.tab.addAction(action) self.stack.addWidget(widget) else: i = self.tab.addTab(widget, text) if toolTip: self.tab.setTabToolTip(i, toolTip) if icon: self.tab.setTabIcon(i, icon)
def makeaction(text, parent, data=None, **kwargs): # type: (str, QObject, Any, Any) -> QAction action = QAction(text, parent, **kwargs) if data is not None: action.setData(data) return action
def makeaction(text, parent, data=None, **kwargs): action = QAction(text, parent, **kwargs) if data is not None: action.setData(data) return action