本文整理汇总了Python中AnyQt.QtWidgets.QLineEdit.addAction方法的典型用法代码示例。如果您正苦于以下问题:Python QLineEdit.addAction方法的具体用法?Python QLineEdit.addAction怎么用?Python QLineEdit.addAction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AnyQt.QtWidgets.QLineEdit
的用法示例。
在下文中一共展示了QLineEdit.addAction方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setAction
# 需要导入模块: from AnyQt.QtWidgets import QLineEdit [as 别名]
# 或者: from AnyQt.QtWidgets.QLineEdit import addAction [as 别名]
def setAction(self, action, position=LeftPosition):
"""
Set `action` to be displayed at `position`. Existing action
(if present) will be removed.
Parameters
----------
action : :class:`QAction`
position : int
Position where to set the action (default: ``LeftPosition``).
"""
curr = self.actionAt(position)
if curr is not None:
self.removeAction(position)
# Add the action using QWidget.addAction (for shortcuts)
QLineEdit.addAction(self, action)
button = LineEditButton(self)
button.setToolButtonStyle(Qt.ToolButtonIconOnly)
button.setDefaultAction(action)
button.setVisible(self.isVisible())
button.show()
button.setCursor(Qt.ArrowCursor)
button.triggered.connect(self.triggered)
button.triggered.connect(self.__onTriggered)
slot = _ActionSlot(position, action, button, False)
self.__actions[position - 1] = slot
if not self.testAttribute(Qt.WA_Resized):
# Need some sensible height to do the layout.
self.adjustSize()
self.__layoutActions()