本文整理匯總了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))