本文整理汇总了Python中PySide.QtGui.QAction.setVisible方法的典型用法代码示例。如果您正苦于以下问题:Python QAction.setVisible方法的具体用法?Python QAction.setVisible怎么用?Python QAction.setVisible使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide.QtGui.QAction
的用法示例。
在下文中一共展示了QAction.setVisible方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ContextMenuView
# 需要导入模块: from PySide.QtGui import QAction [as 别名]
# 或者: from PySide.QtGui.QAction import setVisible [as 别名]
class ContextMenuView(QMenu):
RENAME_ACTION = "&Rename"
REPLACE_STEP_ACTION = "Replace &Step"
SET_HOTKEY_ACTION = "Set &Hotkey"
def __init__(self, *args, **kwargs):
super(ContextMenuView, self).__init__(*args, **kwargs)
self.__menu_steps = Facade.getInstance().retrieveProxy(StepPoolProxy.NAME).get_step_files()
self.__rename = QAction(ContextMenuView.RENAME_ACTION, None)
self.__replace_step = QAction(ContextMenuView.REPLACE_STEP_ACTION, None)
self.__set_hotkey = QAction(ContextMenuView.SET_HOTKEY_ACTION, None)
# noinspection PyUnresolvedReferences
self.__rename.triggered.connect(self.on_rename_menu)
# noinspection PyUnresolvedReferences
self.__replace_step.triggered.connect(self.on_replace_step)
# noinspection PyUnresolvedReferences
self.__set_hotkey.triggered.connect(self.on_set_hotkey)
self.fill(None)
self.addAction(self.__rename)
self.addAction(self.__replace_step)
self.addAction(self.__set_hotkey)
def fill(self, item_type):
self.__rename.setVisible(False)
self.__replace_step.setVisible(False)
self.__set_hotkey.setVisible(False)
if item_type == UI.STEP or \
item_type == UI.ACTION or \
item_type == UI.ACTION_GROUP:
self.__rename.setVisible(True)
if item_type == UI.STEP:
self.__replace_step.setVisible(True)
if item_type == UI.ACTION:
self.__set_hotkey.setVisible(True)
def on_rename_menu(self):
Facade.getInstance().sendNotification(Notes.CONTEXT_MENU_RENAME)
def on_replace_step(self):
Facade.getInstance().sendNotification(Notes.CONTEXT_MENU_REPLACE_STEP)
def on_set_hotkey(self):
Facade.getInstance().sendNotification(Notes.CONTEXT_MENU_SET_HOTKEY)