QToolBar¶
The QToolBar
class provides a movable panel that contains a set of controls. More…

Synopsis¶
Functions¶
def
actionAt
(p)def
actionAt
(x, y)def
actionGeometry
(action)def
actionTriggered
(action)def
addAction
(icon, text)def
addAction
(icon, text, receiver)def
addAction
(text)def
addAction
(text, receiver)def
addSeparator
()def
addWidget
(widget)def
allowedAreas
()def
allowedAreasChanged
(allowedAreas)def
clear
()def
iconSize
()def
iconSizeChanged
(iconSize)def
insertSeparator
(before)def
insertWidget
(before, widget)def
isAreaAllowed
(area)def
isFloatable
()def
isFloating
()def
isMovable
()def
movableChanged
(movable)def
orientation
()def
orientationChanged
(orientation)def
setAllowedAreas
(areas)def
setFloatable
(floatable)def
setIconSize
(iconSize)def
setMovable
(movable)def
setOrientation
(orientation)def
setToolButtonStyle
(toolButtonStyle)def
toggleViewAction
()def
toolButtonStyle
()def
toolButtonStyleChanged
(toolButtonStyle)def
topLevelChanged
(topLevel)def
visibilityChanged
(visible)def
widgetForAction
(action)
Virtual functions¶
def
initStyleOption
(option)
Detailed Description¶
Toolbar buttons are added by adding actions, using addAction()
or insertAction()
. Groups of buttons can be separated using addSeparator()
or insertSeparator()
. If a toolbar button is not appropriate, a widget can be inserted instead using addWidget()
or insertWidget()
. Examples of suitable widgets are QSpinBox
, QDoubleSpinBox
, and QComboBox . When a toolbar button is pressed, it emits the signal.
A toolbar can be fixed in place in a particular area (e.g., at the top of the window), or it can be movable between toolbar areas; see setMovable()
, isMovable()
, allowedAreas()
and .
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 do 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 using addWidget()
. Please use widget actions created by inheriting QWidgetAction
and implementing createWidget()
instead.
See also
-
class
PySide6.QtWidgets.
QToolBar
([parent=None])¶ PySide6.QtWidgets.QToolBar(title[, parent=None])
- Parameters
parent –
PySide6.QtWidgets.QWidget
title – str
Constructs a QToolBar
with the given parent
.
Constructs a QToolBar
with the given parent
.
The given window title
identifies the toolbar and is shown in the context menu provided by QMainWindow
.
See also
-
PySide6.QtWidgets.QToolBar.
actionAt
(p)¶ - Parameters
- Return type
Returns the action at point p
. This function returns zero if no action was found.
See also
-
PySide6.QtWidgets.QToolBar.
actionAt
(x, y) - Parameters
x – int
y – int
- Return type
-
PySide6.QtWidgets.QToolBar.
actionGeometry
(action)¶ - Parameters
action –
PySide6.QtGui.QAction
- Return type
Returns the geometry of the toolbar item associated with the given action
, or an invalid QRect
if no matching item is found.
-
PySide6.QtWidgets.QToolBar.
actionTriggered
(action)¶ - Parameters
action –
PySide6.QtGui.QAction
-
PySide6.QtWidgets.QToolBar.
addAction
(icon, text)¶ - Parameters
icon –
PySide6.QtGui.QIcon
text – str
- Return type
-
PySide6.QtWidgets.QToolBar.
addAction
(icon, text, receiver) - Parameters
icon –
PySide6.QtGui.QIcon
text – str
receiver –
PySide6.QtCore.QObject
- Return type
-
PySide6.QtWidgets.QToolBar.
addAction
(text) - Parameters
text – str
- Return type
Creates a new action with the given text
. This action is added to the end of the toolbar.
-
PySide6.QtWidgets.QToolBar.
addAction
(text, receiver) - Parameters
text – str
receiver –
PySide6.QtCore.QObject
- Return type
-
PySide6.QtWidgets.QToolBar.
addSeparator
()¶ - Return type
Adds a separator to the end of the toolbar.
See also
-
PySide6.QtWidgets.QToolBar.
addWidget
(widget)¶ - Parameters
widget –
PySide6.QtWidgets.QWidget
- Return type
Adds the given widget
to the toolbar as the toolbar’s last item.
The toolbar takes ownership of widget
.
If you add a QToolButton
with this method, the toolbar’s ToolButtonStyle
will not be respected.
Note
You should use setVisible()
to change the visibility of the widget. Using setVisible()
, show()
and hide()
does not work.
See also
-
PySide6.QtWidgets.QToolBar.
allowedAreas
()¶ - Return type
ToolBarAreas
See also
-
PySide6.QtWidgets.QToolBar.
allowedAreasChanged
(allowedAreas)¶ - Parameters
allowedAreas –
ToolBarAreas
-
PySide6.QtWidgets.QToolBar.
clear
()¶
Removes all actions from the toolbar.
See also
-
PySide6.QtWidgets.QToolBar.
iconSize
()¶ - Return type
See also
-
PySide6.QtWidgets.QToolBar.
iconSizeChanged
(iconSize)¶ - Parameters
iconSize –
PySide6.QtCore.QSize
-
PySide6.QtWidgets.QToolBar.
initStyleOption
(option)¶ - Parameters
-
PySide6.QtWidgets.QToolBar.
insertSeparator
(before)¶ - Parameters
before –
PySide6.QtGui.QAction
- Return type
Inserts a separator into the toolbar in front of the toolbar item associated with the before
action.
See also
-
PySide6.QtWidgets.QToolBar.
insertWidget
(before, widget)¶ - Parameters
before –
PySide6.QtGui.QAction
widget –
PySide6.QtWidgets.QWidget
- Return type
Inserts the given widget
in front of the toolbar item associated with the before
action.
Note: You should use setVisible()
to change the visibility of the widget. Using setVisible()
, show()
and hide()
does not work.
See also
-
PySide6.QtWidgets.QToolBar.
isAreaAllowed
(area)¶ - Parameters
area –
ToolBarArea
- Return type
bool
-
PySide6.QtWidgets.QToolBar.
isFloatable
()¶ - Return type
bool
-
PySide6.QtWidgets.QToolBar.
isFloating
()¶ - Return type
bool
-
PySide6.QtWidgets.QToolBar.
isMovable
()¶ - Return type
bool
-
PySide6.QtWidgets.QToolBar.
movableChanged
(movable)¶ - Parameters
movable – bool
-
PySide6.QtWidgets.QToolBar.
orientation
()¶ - Return type
See also
-
PySide6.QtWidgets.QToolBar.
orientationChanged
(orientation)¶ - Parameters
orientation –
Orientation
-
PySide6.QtWidgets.QToolBar.
setAllowedAreas
(areas)¶ - Parameters
areas –
ToolBarAreas
See also
-
PySide6.QtWidgets.QToolBar.
setFloatable
(floatable)¶ - Parameters
floatable – bool
See also
-
PySide6.QtWidgets.QToolBar.
setIconSize
(iconSize)¶ - Parameters
iconSize –
PySide6.QtCore.QSize
See also
-
PySide6.QtWidgets.QToolBar.
setMovable
(movable)¶ - Parameters
movable – bool
See also
-
PySide6.QtWidgets.QToolBar.
setOrientation
(orientation)¶ - Parameters
orientation –
Orientation
See also
-
PySide6.QtWidgets.QToolBar.
setToolButtonStyle
(toolButtonStyle)¶ - Parameters
toolButtonStyle –
ToolButtonStyle
See also
-
PySide6.QtWidgets.QToolBar.
toggleViewAction
()¶ - Return type
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.
See also
text
windowTitle
-
PySide6.QtWidgets.QToolBar.
toolButtonStyle
()¶ - Return type
See also
-
PySide6.QtWidgets.QToolBar.
toolButtonStyleChanged
(toolButtonStyle)¶ - Parameters
toolButtonStyle –
ToolButtonStyle
-
PySide6.QtWidgets.QToolBar.
topLevelChanged
(topLevel)¶ - Parameters
topLevel – bool
-
PySide6.QtWidgets.QToolBar.
visibilityChanged
(visible)¶ - Parameters
visible – bool
-
PySide6.QtWidgets.QToolBar.
widgetForAction
(action)¶ - Parameters
action –
PySide6.QtGui.QAction
- Return type
Returns the widget associated with the specified action
.
See also
© 2021 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.