QToolBox

Inheritance diagram of PySide2.QtWidgets.QToolBox

Synopsis

Functions

Virtual functions

Slots

Signals

Detailed Description

The PySide2.QtWidgets.QToolBox class provides a column of tabbed widget items.

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 PySide2.QtWidgets.QWidget .

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

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

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

The PySide2.QtWidgets.QToolBox.currentChanged() signal is emitted when the current item is changed.

class PySide2.QtWidgets.QToolBox([parent=nullptr[, f=Qt.WindowFlags()]])
Parameters:

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

PySide2.QtWidgets.QToolBox.addItem(widget, text)
Parameters:
Return type:

PySide2.QtCore.int

This is an overloaded function.

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)
Parameters:
Return type:

PySide2.QtCore.int

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

PySide2.QtWidgets.QToolBox.count()
Return type:PySide2.QtCore.int
PySide2.QtWidgets.QToolBox.currentChanged(index)
Parameters:indexPySide2.QtCore.int
PySide2.QtWidgets.QToolBox.currentIndex()
Return type:PySide2.QtCore.int
PySide2.QtWidgets.QToolBox.currentWidget()
Return type:PySide2.QtWidgets.QWidget

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

PySide2.QtWidgets.QToolBox.indexOf(widget)
Parameters:widgetPySide2.QtWidgets.QWidget
Return type:PySide2.QtCore.int

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

PySide2.QtWidgets.QToolBox.insertItem(index, widget, icon, text)
Parameters:
Return type:

PySide2.QtCore.int

Inserts the widget at position index , or at the bottom of the toolbox if index is out of range. The new item’s text is set to text , and the icon is displayed to the left of the text . Returns the new item’s index.

PySide2.QtWidgets.QToolBox.insertItem(index, widget, text)
Parameters:
Return type:

PySide2.QtCore.int

This is an overloaded function.

Inserts the widget at position 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)
Parameters:indexPySide2.QtCore.int
Return type:PySide2.QtCore.bool

Returns true if the item at position index is enabled; otherwise returns false .

PySide2.QtWidgets.QToolBox.itemIcon(index)
Parameters:indexPySide2.QtCore.int
Return type:PySide2.QtGui.QIcon

Returns the icon of the item at position index , or a null icon if index is out of range.

PySide2.QtWidgets.QToolBox.itemInserted(index)
Parameters:indexPySide2.QtCore.int

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

PySide2.QtWidgets.QToolBox.itemRemoved(index)
Parameters:indexPySide2.QtCore.int

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

PySide2.QtWidgets.QToolBox.itemText(index)
Parameters:indexPySide2.QtCore.int
Return type:unicode

Returns the text of the item at position index , or an empty string if index is out of range.

PySide2.QtWidgets.QToolBox.itemToolTip(index)
Parameters:indexPySide2.QtCore.int
Return type:unicode

Returns the tooltip of the item at position index , or an empty string if index is out of range.

PySide2.QtWidgets.QToolBox.removeItem(index)
Parameters:indexPySide2.QtCore.int

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

PySide2.QtWidgets.QToolBox.setCurrentIndex(index)
Parameters:indexPySide2.QtCore.int
PySide2.QtWidgets.QToolBox.setCurrentWidget(widget)
Parameters:widgetPySide2.QtWidgets.QWidget

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

PySide2.QtWidgets.QToolBox.setItemEnabled(index, enabled)
Parameters:
  • indexPySide2.QtCore.int
  • enabledPySide2.QtCore.bool

If enabled is true then the item at position index is enabled; otherwise the item at position index is disabled.

PySide2.QtWidgets.QToolBox.setItemIcon(index, icon)
Parameters:

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

PySide2.QtWidgets.QToolBox.setItemText(index, text)
Parameters:
  • indexPySide2.QtCore.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 ‘&&’).

PySide2.QtWidgets.QToolBox.setItemToolTip(index, toolTip)
Parameters:
  • indexPySide2.QtCore.int
  • toolTip – unicode

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

PySide2.QtWidgets.QToolBox.widget(index)
Parameters:indexPySide2.QtCore.int
Return type:PySide2.QtWidgets.QWidget

Returns the widget at position index , or 0 if there is no such item.