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)
def
setIconSize
(iconSize)
def
setToolButtonStyle
(toolButtonStyle)
def
actionTriggered
(action)
def
allowedAreasChanged
(allowedAreas)
def
iconSizeChanged
(iconSize)
def
movableChanged
(movable)
def
orientationChanged
(orientation)
def
toolButtonStyleChanged
(toolButtonStyle)
def
topLevelChanged
(topLevel)
def
visibilityChanged
(visible)
工具栏按钮被添加通过添加 actions ,使用
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,和QComboBox. When a toolbar button is pressed, it emits theactionTriggered()信号。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.
当
QToolBaris 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 inheritingQWidgetActionand implementingcreateWidget()代替。另请参阅
QToolBar
(
[
parent=None
]
)
¶
QToolBar(title[, parent=None])
- param parent
- param title
unicode
构造
QToolBar
采用给定
parent
.
构造
QToolBar
采用给定
parent
.
The given window
title
identifies the toolbar and is shown in the context menu provided by
QMainWindow
.
另请参阅
PySide2.QtWidgets.QToolBar.
actionAt
(
p
)
¶
p
–
QPoint
Returns the action at point
p
. This function returns zero if no action was found.
另请参阅
PySide2.QtWidgets.QToolBar.
actionAt
(
x
,
y
)
¶
x
–
int
y
–
int
这是重载函数。
Returns the action at the point
x
,
y
. This function returns zero if no action was found.
PySide2.QtWidgets.QToolBar.
actionGeometry
(
action
)
¶
action
–
QAction
QRect
Returns the geometry of the toolbar item associated with the given
action
, or an invalid
QRect
if no matching item is found.
PySide2.QtWidgets.QToolBar.
addAction
(
icon
,
text
,
receiver
)
¶
icon
–
QIcon
text – unicode
receiver
–
QObject
PySide2.QtWidgets.QToolBar.
addAction
(
text
)
¶
text – unicode
创建新的动作采用给定
text
. This action is added to the end of the toolbar.
PySide2.QtWidgets.QToolBar.
addAction
(
text
,
receiver
)
¶
text – unicode
receiver
–
QObject
PySide2.QtWidgets.QToolBar.
addSeparator
(
)
¶
Adds a separator to the end of the toolbar.
另请参阅
PySide2.QtWidgets.QToolBar.
addWidget
(
widget
)
¶
添加给定
widget
to the toolbar as the toolbar’s last item.
The toolbar takes ownership of
widget
.
若添加
QToolButton
with this method, the toolbar’s
ToolButtonStyle
will not be respected.
注意
应使用
setVisible()
to change the visibility of the widget. Using
setVisible()
,
show()
and
hide()
does not work.
另请参阅
PySide2.QtWidgets.QToolBar.
allowedAreas
(
)
¶
ToolBarAreas
另请参阅
PySide2.QtWidgets.QToolBar.
allowedAreasChanged
(
allowedAreas
)
¶
allowedAreas
–
ToolBarAreas
PySide2.QtWidgets.QToolBar.
clear
(
)
¶
Removes all actions from the toolbar.
另请参阅
PySide2.QtWidgets.QToolBar.
iconSize
(
)
¶
QSize
另请参阅
PySide2.QtWidgets.QToolBar.
iconSizeChanged
(
iconSize
)
¶
iconSize
–
QSize
PySide2.QtWidgets.QToolBar.
initStyleOption
(
option
)
¶
option
–
QStyleOptionToolBar
PySide2.QtWidgets.QToolBar.
insertSeparator
(
before
)
¶
Inserts a separator into the toolbar in front of the toolbar item associated with the
before
action.
另请参阅
PySide2.QtWidgets.QToolBar.
insertWidget
(
before
,
widget
)
¶
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.
另请参阅
PySide2.QtWidgets.QToolBar.
isAreaAllowed
(
area
)
¶
area
–
ToolBarArea
bool
返回
true
if this toolbar is dockable in the given
area
;否则返回
false
.
PySide2.QtWidgets.QToolBar.
isFloatable
(
)
¶
bool
PySide2.QtWidgets.QToolBar.
isFloating
(
)
¶
bool
PySide2.QtWidgets.QToolBar.
isMovable
(
)
¶
bool
PySide2.QtWidgets.QToolBar.
movableChanged
(
movable
)
¶
movable
–
bool
PySide2.QtWidgets.QToolBar.
orientation
(
)
¶
取向
另请参阅
PySide2.QtWidgets.QToolBar.
orientationChanged
(
orientation
)
¶
orientation
–
取向
PySide2.QtWidgets.QToolBar.
setAllowedAreas
(
areas
)
¶
areas
–
ToolBarAreas
另请参阅
PySide2.QtWidgets.QToolBar.
setFloatable
(
floatable
)
¶
floatable
–
bool
另请参阅
PySide2.QtWidgets.QToolBar.
setIconSize
(
iconSize
)
¶
iconSize
–
QSize
另请参阅
PySide2.QtWidgets.QToolBar.
setMovable
(
movable
)
¶
movable
–
bool
另请参阅
PySide2.QtWidgets.QToolBar.
setOrientation
(
orientation
)
¶
orientation
–
取向
另请参阅
PySide2.QtWidgets.QToolBar.
setToolButtonStyle
(
toolButtonStyle
)
¶
toolButtonStyle
–
ToolButtonStyle
另请参阅
PySide2.QtWidgets.QToolBar.
toggleViewAction
(
)
¶
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.
另请参阅
text
windowTitle
PySide2.QtWidgets.QToolBar.
toolButtonStyle
(
)
¶
ToolButtonStyle
另请参阅
PySide2.QtWidgets.QToolBar.
toolButtonStyleChanged
(
toolButtonStyle
)
¶
toolButtonStyle
–
ToolButtonStyle
PySide2.QtWidgets.QToolBar.
topLevelChanged
(
topLevel
)
¶
topLevel
–
bool
PySide2.QtWidgets.QToolBar.
visibilityChanged
(
visible
)
¶
visible
–
bool
PySide2.QtWidgets.QToolBar.
widgetForAction
(
action
)
¶
Returns the widget associated with the specified
action
.
另请参阅