QToolBar¶
Synopsis¶
Functions¶
def
actionAt
(p)def
actionAt
(x, y)def
actionGeometry
(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
clear
()def
iconSize
()def
initStyleOption
(option)def
insertSeparator
(before)def
insertWidget
(before, widget)def
isAreaAllowed
(area)def
isFloatable
()def
isFloating
()def
isMovable
()def
orientation
()def
setAllowedAreas
(areas)def
setFloatable
(floatable)def
setMovable
(movable)def
setOrientation
(orientation)def
toggleViewAction
()def
toolButtonStyle
()def
widgetForAction
(action)
Slots¶
def
setIconSize
(iconSize)def
setToolButtonStyle
(toolButtonStyle)
Signals¶
def
actionTriggered
(action)def
allowedAreasChanged
(allowedAreas)def
iconSizeChanged
(iconSize)def
movableChanged
(movable)def
orientationChanged
(orientation)def
toolButtonStyleChanged
(toolButtonStyle)def
topLevelChanged
(topLevel)def
visibilityChanged
(visible)
Detailed Description¶
Toolbar buttons are added by adding actions , using
addAction()
orinsertAction()
. Groups of buttons can be separated usingaddSeparator()
orinsertSeparator()
. If a toolbar button is not appropriate, a widget can be inserted instead usingaddWidget()
orinsertWidget()
. Examples of suitable widgets areQSpinBox
,QDoubleSpinBox
, andQComboBox
. When a toolbar button is pressed, it emits theactionTriggered()
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()
andisAreaAllowed()
.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 aQMainWindow
, it loses the ability to populate the extension pop up with widgets added to the toolbar usingaddWidget()
. Please use widget actions created by inheritingQWidgetAction
and implementingcreateWidget()
instead.See also
-
class
QToolBar
([parent=None])¶ QToolBar(title[, parent=None])
- param parent
- param title
unicode
Constructs a
QToolBar
with the givenparent
.Constructs a
QToolBar
with the givenparent
.The given window
title
identifies the toolbar and is shown in the context menu provided byQMainWindow
.See also
-
PySide2.QtWidgets.QToolBar.
actionAt
(p)¶ - Parameters
p –
QPoint
- Return type
Returns the action at point
p
. This function returns zero if no action was found.See also
-
PySide2.QtWidgets.QToolBar.
actionAt
(x, y) - Parameters
x –
int
y –
int
- Return type
This is an overloaded function.
Returns the action at the point
x
,y
. This function returns zero if no action was found.
-
PySide2.QtWidgets.QToolBar.
actionGeometry
(action)¶ - Parameters
action –
QAction
- Return type
QRect
Returns the geometry of the toolbar item associated with the given
action
, or an invalidQRect
if no matching item is found.
-
PySide2.QtWidgets.QToolBar.
addAction
(icon, text)¶ - Parameters
icon –
QIcon
text – unicode
- Return type
-
PySide2.QtWidgets.QToolBar.
addAction
(icon, text, receiver) - Parameters
icon –
QIcon
text – unicode
receiver –
QObject
- Return type
-
PySide2.QtWidgets.QToolBar.
addAction
(text) - Parameters
text – unicode
- Return type
Creates a new action with the given
text
. This action is added to the end of the toolbar.
-
PySide2.QtWidgets.QToolBar.
addAction
(text, receiver) - Parameters
text – unicode
receiver –
QObject
- Return type
-
PySide2.QtWidgets.QToolBar.
addSeparator
()¶ - Return type
Adds a separator to the end of the toolbar.
See also
-
PySide2.QtWidgets.QToolBar.
addWidget
(widget)¶ -
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’sToolButtonStyle
will not be respected.Note
You should use
setVisible()
to change the visibility of the widget. UsingsetVisible()
,show()
andhide()
does not work.See also
-
PySide2.QtWidgets.QToolBar.
allowedAreas
()¶ - Return type
ToolBarAreas
See also
-
PySide2.QtWidgets.QToolBar.
allowedAreasChanged
(allowedAreas)¶ - Parameters
allowedAreas –
ToolBarAreas
-
PySide2.QtWidgets.QToolBar.
clear
()¶ Removes all actions from the toolbar.
See also
-
PySide2.QtWidgets.QToolBar.
iconSize
()¶ - Return type
QSize
See also
-
PySide2.QtWidgets.QToolBar.
iconSizeChanged
(iconSize)¶ - Parameters
iconSize –
QSize
-
PySide2.QtWidgets.QToolBar.
initStyleOption
(option)¶ - Parameters
option –
QStyleOptionToolBar
-
PySide2.QtWidgets.QToolBar.
insertSeparator
(before)¶ -
Inserts a separator into the toolbar in front of the toolbar item associated with the
before
action.See also
-
PySide2.QtWidgets.QToolBar.
insertWidget
(before, widget)¶ -
Inserts the given
widget
in front of the toolbar item associated with thebefore
action.Note: You should use
setVisible()
to change the visibility of the widget. UsingsetVisible()
,show()
andhide()
does not work.See also
-
PySide2.QtWidgets.QToolBar.
isAreaAllowed
(area)¶ - Parameters
area –
ToolBarArea
- Return type
bool
Returns
true
if this toolbar is dockable in the givenarea
; otherwise returnsfalse
.
-
PySide2.QtWidgets.QToolBar.
isFloatable
()¶ - Return type
bool
-
PySide2.QtWidgets.QToolBar.
isFloating
()¶ - Return type
bool
-
PySide2.QtWidgets.QToolBar.
isMovable
()¶ - Return type
bool
-
PySide2.QtWidgets.QToolBar.
movableChanged
(movable)¶ - Parameters
movable –
bool
-
PySide2.QtWidgets.QToolBar.
orientation
()¶ - Return type
Orientation
See also
-
PySide2.QtWidgets.QToolBar.
orientationChanged
(orientation)¶ - Parameters
orientation –
Orientation
-
PySide2.QtWidgets.QToolBar.
setAllowedAreas
(areas)¶ - Parameters
areas –
ToolBarAreas
See also
-
PySide2.QtWidgets.QToolBar.
setFloatable
(floatable)¶ - Parameters
floatable –
bool
See also
-
PySide2.QtWidgets.QToolBar.
setIconSize
(iconSize)¶ - Parameters
iconSize –
QSize
See also
-
PySide2.QtWidgets.QToolBar.
setMovable
(movable)¶ - Parameters
movable –
bool
See also
-
PySide2.QtWidgets.QToolBar.
setOrientation
(orientation)¶ - Parameters
orientation –
Orientation
See also
-
PySide2.QtWidgets.QToolBar.
setToolButtonStyle
(toolButtonStyle)¶ - Parameters
toolButtonStyle –
ToolButtonStyle
See also
-
PySide2.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
-
PySide2.QtWidgets.QToolBar.
toolButtonStyle
()¶ - Return type
ToolButtonStyle
See also
-
PySide2.QtWidgets.QToolBar.
toolButtonStyleChanged
(toolButtonStyle)¶ - Parameters
toolButtonStyle –
ToolButtonStyle
-
PySide2.QtWidgets.QToolBar.
topLevelChanged
(topLevel)¶ - Parameters
topLevel –
bool
-
PySide2.QtWidgets.QToolBar.
visibilityChanged
(visible)¶ - Parameters
visible –
bool
-
PySide2.QtWidgets.QToolBar.
widgetForAction
(action)¶ -
Returns the widget associated with the specified
action
.See also
© 2018 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.