The QToolBar class provides a movable panel that contains a set of controls. 更多...
继承 QWidget .
The QToolBar class provides a movable panel that contains a set of controls.
工具栏按钮被添加通过添加 actions ,使用 addAction () 或 insertAction (). Groups of buttons can be separated using addSeparator () 或 insertSeparator (). If a toolbar button is not appropriate, a widget can be inserted instead using addWidget () 或 insertWidget (); examples of suitable widgets are QSpinBox , QDoubleSpinBox ,和 QComboBox . When a toolbar button is pressed it 发射 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 ( isMovable ()) between toolbar areas; see allowedAreas () 和 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.
When a QToolBar is not a child of a QMainWindow , it loses the ability to populate the extension pop up with widgets added to the toolbar 使用 addWidget (). Please use widget actions created by inheriting QWidgetAction and implementing QWidgetAction.createWidget () 代替。
parent argument, if not None, causes self to be owned by Qt instead of PyQt.
构造 QToolBar with the given parent .
The given window title identifies the toolbar and is shown in the context menu provided by QMainWindow .
另请参阅 setWindowTitle ().
parent argument, if not None, causes self to be owned by Qt instead of PyQt.
构造 QToolBar with the given parent .
Returns the action at point p . This function returns zero if no action was found.
另请参阅 QWidget.childAt ().
这是重载函数。
Returns the action at the point x , y . This function returns zero if no action was found.
重实现自 QWidget.actionEvent ().
这是重载函数。
追加动作 action to the toolbar's list of actions.
另请参阅 QMenu.addAction () 和 QWidget.addAction ().
这是重载函数。
创建新的动作采用给定 text . This action is added to the end of the toolbar.
这是重载函数。
创建新的动作采用给定 icon and text . This action is added to the end of the toolbar.
这是重载函数。
创建新的动作采用给定 text . This action is added to the end of the toolbar. The action's triggered() signal is connected to member in receiver .
这是重载函数。
Creates a new action with the icon icon 和文本 text . This action is added to the end of the toolbar. The action's triggered() signal is connected to member in receiver .
Adds a separator to the end of the toolbar.
另请参阅 insertSeparator ().
widget argument has it's ownership transferred to Qt.
添加给定 widget to the toolbar as the toolbar's last item.
The toolbar takes ownership of widget .
若添加 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 () 和 QWidget.hide () does not work.
另请参阅 insertWidget ().
重实现自 QWidget.changeEvent ().
重实现自 QObject.childEvent ().
Removes all actions from the toolbar.
另请参阅 removeAction ().
重实现自 QObject.event ().
Inserts a separator into the toolbar in front of the toolbar item associated with the before action.
另请参阅 addSeparator ().
widget argument has it's ownership transferred to Qt.
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 () 和 QWidget.hide () does not work.
另请参阅 addWidget ().
Returns true if this toolbar is dockable in the given area ;否则返回 false。
重实现自 QWidget.paintEvent ().
重实现自 QWidget.resizeEvent ().
This method is also a Qt slot with the C++ signature void setIconSize(const QSize&) .
This method is also a Qt slot with the C++ signature void setToolButtonStyle(Qt::ToolButtonStyle) .
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.
另请参阅 QAction.text and QWidget.windowTitle .
Returns the widget associated with the specified action .
该函数在 Qt 4.2 引入。
另请参阅 addWidget ().
This is the default overload of this signal.
This signal is emitted when an action in this toolbar is triggered. This happens when the action's tool button is pressed, or when the action is triggered in some other way outside the tool bar. The parameter holds the triggered action .
This is the default overload of this signal.
This signal is emitted when the collection of allowed areas for the toolbar is changed. The new areas in which the toolbar can be positioned are specified by allowedAreas .
另请参阅 allowedAreas .
This is the default overload of this signal.
This signal is emitted when the icon size is changed. The iconSize parameter holds the toolbar's new icon size.
另请参阅 iconSize and QMainWindow.iconSize .
This is the default overload of this signal.
This signal is emitted when the toolbar becomes movable or fixed. If the toolbar can be moved, movable is true; otherwise it is false.
另请参阅 movable .
This is the default overload of this signal.
This signal is emitted when the orientation of the toolbar changes. The new orientation is specified by the orientation 给定。
另请参阅 orientation .
This is the default overload of this signal.
This signal is emitted when the tool button style is changed. toolButtonStyle parameter holds the toolbar's new tool button style.
另请参阅 toolButtonStyle and QMainWindow.toolButtonStyle .
This is the default overload of this signal.
此信号被发射当 floating 特性改变。 topLevel parameter is true if the toolbar is now floating; otherwise it is false.
该函数在 Qt 4.6 引入。
另请参阅 isWindow ().
This is the default overload of this signal.
This signal is emitted when the toolbar becomes visible (or invisible). This happens when the widget is hidden or shown.
该函数在 Qt 4.7 引入。