当前位置: 首页>>代码示例>>Python>>正文


Python QAction.setProperty方法代码示例

本文整理汇总了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
开发者ID:nnaabbcc,项目名称:exercise,代码行数:12,代码来源:MdiAreaTest.py

示例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)
开发者ID:afester,项目名称:CodeSamples,代码行数:53,代码来源:Toolbars.py


注:本文中的PyQt5.QtWidgets.QAction.setProperty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。