本文整理汇总了Python中AnyQt.QtWidgets.QAction.setToolTip方法的典型用法代码示例。如果您正苦于以下问题:Python QAction.setToolTip方法的具体用法?Python QAction.setToolTip怎么用?Python QAction.setToolTip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AnyQt.QtWidgets.QAction
的用法示例。
在下文中一共展示了QAction.setToolTip方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: createTabButton
# 需要导入模块: from AnyQt.QtWidgets import QAction [as 别名]
# 或者: from AnyQt.QtWidgets.QAction import setToolTip [as 别名]
def createTabButton(self, widget, text, icon=None, toolTip=None):
"""
Create the tab button for `widget`.
"""
action = QAction(text, self)
action.setCheckable(True)
if icon:
action.setIcon(icon)
if toolTip:
action.setToolTip(toolTip)
self.__tabActionGroup.addAction(action)
self.__actionMapper.setMapping(action, action)
action.toggled.connect(self.__actionMapper.map)
button = ToolBoxTabButton(self, objectName="toolbox-tab-button")
button.setDefaultAction(action)
button.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)
button.setSizePolicy(QSizePolicy.Ignored,
QSizePolicy.Fixed)
if self.__tabIconSize.isValid():
button.setIconSize(self.__tabIconSize)
if self.__tabButtonHeight > 0:
button.setFixedHeight(self.__tabButtonHeight)
return button
示例2: __insertItem
# 需要导入模块: from AnyQt.QtWidgets import QAction [as 别名]
# 或者: from AnyQt.QtWidgets.QAction import setToolTip [as 别名]
def __insertItem(self, index, item):
"""
Insert a widget action from `item` (`QModelIndex`) at `index`.
"""
value = item.data(self.__actionRole)
if isinstance(value, QAction):
action = value
else:
action = QAction(item_text(item), self)
action.setIcon(item_icon(item))
action.setToolTip(item_tooltip(item))
self.insertAction(index, action)
示例3: addTab
# 需要导入模块: from AnyQt.QtWidgets import QAction [as 别名]
# 或者: from AnyQt.QtWidgets.QAction import setToolTip [as 别名]
def addTab(self, widget, text, toolTip=None, icon=None):
if self.__macUnified:
action = QAction(text, self)
if toolTip:
action.setToolTip(toolTip)
if icon:
action.setIcon(toolTip)
action.setData(len(self.tab.actions()))
self.tab.addAction(action)
self.stack.addWidget(widget)
else:
i = self.tab.addTab(widget, text)
if toolTip:
self.tab.setTabToolTip(i, toolTip)
if icon:
self.tab.setTabIcon(i, icon)
示例4: __init__
# 需要导入模块: from AnyQt.QtWidgets import QAction [as 别名]
# 或者: from AnyQt.QtWidgets.QAction import setToolTip [as 别名]
def __init__(self):
super().__init__()
for name in self.signal_names:
setattr(self, name, {})
for s in self.libraryListSource:
s.flags = 0
self._cachedDocuments = {}
self.infoBox = gui.vBox(self.controlArea, 'Info')
gui.label(
self.infoBox, self,
"<p>Execute python script.</p><p>Input variables:<ul><li> " +
"<li>".join(map("in_{0}, in_{0}s".format, self.signal_names)) +
"</ul></p><p>Output variables:<ul><li>" +
"<li>".join(map("out_{0}".format, self.signal_names)) +
"</ul></p>"
)
self.libraryList = itemmodels.PyListModel(
[], self,
flags=Qt.ItemIsSelectable | Qt.ItemIsEnabled | Qt.ItemIsEditable)
self.libraryList.wrap(self.libraryListSource)
self.controlBox = gui.vBox(self.controlArea, 'Library')
self.controlBox.layout().setSpacing(1)
self.libraryView = QListView(
editTriggers=QListView.DoubleClicked |
QListView.EditKeyPressed,
sizePolicy=QSizePolicy(QSizePolicy.Ignored,
QSizePolicy.Preferred)
)
self.libraryView.setItemDelegate(ScriptItemDelegate(self))
self.libraryView.setModel(self.libraryList)
self.libraryView.selectionModel().selectionChanged.connect(
self.onSelectedScriptChanged
)
self.controlBox.layout().addWidget(self.libraryView)
w = itemmodels.ModelActionsWidget()
self.addNewScriptAction = action = QAction("+", self)
action.setToolTip("Add a new script to the library")
action.triggered.connect(self.onAddScript)
w.addAction(action)
action = QAction(unicodedata.lookup("MINUS SIGN"), self)
action.setToolTip("Remove script from library")
action.triggered.connect(self.onRemoveScript)
w.addAction(action)
action = QAction("Update", self)
action.setToolTip("Save changes in the editor to library")
action.setShortcut(QKeySequence(QKeySequence.Save))
action.triggered.connect(self.commitChangesToLibrary)
w.addAction(action)
action = QAction("More", self, toolTip="More actions")
new_from_file = QAction("Import Script from File", self)
save_to_file = QAction("Save Selected Script to File", self)
restore_saved = QAction("Undo Changes to Selected Script", self)
save_to_file.setShortcut(QKeySequence(QKeySequence.SaveAs))
new_from_file.triggered.connect(self.onAddScriptFromFile)
save_to_file.triggered.connect(self.saveScript)
restore_saved.triggered.connect(self.restoreSaved)
menu = QMenu(w)
menu.addAction(new_from_file)
menu.addAction(save_to_file)
menu.addAction(restore_saved)
action.setMenu(menu)
button = w.addAction(action)
button.setPopupMode(QToolButton.InstantPopup)
w.layout().setSpacing(1)
self.controlBox.layout().addWidget(w)
self.execute_button = gui.button(self.controlArea, self, 'Run', callback=self.commit)
self.splitCanvas = QSplitter(Qt.Vertical, self.mainArea)
self.mainArea.layout().addWidget(self.splitCanvas)
self.defaultFont = defaultFont = \
"Monaco" if sys.platform == "darwin" else "Courier"
self.textBox = gui.vBox(self, 'Python Script')
self.splitCanvas.addWidget(self.textBox)
self.text = PythonScriptEditor(self)
self.textBox.layout().addWidget(self.text)
self.textBox.setAlignment(Qt.AlignVCenter)
self.text.setTabStopWidth(4)
#.........这里部分代码省略.........