Home | All Classes | Main Classes | Annotated | Grouped Classes | Functions |

# QToolBox Class Reference

The QToolBox class provides a column of tabbed widget items. More...

    #include <QToolBox>

Inherits QFrame.

- List of all members, including inherited members
- Compatibility members

### Writable Properties

- currentIndex : int

- 5 writable properties inherited from QFrame
- 33 writable properties inherited from QWidget
- 1 writable property inherited from QObject

### Read-Only Properties

- count : int

- 1 read-only property inherited from QFrame
- 24 read-only properties inherited from QWidget

### Public Functions

- QToolBox ( QWidget * parent = 0, Qt::WFlags f = 0 )
- ~QToolBox ()
- int addItem ( QWidget * widget, const QIcon & iconSet, const QString & text )
- int addItem ( QWidget * w, const QString & text )
- int indexOf ( QWidget * widget ) const
- int insertItem ( int index, QWidget * widget, const QIcon & icon, const QString & text )
- int insertItem ( int index, QWidget * widget, const QString & text )
- bool isItemEnabled ( int index ) const
- QIcon itemIcon ( int index ) const
- QString itemText ( int index ) const
- QString itemToolTip ( int index ) const
- void removeItem ( int index )
- void setItemEnabled ( int index, bool enabled )
- void setItemIcon ( int index, const QIcon & icon )
- void setItemText ( int index, const QString & text )
- void setItemToolTip ( int index, const QString & toolTip )
- QWidget * widget ( int index ) const

- 2 public functions inherited from QFrame
- 83 public functions inherited from QWidget
- 24 public functions inherited from QObject
- 2 public functions inherited from QPaintDevice

### Public Slots

- void setCurrentIndex ( int index )

- 16 public slots inherited from QWidget
- 1 public slot inherited from QObject

### Signals

- void currentChanged ( int index )

- 1 signal inherited from QObject

### Static Public Members

- 4 static public members inherited from QWidget
- 4 static public members inherited from QObject

### Protected Functions

- virtual void itemInserted ( int index )
- virtual void itemRemoved ( int index )

- 44 protected functions inherited from QWidget
- 9 protected functions inherited from QObject

## Detailed Description

The 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 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 QTabWidget.

## Property Documentation

### count : int

This property holds the number of items contained in the toolbox.

Access functions:

- int count () const

### currentIndex : int

This property holds the index of the current item, or -1 if the toolbox is empty.

Access functions:

- int currentIndex () const
- void setCurrentIndex ( int index )

See also indexOf() and widget().

## Member Function Documentation

### QToolBox::QToolBox ( QWidget * parent = 0, Qt::WFlags f = 0 )

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

### QToolBox::~QToolBox ()

Destroys the toolbox.

### int QToolBox::addItem ( QWidget * widget, const QIcon & iconSet, const QString & text )

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.

### int QToolBox::addItem ( QWidget * w, const QString & text )

This is an overloaded member function, provided for convenience. It behaves essentially like the above 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.

### void QToolBox::currentChanged ( int index ) `[signal]`

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.

### int QToolBox::indexOf ( QWidget * widget ) const

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

### int QToolBox::insertItem ( int index, QWidget * widget, const QIcon & icon, const QString & text )

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.

### int QToolBox::insertItem ( int index, QWidget * widget, const QString & text )

This is an overloaded member function, provided for convenience. It behaves essentially like the above 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.

### bool QToolBox::isItemEnabled ( int index ) const

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

### QIcon QToolBox::itemIcon ( int index ) const

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

### void QToolBox::itemInserted ( int index ) `[virtual protected]`

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

See also itemRemoved().

### void QToolBox::itemRemoved ( int index ) `[virtual protected]`

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

See also itemInserted().

### QString QToolBox::itemText ( int index ) const

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

### QString QToolBox::itemToolTip ( int index ) const

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

### void QToolBox::removeItem ( int index )

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

### void QToolBox::setItemEnabled ( int index, bool enabled )

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

### void QToolBox::setItemIcon ( int index, const QIcon & icon )

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

### void QToolBox::setItemText ( int index, const QString & text )

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

### void QToolBox::setItemToolTip ( int index, const QString & toolTip )

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

### QWidget * QToolBox::widget ( int index ) const

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