PySide6.QtWidgets.QToolBox¶
- class QToolBox¶
The
QToolBox
class provides a column of tabbed widget items. More…Synopsis¶
Properties¶
countᅟ
- Number of items contained in the toolboxcurrentIndexᅟ
- The index of the current item
Methods¶
def
__init__()
def
addItem()
def
count()
def
currentIndex()
def
currentWidget()
def
indexOf()
def
insertItem()
def
isItemEnabled()
def
itemIcon()
def
itemText()
def
itemToolTip()
def
removeItem()
def
setItemEnabled()
def
setItemIcon()
def
setItemText()
def
setItemToolTip()
def
widget()
Virtual methods¶
def
itemInserted()
def
itemRemoved()
Slots¶
Signals¶
def
currentChanged()
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 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
Note
Properties can be used directly when
from __feature__ import true_property
is used or via accessor functions otherwise.- property countᅟ: int¶
This property holds The number of items contained in the toolbox..
By default, this property has a value of 0.
- Access functions:
- property 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:
- __init__([parent=None[, f=Qt.WindowFlags()]])¶
- Parameters:
parent –
QWidget
f – Combination of
WindowType
Constructs a new toolbox with the given
parent
and the flags,f
.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 totext
. Returns the new tab’s index.Adds the
widget
in a new tab at bottom of the toolbox. The new tab’s text is set totext
, and theiconSet
is displayed to the left of thetext
. Returns the new tab’s index.- count()¶
- Return type:
int
Getter of property
countᅟ
.- 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ᅟ
.- currentIndex()¶
- Return type:
int
See also
Getter of property
currentIndexᅟ
.Returns a pointer to the current widget, or
None
if there is no such item.See also
Returns the index of
widget
, or -1 if the item does not exist.- insertItem(index, widget, text)¶
- Parameters:
index – int
widget –
QWidget
text – str
- Return type:
int
This is an overloaded function.
Inserts the
widget
at positionindex
, or at the bottom of the toolbox ifindex
is out of range. The new item’s text is set totext
. Returns the new item’s index.- insertItem(index, widget, icon, text)
Inserts the
widget
at positionindex
, or at the bottom of the toolbox ifindex
is out of range. The new item’s text is set totext
, and theicon
is displayed to the left of thetext
. Returns the new item’s index.- isItemEnabled(index)¶
- Parameters:
index – int
- Return type:
bool
Returns
true
if the item at positionindex
is enabled; otherwise returnsfalse
.Returns the icon of the item at position
index
, or a null icon ifindex
is out of range.See also
- itemInserted(index)¶
- Parameters:
index – int
This virtual handler is called after a new item was added or inserted at position
index
.See also
- itemRemoved(index)¶
- Parameters:
index – int
This virtual handler is called after an item was removed from position
index
.See also
- itemText(index)¶
- Parameters:
index – int
- Return type:
str
Returns the text of the item at position
index
, or an empty string ifindex
is out of range.See also
- itemToolTip(index)¶
- Parameters:
index – int
- Return type:
str
Returns the tooltip of the item at position
index
, or an empty string ifindex
is out of range.See also
- removeItem(index)¶
- Parameters:
index – int
Removes the item at position
index
from the toolbox. Note that the widget is not deleted.- setCurrentIndex(index)¶
- Parameters:
index – int
See also
Setter of property
currentIndexᅟ
.Makes``widget`` the current widget. The
widget
must be an item in this tool box.See also
- setItemEnabled(index, enabled)¶
- Parameters:
index – int
enabled – bool
If
enabled
is true then the item at positionindex
is enabled; otherwise the item at positionindex
is disabled.See also
Sets the icon of the item at position
index
toicon
.See also
- setItemText(index, text)¶
- Parameters:
index – int
text – str
Sets the text of the item at position
index
totext
.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
- setItemToolTip(index, toolTip)¶
- Parameters:
index – int
toolTip – str
Sets the tooltip of the item at position
index
totoolTip
.See also
Returns the widget at position
index
, orNone
if there is no such item.