Table Of Contents

Previous topic

QToolBox

Next topic

QStatusBar

QToolBar

Inheritance diagram of QToolBar

Synopsis

Functions

Slots

Signals

Detailed Description

The PySide.QtGui.QToolBar class provides a movable panel that contains a set of controls.

Toolbar buttons are added by adding actions , using 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 , and PySide.QtGui.QComboBox . When a toolbar button is pressed it emits the PySide.QtGui.QToolBar.actionTriggered() 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 ( 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.

When a PySide.QtGui.QToolBar is not a child of a PySide.QtGui.QMainWindow , it looses 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() instead.

class PySide.QtGui.QToolBar([parent=None])
class PySide.QtGui.QToolBar(title[, parent=None])
Parameters:

Constructs a PySide.QtGui.QToolBar with the given parent .

Constructs a PySide.QtGui.QToolBar with the given parent .

The given window title identifies the toolbar and is shown in the context menu provided by PySide.QtGui.QMainWindow .

PySide.QtGui.QToolBar.actionAt(p)
Parameters:pPySide.QtCore.QPoint
Return type:PySide.QtGui.QAction

Returns the action at point p . This function returns zero if no action was found.

PySide.QtGui.QToolBar.actionAt(x, y)
Parameters:
  • xPySide.QtCore.int
  • yPySide.QtCore.int
Return type:

PySide.QtGui.QAction

This is an overloaded function.

Returns the action at the point x , y . This function returns zero if no action was found.

PySide.QtGui.QToolBar.actionGeometry(action)
Parameters:actionPySide.QtGui.QAction
Return type: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.

PySide.QtGui.QToolBar.actionTriggered(action)
Parameters:actionPySide.QtGui.QAction
PySide.QtGui.QToolBar.addAction(text, receiver)
Parameters:
Return type:

PySide.QtGui.QAction

This is an overloaded function.

Creates a new action with the given 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 .

PySide.QtGui.QToolBar.addAction(text)
Parameters:text – unicode
Return type:PySide.QtGui.QAction

This is an overloaded function.

Creates a new action with the given text . This action is added to the end of the toolbar.

PySide.QtGui.QToolBar.addAction(icon, text, receiver)
Parameters:
Return type:

PySide.QtGui.QAction

This is an overloaded function.

Creates a new action with the icon icon and text 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 .

PySide.QtGui.QToolBar.addAction(icon, text)
Parameters:
Return type:

PySide.QtGui.QAction

This is an overloaded function.

Creates a new action with the given icon and text . This action is added to the end of the toolbar.

PySide.QtGui.QToolBar.addSeparator()
Return type:PySide.QtGui.QAction

Adds a separator to the end of the toolbar.

PySide.QtGui.QToolBar.addWidget(widget)
Parameters:widgetPySide.QtGui.QWidget
Return type:PySide.QtGui.QAction

Adds the given widget to the toolbar as the toolbar’s last item.

The toolbar takes ownership of widget .

If you add a PySide.QtGui.QToolButton with this method, the tools bar’s Qt.ToolButtonStyle will not be respected.

Note

You should use QAction.setVisible() to change the visibility of the widget. Using QWidget.setVisible() , QWidget.show() and QWidget.hide() does not work.

PySide.QtGui.QToolBar.allowedAreas()
Return type:PySide.QtCore.Qt.ToolBarAreas
PySide.QtGui.QToolBar.allowedAreasChanged(allowedAreas)
Parameters:allowedAreasPySide.QtCore.Qt.ToolBarAreas
PySide.QtGui.QToolBar.clear()

Removes all actions from the toolbar.

PySide.QtGui.QToolBar.iconSize()
Return type:PySide.QtCore.QSize
PySide.QtGui.QToolBar.iconSizeChanged(iconSize)
Parameters:iconSizePySide.QtCore.QSize
PySide.QtGui.QToolBar.initStyleOption(option)
Parameters:optionPySide.QtGui.QStyleOptionToolBar
PySide.QtGui.QToolBar.insertSeparator(before)
Parameters:beforePySide.QtGui.QAction
Return type:PySide.QtGui.QAction

Inserts a separator into the toolbar in front of the toolbar item associated with the before action.

PySide.QtGui.QToolBar.insertWidget(before, widget)
Parameters:
Return type:

PySide.QtGui.QAction

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.

PySide.QtGui.QToolBar.isAreaAllowed(area)
Parameters:areaPySide.QtCore.Qt.ToolBarArea
Return type:PySide.QtCore.bool
PySide.QtGui.QToolBar.isFloatable()
Return type:PySide.QtCore.bool
PySide.QtGui.QToolBar.isFloating()
Return type:PySide.QtCore.bool
PySide.QtGui.QToolBar.isMovable()
Return type:PySide.QtCore.bool

This property holds whether the user can move the toolbar within the toolbar area, or between toolbar areas.

By default, this property is true.

This property only makes sense if the toolbar is in a PySide.QtGui.QMainWindow .

PySide.QtGui.QToolBar.movableChanged(movable)
Parameters:movablePySide.QtCore.bool
PySide.QtGui.QToolBar.orientation()
Return type:PySide.QtCore.Qt.Orientation
PySide.QtGui.QToolBar.orientationChanged(orientation)
Parameters:orientationPySide.QtCore.Qt.Orientation
PySide.QtGui.QToolBar.setAllowedAreas(areas)
Parameters:areasPySide.QtCore.Qt.ToolBarAreas
PySide.QtGui.QToolBar.setFloatable(floatable)
Parameters:floatablePySide.QtCore.bool
PySide.QtGui.QToolBar.setIconSize(iconSize)
Parameters:iconSizePySide.QtCore.QSize
PySide.QtGui.QToolBar.setMovable(movable)
Parameters:movablePySide.QtCore.bool
PySide.QtGui.QToolBar.setOrientation(orientation)
Parameters:orientationPySide.QtCore.Qt.Orientation
PySide.QtGui.QToolBar.setToolButtonStyle(toolButtonStyle)
Parameters:toolButtonStylePySide.QtCore.Qt.ToolButtonStyle
PySide.QtGui.QToolBar.toggleViewAction()
Return type: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.QtGui.QToolBar.toolButtonStyle()
Return type:PySide.QtCore.Qt.ToolButtonStyle
PySide.QtGui.QToolBar.toolButtonStyleChanged(toolButtonStyle)
Parameters:toolButtonStylePySide.QtCore.Qt.ToolButtonStyle
PySide.QtGui.QToolBar.topLevelChanged(topLevel)
Parameters:topLevelPySide.QtCore.bool
PySide.QtGui.QToolBar.visibilityChanged(visible)
Parameters:visiblePySide.QtCore.bool
PySide.QtGui.QToolBar.widgetForAction(action)
Parameters:actionPySide.QtGui.QAction
Return type:PySide.QtGui.QWidget

Returns the widget associated with the specified action .