内容表

上一话题

QToolBar

下一话题

QToolButton

QToolBox

QToolBox class provides a column of tabbed widget items. 更多

Inheritance diagram of PySide2.QtWidgets.QToolBox

概要

函数

虚函数

信号

详细描述

A toolbox is a widget that displays a column of tabs one above the other, with the current item displayed below the current tab. Every tab has an index position within the column of tabs. A tab’s item is a QWidget .

Each item has an itemText() , an optional itemIcon() , an optional itemToolTip() ,和 widget() . The item’s attributes can be changed with setItemText() , setItemIcon() ,和 setItemToolTip() . Each item can be enabled or disabled individually with setItemEnabled() .

Items are added using addItem() , or inserted at particular positions using insertItem() . The total number of items is given by count() . Items can be deleted with delete, or removed from the toolbox with removeItem() . Combining removeItem() and insertItem() allows you to move items to different positions.

The index of the current item widget is returned by currentIndex() , and set with setCurrentIndex() . The index of a particular item can be found using indexOf() , and the item at a given index is returned by item().

currentChanged() signal is emitted when the current item is changed.

另请参阅

QTabWidget

class QToolBox ( [ parent=None [ , f=Qt.WindowFlags() ] ] )
param f

WindowFlags

param parent

QWidget

Constructs a new toolbox with the given parent and the flags, f .

PySide2.QtWidgets.QToolBox. addItem ( widget , text )
参数
返回类型

int

这是重载函数。

Adds the widget w in a new tab at bottom of the toolbox. The new tab’s text is set to text . Returns the new tab’s index.

PySide2.QtWidgets.QToolBox. addItem ( widget , icon , text )
参数
  • widget QWidget

  • icon QIcon

  • text – unicode

返回类型

int

添加 widget in a new tab at bottom of the toolbox. The new tab’s text is set to text ,和 iconSet is displayed to the left of the text . Returns the new tab’s index.

PySide2.QtWidgets.QToolBox. count ( )
返回类型

int

PySide2.QtWidgets.QToolBox. currentChanged ( index )
参数

index int

PySide2.QtWidgets.QToolBox. currentIndex ( )
返回类型

int

另请参阅

setCurrentIndex()

PySide2.QtWidgets.QToolBox. currentWidget ( )
返回类型

QWidget

Returns a pointer to the current widget, or None if there is no such item.

PySide2.QtWidgets.QToolBox. indexOf ( widget )
参数

widget QWidget

返回类型

int

Returns the index of widget , or -1 if the item does not exist.

PySide2.QtWidgets.QToolBox. insertItem ( index , widget , icon , text )
参数
  • index int

  • widget QWidget

  • icon QIcon

  • text – unicode

返回类型

int

插入 widget 在位置 index , or at the bottom of the toolbox if index is out of range. The new item’s text is set to text ,和 icon is displayed to the left of the text . Returns the new item’s index.

PySide2.QtWidgets.QToolBox. insertItem ( index , widget , text )
参数
  • index int

  • widget QWidget

  • text – unicode

返回类型

int

这是重载函数。

插入 widget 在位置 index , or at the bottom of the toolbox if index is out of range. The new item’s text is set to text . Returns the new item’s index.

PySide2.QtWidgets.QToolBox. isItemEnabled ( index )
参数

index int

返回类型

bool

返回 true if the item at position index 被启用;否则返回 false .

PySide2.QtWidgets.QToolBox. itemIcon ( index )
参数

index int

返回类型

QIcon

Returns the icon of the item at position index ,或 null 图标若 index 超出范围。

另请参阅

setItemIcon()

PySide2.QtWidgets.QToolBox. itemInserted ( index )
参数

index int

This virtual handler is called after a new item was added or inserted at position index .

另请参阅

itemRemoved()

PySide2.QtWidgets.QToolBox. itemRemoved ( index )
参数

index int

This virtual handler is called after an item was removed from position index .

另请参阅

itemInserted()

PySide2.QtWidgets.QToolBox. itemText ( index )
参数

index int

返回类型

unicode

Returns the text of the item at position index ,或空字符串若 index 超出范围。

另请参阅

setItemText()

PySide2.QtWidgets.QToolBox. itemToolTip ( index )
参数

index int

返回类型

unicode

Returns the tooltip of the item at position index ,或空字符串若 index 超出范围。

另请参阅

setItemToolTip()

PySide2.QtWidgets.QToolBox. removeItem ( index )
参数

index int

Removes the item at position index from the toolbox. Note that the widget is not deleted.

PySide2.QtWidgets.QToolBox. setCurrentIndex ( index )
参数

index int

另请参阅

currentIndex()

PySide2.QtWidgets.QToolBox. setCurrentWidget ( widget )
参数

widget QWidget

Makes``widget`` the current widget. The widget must be an item in this tool box.

PySide2.QtWidgets.QToolBox. setItemEnabled ( index , enabled )
参数
  • index int

  • enabled bool

enabled is true then the item at position index 被启用;否则项在位置 index 是禁用的。

另请参阅

isItemEnabled()

PySide2.QtWidgets.QToolBox. setItemIcon ( index , icon )
参数
  • index int

  • icon QIcon

Sets the icon of the item at position index to icon .

另请参阅

itemIcon()

PySide2.QtWidgets.QToolBox. setItemText ( index , text )
参数
  • index int

  • text – unicode

Sets the text of the item at position index to text .

If the provided text contains an ampersand character (‘&’), a mnemonic is automatically created for it. The character that follows the ‘&’ will be used as the shortcut key. Any previous mnemonic will be overwritten, or cleared if no mnemonic is defined by the text. See the QShortcut documentation for details (to display an actual ampersand, use ‘&&’).

另请参阅

itemText()

PySide2.QtWidgets.QToolBox. setItemToolTip ( index , toolTip )
参数
  • index int

  • toolTip – unicode

Sets the tooltip of the item at position index to toolTip .

另请参阅

itemToolTip()

PySide2.QtWidgets.QToolBox. widget ( index )
参数

index int

返回类型

QWidget

Returns the widget at position index ,或 None if there is no such item.