本文整理汇总了Python中PyQt5.QtWidgets.QActionGroup.setObjectName方法的典型用法代码示例。如果您正苦于以下问题:Python QActionGroup.setObjectName方法的具体用法?Python QActionGroup.setObjectName怎么用?Python QActionGroup.setObjectName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtWidgets.QActionGroup
的用法示例。
在下文中一共展示了QActionGroup.setObjectName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _get_menu
# 需要导入模块: from PyQt5.QtWidgets import QActionGroup [as 别名]
# 或者: from PyQt5.QtWidgets.QActionGroup import setObjectName [as 别名]
def _get_menu(self):
# main menu
menu = QMenu()
main_menu_action_group = QActionGroup(menu)
main_menu_action_group.setObjectName("main")
# character menu
map_action = QAction(menu)
map_action.setText("Toggle Map")
main_menu_action_group.addAction(map_action)
separator = QAction(menu)
separator.setSeparator(True)
main_menu_action_group.addAction(separator)
characters_action = QAction(menu)
characters_action.setText("Switch Characters")
main_menu_action_group.addAction(characters_action)
separator = QAction(menu)
separator.setSeparator(True)
main_menu_action_group.addAction(separator)
settings_action = QAction(menu)
settings_action.setText("Settings")
main_menu_action_group.addAction(settings_action)
quit_action = QAction(menu)
quit_action.setText("Quit")
main_menu_action_group.addAction(quit_action)
menu.addActions(main_menu_action_group.actions())
menu.triggered[QAction].connect(self._menu_actions)
return menu
示例2: createActionGroup
# 需要导入模块: from PyQt5.QtWidgets import QActionGroup [as 别名]
# 或者: from PyQt5.QtWidgets.QActionGroup import setObjectName [as 别名]
def createActionGroup(parent, name=None, exclusive=False):
"""
Module function to create an action group.
@param parent parent object of the action group (QObject)
@param name name of the action group object (string)
@param exclusive flag indicating an exclusive action group (boolean)
@return reference to the created action group (QActionGroup)
"""
actGrp = QActionGroup(parent)
if name:
actGrp.setObjectName(name)
actGrp.setExclusive(exclusive)
return actGrp