PySide.QtGui.QToolBar class provides a movable panel that contains a set of controls.
工具栏按钮被添加通过添加 actions ,使用 PySide.QtGui.QToolBar.addAction() or PySide.QtGui.QWidget.insertAction() . Groups of buttons can be separated using PySide.QtGui.QToolBar.addSeparator() or PySide.QtGui.QToolBar.insertSeparator() . If a toolbar button is not appropriate, a widget can be inserted instead using PySide.QtGui.QToolBar.addWidget() or PySide.QtGui.QToolBar.insertWidget() ; examples of suitable widgets are PySide.QtGui.QSpinBox , PySide.QtGui.QDoubleSpinBox ,和 PySide.QtGui.QComboBox . When a toolbar button is pressed it emits the PySide.QtGui.QToolBar.actionTriggered() 信号。
A toolbar can be fixed in place in a particular area (e.g. at the top of the window), or it can be movable ( PySide.QtGui.QToolBar.isMovable() ) between toolbar areas; see PySide.QtGui.QToolBar.allowedAreas() and PySide.QtGui.QToolBar.isAreaAllowed() .
When a toolbar is resized in such a way that it is too small to show all the items it contains, an extension button will appear as the last item in the toolbar. Pressing the extension button will pop up a menu containing the items that does not currently fit in the toolbar.
当 PySide.QtGui.QToolBar is not a child of a PySide.QtGui.QMainWindow , it loses the ability to populate the extension pop up with widgets added to the toolbar using PySide.QtGui.QToolBar.addWidget() . Please use widget actions created by inheriting PySide.QtGui.QWidgetAction and implementing QWidgetAction.createWidget() 代替。
| 参数: |
|
|---|
构造 PySide.QtGui.QToolBar 采用给定 parent .
构造 PySide.QtGui.QToolBar 采用给定 parent .
The given window title identifies the toolbar and is shown in the context menu provided by PySide.QtGui.QMainWindow .
| 参数: | p – PySide.QtCore.QPoint |
|---|---|
| 返回类型: | PySide.QtGui.QAction |
Returns the action at point p . This function returns zero if no action was found.
另请参阅
| 参数: |
|
|---|---|
| 返回类型: |
这是重载函数。
Returns the action at the point x , y . This function returns zero if no action was found.
| 参数: | action – PySide.QtGui.QAction |
|---|---|
| 返回类型: | PySide.QtCore.QRect |
Returns the geometry of the toolbar item associated with the given action , or an invalid PySide.QtCore.QRect if no matching item is found.
| 参数: | action – PySide.QtGui.QAction |
|---|
| 参数: |
|
|---|---|
| 返回类型: |
这是重载函数。
创建新的动作采用给定 text . This action is added to the end of the toolbar. The action's PySide.QtGui.QAction.triggered() signal is connected to member in receiver .
| 参数: | text – unicode |
|---|---|
| 返回类型: | PySide.QtGui.QAction |
这是重载函数。
创建新的动作采用给定 text . This action is added to the end of the toolbar.
| 参数: |
|
|---|---|
| 返回类型: |
这是重载函数。
Creates a new action with the icon icon 和文本 text . This action is added to the end of the toolbar. The action's PySide.QtGui.QAction.triggered() signal is connected to member in receiver .
| 参数: |
|
|---|---|
| 返回类型: |
这是重载函数。
创建新的动作采用给定 icon and text . This action is added to the end of the toolbar.
| 返回类型: | PySide.QtGui.QAction |
|---|
Adds a separator to the end of the toolbar.
| 参数: | widget – PySide.QtGui.QWidget |
|---|---|
| 返回类型: | PySide.QtGui.QAction |
添加给定 widget to the toolbar as the toolbar's last item.
The toolbar takes ownership of widget .
若添加 PySide.QtGui.QToolButton with this method, the tools bar's Qt.ToolButtonStyle will not be respected.
注意
应使用 QAction.setVisible() to change the visibility of the widget. Using QWidget.setVisible() , QWidget.show() and QWidget.hide() does not work.
| 返回类型: | PySide.QtCore.Qt.ToolBarAreas |
|---|
| 参数: | allowedAreas – PySide.QtCore.Qt.ToolBarAreas |
|---|
Removes all actions from the toolbar.
| 返回类型: | PySide.QtCore.QSize |
|---|
| 参数: | iconSize – PySide.QtCore.QSize |
|---|
| 参数: | option – PySide.QtGui.QStyleOptionToolBar |
|---|
| 参数: | before – PySide.QtGui.QAction |
|---|---|
| 返回类型: | PySide.QtGui.QAction |
Inserts a separator into the toolbar in front of the toolbar item associated with the before action.
| 参数: |
|
|---|---|
| 返回类型: |
Inserts the given widget in front of the toolbar item associated with the before action.
Note: You should use QAction.setVisible() to change the visibility of the widget. Using QWidget.setVisible() , QWidget.show() and QWidget.hide() does not work.
| 参数: | area – PySide.QtCore.Qt.ToolBarArea |
|---|---|
| 返回类型: | PySide.QtCore.bool |
| 返回类型: | PySide.QtCore.bool |
|---|
| 返回类型: | PySide.QtCore.bool |
|---|
| 返回类型: | PySide.QtCore.bool |
|---|
This property holds whether the user can move the toolbar within the toolbar area, or between toolbar areas.
默认情况下,此特性为 true。
This property only makes sense if the toolbar is in a PySide.QtGui.QMainWindow .
| 参数: | movable – PySide.QtCore.bool |
|---|
| 返回类型: | PySide.QtCore.Qt.Orientation |
|---|
| 参数: | orientation – PySide.QtCore.Qt.Orientation |
|---|
| 参数: | areas – PySide.QtCore.Qt.ToolBarAreas |
|---|
| 参数: | floatable – PySide.QtCore.bool |
|---|
| 参数: | iconSize – PySide.QtCore.QSize |
|---|
| 参数: | movable – PySide.QtCore.bool |
|---|
| 参数: | orientation – PySide.QtCore.Qt.Orientation |
|---|
| 参数: | toolButtonStyle – PySide.QtCore.Qt.ToolButtonStyle |
|---|
| 返回类型: | PySide.QtGui.QAction |
|---|
Returns a checkable action that can be used to show or hide this toolbar.
The action's text is set to the toolbar's window title.
| 返回类型: | PySide.QtCore.Qt.ToolButtonStyle |
|---|
| 参数: | toolButtonStyle – PySide.QtCore.Qt.ToolButtonStyle |
|---|
| 参数: | topLevel – PySide.QtCore.bool |
|---|
| 参数: | visible – PySide.QtCore.bool |
|---|
| 参数: | action – PySide.QtGui.QAction |
|---|---|
| 返回类型: | PySide.QtGui.QWidget |
Returns the widget associated with the specified action .