本文整理汇总了Python中PyQt5.QtWidgets.QAction.setProperty方法的典型用法代码示例。如果您正苦于以下问题:Python QAction.setProperty方法的具体用法?Python QAction.setProperty怎么用?Python QAction.setProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtWidgets.QAction
的用法示例。
在下文中一共展示了QAction.setProperty方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __window_list_menu_about_to_show
# 需要导入模块: from PyQt5.QtWidgets import QAction [as 别名]
# 或者: from PyQt5.QtWidgets.QAction import setProperty [as 别名]
def __window_list_menu_about_to_show(self):
self.__window_list_menu.clear()
windows = self.mdi_area.subWindowList()
index = 1
for window in windows:
action = QAction(str(index) + '. ' + window.windowTitle(), self.__window_list_menu)
action.setProperty('WindowObject', window)
action.triggered.connect(self.__on_select_window)
self.__window_list_menu.addAction(action)
index += 1
示例2: __init__
# 需要导入模块: from PyQt5.QtWidgets import QAction [as 别名]
# 或者: from PyQt5.QtWidgets.QAction import setProperty [as 别名]
def __init__(self, toolbar):
TitledToolbar.__init__(self, toolbar, 'Text style')
self.currentStyle = None
toolbar = QToolBar(self)
toolbar.setFloatable(False)
toolbar.setMovable(False)
self.styleToAction = {}
textKeywordAction = QAction(QIcon(':/icons/format-keyword.png'), 'Notepad link', toolbar)
textKeywordAction.setCheckable(True);
selector = ('olink', None, None)
textKeywordAction.setProperty('style', selector)
self.styleToAction[selector] = textKeywordAction
textKeywordAction.triggered.connect(self.styleSelected)
toolbar.addAction(textKeywordAction)
textLinkAction = QAction(QIcon(':/icons/format-link.png'), 'Internet link', toolbar)
textLinkAction.setCheckable(True);
selector = ('link', None, None)
textLinkAction.setProperty('style', selector)
self.styleToAction[selector] = textLinkAction
textLinkAction.triggered.connect(self.styleSelected)
toolbar.addAction(textLinkAction)
textBoldAction = QAction(QIcon(':/icons/format-text-emphasized.png'), 'Emphasize', toolbar)
textBoldAction.setCheckable(True);
selector = ('emphasis', None, None)
textBoldAction.setProperty('style', selector)
self.styleToAction[selector] = textBoldAction
textBoldAction.triggered.connect(self.styleSelected)
toolbar.addAction(textBoldAction)
textHighlightAction = QAction(QIcon(':/icons/format-text-highlight.png'), 'Highlight', toolbar)
textHighlightAction.setCheckable(True);
selector = ('emphasis', 'role', 'highlight')
textHighlightAction.setProperty('style', selector)
self.styleToAction[selector] = textHighlightAction
textHighlightAction.triggered.connect(self.styleSelected)
toolbar.addAction(textHighlightAction)
textCodeAction = QAction(QIcon(':/icons/format-text-code.png'), 'Code', toolbar)
textCodeAction.setCheckable(True);
selector = ('code', None, None)
textCodeAction.setProperty('style', selector)
self.styleToAction[selector] = textCodeAction
textCodeAction.triggered.connect(self.styleSelected)
toolbar.addAction(textCodeAction)
self.addWidget(toolbar)