本文整理汇总了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)
示例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
#####################################################
示例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))