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

# TQToolBox Class Reference

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

`#include <ntqtoolbox.h>`

Inherits TQFrame.

List of all member functions.

## Public Members

- TQToolBox ( TQWidget * parent = 0, const char * name = 0, WFlags f = 0 )
- int addItem ( TQWidget * w, const TQString & label )
- int addItem ( TQWidget * item, const TQIconSet & iconSet, const TQString & label )
- int insertItem ( int index, TQWidget * item, const TQString & label )
- int insertItem ( int index, TQWidget * item, const TQIconSet & iconSet, const TQString & label )
- int removeItem ( TQWidget * item )
- void setItemEnabled ( int index, bool enabled )
- bool isItemEnabled ( int index ) const
- void setItemLabel ( int index, const TQString & label )
- TQString itemLabel ( int index ) const
- void setItemIconSet ( int index, const TQIconSet & iconSet )
- TQIconSet itemIconSet ( int index ) const
- void setItemToolTip ( int index, const TQString & toolTip )
- TQString itemToolTip ( int index ) const
- TQWidget * currentItem () const
- void setCurrentItem ( TQWidget * item )
- int currentIndex () const
- TQWidget * item ( int index ) const
- int indexOf ( TQWidget * item ) const
- int count () const

## Public Slots

- void setCurrentIndex ( int index )

## Signals

- void currentChanged ( int index )

## Properties

- int count - the number of items contained in the toolbox (read only)
- int currentIndex - the index of the current item, or -1 if the toolbox is empty

## Protected Members

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

## Detailed Description

The TQToolBox 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 TQWidget.

Each item has an itemLabel(), an optional icon, itemIconSet(), an optional itemToolTip(), and a widget. The item's attributes can be changed with setItemLabel(), setItemIconSet() and setItemToolTip().

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 to move items to different positions.

The current item widget is returned by currentItem() and set with setCurrentItem(). If you prefer you can work in terms of indexes using currentIndex(), setCurrentIndex(), indexOf() and item().

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

See also TQTabWidget and Advanced Widgets.

## Member Function Documentation

### TQToolBox::TQToolBox ( TQWidget * parent = 0, const char * name = 0, WFlags f = 0 )

Constructs a toolbox called name with parent parent and flags f.

### int TQToolBox::addItem ( TQWidget * item, const TQIconSet & iconSet, const TQString & label )

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

### int TQToolBox::addItem ( TQWidget * w, const TQString & label )

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 label is set to label. Returns the new tab's index.

### int TQToolBox::count () const

Returns the number of items contained in the toolbox. See the "count" property for details.

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

This signal is emitted when the current item changed. The new current item's index is passed in index, or -1 if there is no current item.

### int TQToolBox::currentIndex () const

Returns the index of the current item, or -1 if the toolbox is empty. See the "currentIndex" property for details.

### TQWidget * TQToolBox::currentItem () const

Returns the toolbox's current item, or 0 if the toolbox is empty.

### int TQToolBox::indexOf ( TQWidget * item ) const

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

### int TQToolBox::insertItem ( int index, TQWidget * item, const TQIconSet & iconSet, const TQString & label )

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

### int TQToolBox::insertItem ( int index, TQWidget * item, const TQString & label )

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Inserts the widget item at position index, or at the bottom of the toolbox if index is out of range. The new item's label is set to label. Returns the new item's index.

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

Returns TRUE if the item at position index is enabled; otherwise returns FALSE.

### TQWidget * TQToolBox::item ( int index ) const

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

### TQIconSet TQToolBox::itemIconSet ( int index ) const

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

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

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

### TQString TQToolBox::itemLabel ( int index ) const

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

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

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

### TQString TQToolBox::itemToolTip ( int index ) const

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

### int TQToolBox::removeItem ( TQWidget * item )

Removes the widget item from the toolbox. Note that the widget is not deleted. Returns the removed widget's index, or -1 if the widget was not in this tool box.

### void TQToolBox::setCurrentIndex ( int index )`[slot]`

Sets the index of the current item, or -1 if the toolbox is empty to index. See the "currentIndex" property for details.

### void TQToolBox::setCurrentItem ( TQWidget * item )

Sets the current item to be item.

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

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

### void TQToolBox::setItemIconSet ( int index, const TQIconSet & iconSet )

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

### void TQToolBox::setItemLabel ( int index, const TQString & label )

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

### void TQToolBox::setItemToolTip ( int index, const TQString & toolTip )

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

## Property Documentation

### int count

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

Get this property's value with count().

### int currentIndex

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

Set this property's value with setCurrentIndex() and get this property's value with currentIndex().

See also currentItem(), indexOf(), and item().

This file is part of the TQt toolkit. Copyright © 1995-2007 Trolltech. All Rights Reserved.