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


Python QtWidgets.QAction方法代码示例

本文整理汇总了Python中Qt.QtWidgets.QAction方法的典型用法代码示例。如果您正苦于以下问题:Python QtWidgets.QAction方法的具体用法?Python QtWidgets.QAction怎么用?Python QtWidgets.QAction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Qt.QtWidgets的用法示例。


在下文中一共展示了QtWidgets.QAction方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: mousePressEvent

# 需要导入模块: from Qt import QtWidgets [as 别名]
# 或者: from Qt.QtWidgets import QAction [as 别名]
def mousePressEvent(self, evnt):
        super(TesterList, self).mousePressEvent(evnt)

        if QtCore.Qt.MouseButton.LeftButton == evnt.button():
            index = self.indexAt(evnt.pos())
            if index.row() < 0:
                self.__current_tester = None
                self.clearSelection()

        elif QtCore.Qt.MouseButton.RightButton == evnt.button():
            menu = QtWidgets.QMenu(self)
            test = QtWidgets.QAction("Single Test", menu)
            menu.addAction(test)
            pos = self.mapToGlobal(evnt.pos())
            menu.popup(QtCore.QPoint(pos.x() - 10, pos.y() - 10))
            test.triggered.connect(self.__testTriggered) 
开发者ID:sol-ansano-kim,项目名称:medic,代码行数:18,代码来源:widgets.py

示例2: __init__

# 需要导入模块: from Qt import QtWidgets [as 别名]
# 或者: from Qt.QtWidgets import QAction [as 别名]
def __init__(self):
        super(LoggerTool, self).__init__()
        self.logView = QTextBrowser()
        self.logView.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
        self.logView.setOpenLinks(False)
        self.logView.setReadOnly(True)
        self.logView.setStyleSheet("background-color: %s; Font: 10pt 'Consolas'" %
                                   "rgba%s" % str(editableStyleSheet().LoggerBgColor.getRgb()))
        self.clearAction = QAction("Clear", None)
        self.clearAction.triggered.connect(self.clearView)
        self.logView.addAction(self.clearAction)
        self.logView.anchorClicked.connect(self.anchorClickedMethod)
        self.logView.setTextColor(QtGui.QColor('white'))
        self.setWidget(self.logView)
        #####################################################
        # Sys Output Redirection
        #####################################################
        self.handler = None
        if REDIRECT:
            self.handler = QtHandler(self)
        else:
            self.handler = logging.StreamHandler(sys.stdout)

        logger.setLevel(logging.DEBUG)
        sys.excepthook = LoggerTool.exceptHook
        if self.handler and REDIRECT:
            self.handler.setFormatter(LoggerTool.formater)
            logger.addHandler(self.handler)
            self.handler.messageHolder.messageWritten.connect(
                lambda value: self.logPython(value, 0))
            self.handler.messageHolder.warningWritten.connect(
                lambda value: self.logPython(value, 1))
            self.handler.messageHolder.errorWritten.connect(
                lambda value: self.logPython(value, 2))
            self.handler.messageHolder.flushSig.connect(self.flushPython)
    #####################################################
    # Logger
    ##################################################### 
开发者ID:wonderworks-software,项目名称:PyFlow,代码行数:40,代码来源:LoggerTool.py

示例3: __init__

# 需要导入模块: from Qt import QtWidgets [as 别名]
# 或者: from Qt.QtWidgets import QAction [as 别名]
def __init__(self, parent=None, searchByHeaders=False):
        super(PropertiesWidget, self).__init__(parent)
        self.setWindowTitle("Properties view")
        self.mainLayout = QtWidgets.QVBoxLayout(self)
        self.mainLayout.setObjectName("propertiesMainLayout")
        self.mainLayout.setContentsMargins(2, 2, 2, 2)
        self.searchBox = QtWidgets.QLineEdit(self)
        self.searchBox.setObjectName("lineEdit")
        self.searchBox.setPlaceholderText(str("search..."))
        self.searchBox.textChanged.connect(self.filterByHeaders if searchByHeaders else self.filterByHeadersAndFields)
        self.searchBoxWidget = QtWidgets.QWidget()
        self.searchBoxLayout = QtWidgets.QHBoxLayout(self.searchBoxWidget)
        self.searchBoxLayout.setContentsMargins(1, 1, 1, 1)
        self.searchBoxLayout.addWidget(self.searchBox)

        # self.settingsButton = QtWidgets.QToolButton()
        # self.settingsButton.setIcon(QtGui.QIcon(":/settings.png"))
        # self.settingsMenu = QtWidgets.QMenu()
        # self.editPropertiesAction = QtWidgets.QAction("Edit Parameter Interface", None)
        # self.settingsMenu.addAction(self.editPropertiesAction)
        # self.settingsButton.setMenu(self.settingsMenu)
        # self.editPropertiesAction.triggered.connect(self.showPropertyEditor)
        #self.settingsButton.clicked.connect(self.spawnDuplicate.emit)
        # self.settingsButton.setPopupMode(QtWidgets.QToolButton.InstantPopup)

        self.lockCheckBox = QtWidgets.QToolButton()
        self.lockCheckBox.setCheckable(True)
        self.lockCheckBox.setIcon(QtGui.QIcon(':/unlocked.png'))
        self.lockCheckBox.toggled.connect(self.changeLockIcon)
        self.searchBoxLayout.addWidget(self.lockCheckBox)
        self.tearOffCopy = QtWidgets.QToolButton()
        self.tearOffCopy.setIcon(QtGui.QIcon(":/tear_off_copy_bw.png"))
        self.tearOffCopy.clicked.connect(self.spawnDuplicate.emit)
        self.searchBoxLayout.addWidget(self.tearOffCopy)
        self.mainLayout.addWidget(self.searchBoxWidget)
        self.searchBoxWidget.hide()
        self.contentLayout = QtWidgets.QVBoxLayout()
        self.contentLayout.setSizeConstraint(QtWidgets.QLayout.SetMinAndMaxSize)
        self.mainLayout.addLayout(self.contentLayout)
        self.spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
        self.mainLayout.addItem(self.spacerItem)
        self.mainLayout.setSizeConstraint(QtWidgets.QLayout.SetMinAndMaxSize)
        self.setSizePolicy(QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)) 
开发者ID:wonderworks-software,项目名称:PyFlow,代码行数:45,代码来源:PropertiesFramework.py


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