QToolBox#
The QToolBox class provides a column of tabbed widget items. More…
Synopsis#
Properties#
- count- Number of items contained in the toolbox
- currentIndex- The index of the current item
Functions#
- def - addItem(widget, text)
- def - addItem(widget, icon, text)
- def - count()
- def - currentIndex()
- def - currentWidget()
- def - indexOf(widget)
- def - insertItem(index, widget, icon, text)
- def - insertItem(index, widget, text)
- def - isItemEnabled(index)
- def - itemIcon(index)
- def - itemText(index)
- def - itemToolTip(index)
- def - removeItem(index)
- def - setItemEnabled(index, enabled)
- def - setItemIcon(index, icon)
- def - setItemText(index, text)
- def - setItemToolTip(index, toolTip)
- def - widget(index)
Virtual functions#
- def - itemInserted(index)
- def - itemRemoved(index)
Slots#
- def - setCurrentIndex(index)
- def - setCurrentWidget(widget)
Signals#
- def - currentChanged(index)
Note
This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE
Detailed Description#
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() , and a widget() . The item’s attributes can be changed with setItemText() , setItemIcon() , and 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().
The currentChanged() signal is emitted when the current item is changed.
See also
- class PySide6.QtWidgets.QToolBox([parent=None[, f=Qt.WindowFlags()]])#
- Parameters:
- f – - WindowFlags
- parent – - PySide6.QtWidgets.QWidget
 
 
Constructs a new toolbox with the given parent and the flags, f.
Note
Properties can be used directly when from __feature__ import true_property is used or via accessor functions otherwise.
- property PᅟySide6.QtWidgets.QToolBox.count: int#
This property holds The number of items contained in the toolbox..
By default, this property has a value of 0.
- Access functions:
- count()
 
- property PᅟySide6.QtWidgets.QToolBox.currentIndex: int#
This property holds the index of the current item.
By default, for an empty toolbox, this property has a value of -1.
- Access functions:
- currentIndex()
- setCurrentIndex(index)
- Signal - currentChanged(index)
 
- PySide6.QtWidgets.QToolBox.addItem(widget, text)#
- Parameters:
- widget – - PySide6.QtWidgets.QWidget
- text – str 
 
- Return type:
- 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.
- PySide6.QtWidgets.QToolBox.addItem(widget, icon, text)
- Parameters:
- widget – - PySide6.QtWidgets.QWidget
- icon – - PySide6.QtGui.QIcon
- text – str 
 
- Return type:
- 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.
- PySide6.QtWidgets.QToolBox.count()#
- Return type:
- int 
 
Getter of property count .
- PySide6.QtWidgets.QToolBox.currentChanged(index)#
- Parameters:
- index – int 
 
This signal is emitted when the current item is changed. The new current item’s index is passed in index, or -1 if there is no current item.
Notification signal of property currentIndex .
- PySide6.QtWidgets.QToolBox.currentIndex()#
- Return type:
- int 
 - See also 
Getter of property currentIndex .
- PySide6.QtWidgets.QToolBox.currentWidget()#
- Return type:
 
Returns a pointer to the current widget, or None if there is no such item.
See also
- PySide6.QtWidgets.QToolBox.indexOf(widget)#
- Parameters:
- widget – - PySide6.QtWidgets.QWidget
- Return type:
- int 
 
Returns the index of widget, or -1 if the item does not exist.
- PySide6.QtWidgets.QToolBox.insertItem(index, widget, icon, text)#
- Parameters:
- index – int 
- widget – - PySide6.QtWidgets.QWidget
- icon – - PySide6.QtGui.QIcon
- text – str 
 
- Return type:
- 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.
- PySide6.QtWidgets.QToolBox.insertItem(index, widget, text)
- Parameters:
- index – int 
- widget – - PySide6.QtWidgets.QWidget
- text – str 
 
- Return type:
- 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.
- PySide6.QtWidgets.QToolBox.isItemEnabled(index)#
- Parameters:
- index – int 
- Return type:
- bool 
 
Returns true if the item at position index is enabled; otherwise returns false.
- PySide6.QtWidgets.QToolBox.itemIcon(index)#
- Parameters:
- index – int 
- Return type:
 
Returns the icon of the item at position index, or a null icon if index is out of range.
See also
- PySide6.QtWidgets.QToolBox.itemInserted(index)#
- Parameters:
- index – int 
 
This virtual handler is called after a new item was added or inserted at position index.
See also
- PySide6.QtWidgets.QToolBox.itemRemoved(index)#
- Parameters:
- index – int 
 
This virtual handler is called after an item was removed from position index.
See also
- PySide6.QtWidgets.QToolBox.itemText(index)#
- Parameters:
- index – int 
- Return type:
- str 
 
Returns the text of the item at position index, or an empty string if index is out of range.
See also
- PySide6.QtWidgets.QToolBox.itemToolTip(index)#
- Parameters:
- index – int 
- Return type:
- str 
 
Returns the tooltip of the item at position index, or an empty string if index is out of range.
See also
- PySide6.QtWidgets.QToolBox.removeItem(index)#
- Parameters:
- index – int 
 
Removes the item at position index from the toolbox. Note that the widget is not deleted.
- PySide6.QtWidgets.QToolBox.setCurrentIndex(index)#
- Parameters:
- index – int 
 - See also 
Setter of property currentIndex .
- PySide6.QtWidgets.QToolBox.setCurrentWidget(widget)#
- Parameters:
- widget – - PySide6.QtWidgets.QWidget
 
Makes``widget`` the current widget. The widget must be an item in this tool box.
See also
- PySide6.QtWidgets.QToolBox.setItemEnabled(index, enabled)#
- Parameters:
- index – int 
- enabled – bool 
 
 
If enabled is true then the item at position index is enabled; otherwise the item at position index is disabled.
See also
- PySide6.QtWidgets.QToolBox.setItemIcon(index, icon)#
- Parameters:
- index – int 
- icon – - PySide6.QtGui.QIcon
 
 
Sets the icon of the item at position index to icon.
See also
- PySide6.QtWidgets.QToolBox.setItemText(index, text)#
- Parameters:
- index – int 
- text – str 
 
 
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 ‘&&’).
See also
- PySide6.QtWidgets.QToolBox.setItemToolTip(index, toolTip)#
- Parameters:
- index – int 
- toolTip – str 
 
 
Sets the tooltip of the item at position index to toolTip.
See also
- PySide6.QtWidgets.QToolBox.widget(index)#
- Parameters:
- index – int 
- Return type:
 
Returns the widget at position index, or None if there is no such item.