QToolBox¶

Synopsis¶
Functions¶
def
addItem(widget, icon, text)def
addItem(widget, 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)
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 optionalitemIcon(), an optionalitemToolTip(), and awidget(). The item’s attributes can be changed withsetItemText(),setItemIcon(), andsetItemToolTip(). Each item can be enabled or disabled individually withsetItemEnabled().Items are added using
addItem(), or inserted at particular positions usinginsertItem(). The total number of items is given bycount(). Items can be deleted with delete, or removed from the toolbox withremoveItem(). CombiningremoveItem()andinsertItem()allows you to move items to different positions.The index of the current item widget is returned by
currentIndex(), and set withsetCurrentIndex(). The index of a particular item can be found usingindexOf(), 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 PySide2.QtWidgets.QToolBox([parent=None[, f=Qt.WindowFlags()]])¶
- param f:
WindowFlags- param parent:
Constructs a new toolbox with the given
parentand the flags,f.
- PySide2.QtWidgets.QToolBox.addItem(widget, text)¶
- Parameters:
widget –
PySide2.QtWidgets.QWidgettext – str
- Return type:
int
This is an overloaded function.
Adds the widget
win a new tab at bottom of the toolbox. The new tab’s text is set totext. Returns the new tab’s index.
- PySide2.QtWidgets.QToolBox.addItem(widget, icon, text)
- Parameters:
widget –
PySide2.QtWidgets.QWidgeticon –
PySide2.QtGui.QIcontext – str
- Return type:
int
Adds the
widgetin a new tab at bottom of the toolbox. The new tab’s text is set totext, and theiconSetis displayed to the left of thetext. Returns the new tab’s index.
- PySide2.QtWidgets.QToolBox.count()¶
- Return type:
int
This property holds The number of items contained in the toolbox..
By default, this property has a value of 0.
- PySide2.QtWidgets.QToolBox.currentChanged(index)¶
- Parameters:
index – int
- PySide2.QtWidgets.QToolBox.currentIndex()¶
- Return type:
int
This property holds the index of the current item.
By default, for an empty toolbox, this property has a value of -1.
- PySide2.QtWidgets.QToolBox.currentWidget()¶
- Return type:
Returns a pointer to the current widget, or
Noneif there is no such item.See also
- PySide2.QtWidgets.QToolBox.indexOf(widget)¶
- Parameters:
widget –
PySide2.QtWidgets.QWidget- Return type:
int
Returns the index of
widget, or -1 if the item does not exist.
- PySide2.QtWidgets.QToolBox.insertItem(index, widget, icon, text)¶
- Parameters:
index – int
widget –
PySide2.QtWidgets.QWidgeticon –
PySide2.QtGui.QIcontext – str
- Return type:
int
Inserts the
widgetat positionindex, or at the bottom of the toolbox ifindexis out of range. The new item’s text is set totext, and theiconis displayed to the left of thetext. Returns the new item’s index.
- PySide2.QtWidgets.QToolBox.insertItem(index, widget, text)
- Parameters:
index – int
widget –
PySide2.QtWidgets.QWidgettext – str
- Return type:
int
This is an overloaded function.
Inserts the
widgetat positionindex, or at the bottom of the toolbox ifindexis out of range. The new item’s text is set totext. Returns the new item’s index.
- PySide2.QtWidgets.QToolBox.isItemEnabled(index)¶
- Parameters:
index – int
- Return type:
bool
Returns
trueif the item at positionindexis enabled; otherwise returnsfalse.
- PySide2.QtWidgets.QToolBox.itemIcon(index)¶
- Parameters:
index – int
- Return type:
Returns the icon of the item at position
index, or a null icon ifindexis out of range.See also
- PySide2.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
- PySide2.QtWidgets.QToolBox.itemRemoved(index)¶
- Parameters:
index – int
This virtual handler is called after an item was removed from position
index.See also
- PySide2.QtWidgets.QToolBox.itemText(index)¶
- Parameters:
index – int
- Return type:
str
Returns the text of the item at position
index, or an empty string ifindexis out of range.See also
- PySide2.QtWidgets.QToolBox.itemToolTip(index)¶
- Parameters:
index – int
- Return type:
str
Returns the tooltip of the item at position
index, or an empty string ifindexis out of range.See also
- PySide2.QtWidgets.QToolBox.removeItem(index)¶
- Parameters:
index – int
Removes the item at position
indexfrom the toolbox. Note that the widget is not deleted.
- PySide2.QtWidgets.QToolBox.setCurrentIndex(index)¶
- Parameters:
index – int
This property holds the index of the current item.
By default, for an empty toolbox, this property has a value of -1.
- PySide2.QtWidgets.QToolBox.setCurrentWidget(widget)¶
- Parameters:
widget –
PySide2.QtWidgets.QWidget
Makes``widget`` the current widget. The
widgetmust be an item in this tool box.See also
- PySide2.QtWidgets.QToolBox.setItemEnabled(index, enabled)¶
- Parameters:
index – int
enabled – bool
If
enabledis true then the item at positionindexis enabled; otherwise the item at positionindexis disabled.See also
- PySide2.QtWidgets.QToolBox.setItemIcon(index, icon)¶
- Parameters:
index – int
icon –
PySide2.QtGui.QIcon
Sets the icon of the item at position
indextoicon.See also
- PySide2.QtWidgets.QToolBox.setItemText(index, text)¶
- Parameters:
index – int
text – str
Sets the text of the item at position
indextotext.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
QShortcutdocumentation for details (to display an actual ampersand, use ‘&&’).See also
- PySide2.QtWidgets.QToolBox.setItemToolTip(index, toolTip)¶
- Parameters:
index – int
toolTip – str
Sets the tooltip of the item at position
indextotoolTip.See also
- PySide2.QtWidgets.QToolBox.widget(index)¶
- Parameters:
index – int
- Return type:
Returns the widget at position
index, orNoneif there is no such item.
© 2022 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.