<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/widgets/qtoolbox.cpp:249 --> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>QToolBox Class</title> <style type="text/css"><!-- fn { margin-left: 1cm; text-indent: -1cm; } a:link { color: #004faf; text-decoration: none } a:visited { color: #672967; text-decoration: none } body { background: #ffffff; color: black; } --></style> </head> <body> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr bgcolor="#E5E5E5"> <td valign=center> <a href="index.html"> <font color="#004faf">Home</font></a> | <a href="classes.html"> <font color="#004faf">All Classes</font></a> | <a href="mainclasses.html"> <font color="#004faf">Main Classes</font></a> | <a href="annotated.html"> <font color="#004faf">Annotated</font></a> | <a href="groups.html"> <font color="#004faf">Grouped Classes</font></a> | <a href="functions.html"> <font color="#004faf">Functions</font></a> </td> <td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QToolBox Class Reference</h1> <p>The QToolBox class provides a column of tabbed widget items. <a href="#details">More...</a> <p><tt>#include <<a href="qtoolbox-h.html">qtoolbox.h</a>></tt> <p>Inherits <a href="qframe.html">QFrame</a>. <p><a href="qtoolbox-members.html">List of all member functions.</a> <h2>Public Members</h2> <ul> <li class=fn><a href="#QToolBox"><b>QToolBox</b></a> ( QWidget * parent = 0, const char * name = 0, WFlags f = 0 )</li> <li class=fn>int <a href="#addItem-2"><b>addItem</b></a> ( QWidget * w, const QString & label )</li> <li class=fn>int <a href="#addItem"><b>addItem</b></a> ( QWidget * item, const QIconSet & iconSet, const QString & label )</li> <li class=fn>int <a href="#insertItem-2"><b>insertItem</b></a> ( int index, QWidget * item, const QString & label )</li> <li class=fn>int <a href="#insertItem"><b>insertItem</b></a> ( int index, QWidget * item, const QIconSet & iconSet, const QString & label )</li> <li class=fn>int <a href="#removeItem"><b>removeItem</b></a> ( QWidget * item )</li> <li class=fn>void <a href="#setItemEnabled"><b>setItemEnabled</b></a> ( int index, bool enabled )</li> <li class=fn>bool <a href="#isItemEnabled"><b>isItemEnabled</b></a> ( int index ) const</li> <li class=fn>void <a href="#setItemLabel"><b>setItemLabel</b></a> ( int index, const QString & label )</li> <li class=fn>QString <a href="#itemLabel"><b>itemLabel</b></a> ( int index ) const</li> <li class=fn>void <a href="#setItemIconSet"><b>setItemIconSet</b></a> ( int index, const QIconSet & iconSet )</li> <li class=fn>QIconSet <a href="#itemIconSet"><b>itemIconSet</b></a> ( int index ) const</li> <li class=fn>void <a href="#setItemToolTip"><b>setItemToolTip</b></a> ( int index, const QString & toolTip )</li> <li class=fn>QString <a href="#itemToolTip"><b>itemToolTip</b></a> ( int index ) const</li> <li class=fn>QWidget * <a href="#currentItem"><b>currentItem</b></a> () const</li> <li class=fn>void <a href="#setCurrentItem"><b>setCurrentItem</b></a> ( QWidget * item )</li> <li class=fn>int <a href="#currentIndex"><b>currentIndex</b></a> () const</li> <li class=fn>QWidget * <a href="#item"><b>item</b></a> ( int index ) const</li> <li class=fn>int <a href="#indexOf"><b>indexOf</b></a> ( QWidget * item ) const</li> <li class=fn>int <a href="#count"><b>count</b></a> () const</li> </ul> <h2>Public Slots</h2> <ul> <li class=fn>void <a href="#setCurrentIndex"><b>setCurrentIndex</b></a> ( int index )</li> </ul> <h2>Signals</h2> <ul> <li class=fn>void <a href="#currentChanged"><b>currentChanged</b></a> ( int index )</li> </ul> <h2>Properties</h2> <ul> <li class=fn>int <a href="#count-prop"><b>count</b></a> - the number of items contained in the toolbox <em>(read only)</em></li> <li class=fn>int <a href="#currentIndex-prop"><b>currentIndex</b></a> - the index of the current item, or -1 if the toolbox is empty</li> </ul> <h2>Protected Members</h2> <ul> <li class=fn>virtual void <a href="#itemInserted"><b>itemInserted</b></a> ( int index )</li> <li class=fn>virtual void <a href="#itemRemoved"><b>itemRemoved</b></a> ( int index )</li> </ul> <hr><a name="details"></a><h2>Detailed Description</h2> <p> The QToolBox class provides a column of tabbed widget items. <p> <p> 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 <a href="qwidget.html">QWidget</a>. <p> Each item has an <a href="#itemLabel">itemLabel</a>(), an optional icon, <a href="#itemIconSet">itemIconSet</a>(), an optional <a href="#itemToolTip">itemToolTip</a>(), and a <a href="#item">widget</a>. The item's attributes can be changed with <a href="#setItemLabel">setItemLabel</a>(), <a href="#setItemIconSet">setItemIconSet</a>() and <a href="#setItemToolTip">setItemToolTip</a>(). <p> Items are added using <a href="#addItem">addItem</a>(), or inserted at particular positions using <a href="#insertItem">insertItem</a>(). The total number of items is given by <a href="#count">count</a>(). Items can be deleted with delete, or removed from the toolbox with <a href="#removeItem">removeItem</a>(). Combining removeItem() and insertItem() allows to move items to different positions. <p> The current item widget is returned by <a href="#currentItem">currentItem</a>() and set with <a href="#setCurrentItem">setCurrentItem</a>(). If you prefer you can work in terms of indexes using <a href="#currentIndex">currentIndex</a>(), <a href="#setCurrentIndex">setCurrentIndex</a>(), <a href="#indexOf">indexOf</a>() and <a href="#item">item</a>(). <p> The <a href="#currentChanged">currentChanged</a>() signal is emitted when the current item is changed. <p> <p>See also <a href="qtabwidget.html">QTabWidget</a> and <a href="advanced.html">Advanced Widgets</a>. <hr><h2>Member Function Documentation</h2> <h3 class=fn><a name="QToolBox"></a>QToolBox::QToolBox ( <a href="qwidget.html">QWidget</a> * parent = 0, const char * name = 0, WFlags f = 0 ) </h3> Constructs a toolbox called <em>name</em> with parent <em>parent</em> and flags <em>f</em>. <h3 class=fn>int <a name="addItem"></a>QToolBox::addItem ( <a href="qwidget.html">QWidget</a> * item, const <a href="qiconset.html">QIconSet</a> & iconSet, const <a href="qstring.html">QString</a> & label ) </h3> Adds the widget <em>item</em> in a new tab at bottom of the toolbox. The new tab's label is set to <em>label</em>, and the <em>iconSet</em> is displayed to the left of the <em>label</em>. Returns the new tab's index. <h3 class=fn>int <a name="addItem-2"></a>QToolBox::addItem ( <a href="qwidget.html">QWidget</a> * w, const <a href="qstring.html">QString</a> & label ) </h3> This is an overloaded member function, provided for convenience. It behaves essentially like the above function. <p> Adds the widget <em>w</em> in a new tab at bottom of the toolbox. The new tab's label is set to <em>label</em>. Returns the new tab's index. <h3 class=fn>int <a name="count"></a>QToolBox::count () const </h3><p>Returns the number of items contained in the toolbox. See the <a href="qtoolbox.html#count-prop">"count"</a> property for details. <h3 class=fn>void <a name="currentChanged"></a>QToolBox::currentChanged ( int index )<tt> [signal]</tt> </h3> <p> This signal is emitted when the current item changed. The new current item's index is passed in <em>index</em>, or -1 if there is no current item. <h3 class=fn>int <a name="currentIndex"></a>QToolBox::currentIndex () const </h3><p>Returns the index of the current item, or -1 if the toolbox is empty. See the <a href="qtoolbox.html#currentIndex-prop">"currentIndex"</a> property for details. <h3 class=fn><a href="qwidget.html">QWidget</a> * <a name="currentItem"></a>QToolBox::currentItem () const </h3> Returns the toolbox's current item, or 0 if the toolbox is empty. <h3 class=fn>int <a name="indexOf"></a>QToolBox::indexOf ( <a href="qwidget.html">QWidget</a> * item ) const </h3> Returns the index of item <em>item</em>, or -1 if the item does not exist. <h3 class=fn>int <a name="insertItem"></a>QToolBox::insertItem ( int index, <a href="qwidget.html">QWidget</a> * item, const <a href="qiconset.html">QIconSet</a> & iconSet, const <a href="qstring.html">QString</a> & label ) </h3> Inserts the widget <em>item</em> at position <em>index</em>, or at the bottom of the toolbox if <em>index</em> is out of range. The new item's label is set to <em>label</em>, and the <em>iconSet</em> is displayed to the left of the <em>label</em>. Returns the new item's index. <h3 class=fn>int <a name="insertItem-2"></a>QToolBox::insertItem ( int index, <a href="qwidget.html">QWidget</a> * item, const <a href="qstring.html">QString</a> & label ) </h3> This is an overloaded member function, provided for convenience. It behaves essentially like the above function. <p> Inserts the widget <em>item</em> at position <em>index</em>, or at the bottom of the toolbox if <em>index</em> is out of range. The new item's label is set to <em>label</em>. Returns the new item's index. <h3 class=fn>bool <a name="isItemEnabled"></a>QToolBox::isItemEnabled ( int index ) const </h3> Returns TRUE if the item at position <em>index</em> is enabled; otherwise returns FALSE. <h3 class=fn><a href="qwidget.html">QWidget</a> * <a name="item"></a>QToolBox::item ( int index ) const </h3> Returns the item at position <em>index</em>, or 0 if there is no such item. <h3 class=fn><a href="qiconset.html">QIconSet</a> <a name="itemIconSet"></a>QToolBox::itemIconSet ( int index ) const </h3> Returns the icon of the item at position <em>index</em>, or a null icon if <em>index</em> is out of range. <h3 class=fn>void <a name="itemInserted"></a>QToolBox::itemInserted ( int index )<tt> [virtual protected]</tt> </h3> This virtual handler is called after a new item was added or inserted at position <em>index</em>. <h3 class=fn><a href="qstring.html">QString</a> <a name="itemLabel"></a>QToolBox::itemLabel ( int index ) const </h3> Returns the label of the item at position <em>index</em>, or a null string if <em>index</em> is out of range. <h3 class=fn>void <a name="itemRemoved"></a>QToolBox::itemRemoved ( int index )<tt> [virtual protected]</tt> </h3> This virtual handler is called after an item was removed from position <em>index</em>. <h3 class=fn><a href="qstring.html">QString</a> <a name="itemToolTip"></a>QToolBox::itemToolTip ( int index ) const </h3> Returns the tooltip of the item at position <em>index</em>, or a null string if <em>index</em> is out of range. <h3 class=fn>int <a name="removeItem"></a>QToolBox::removeItem ( <a href="qwidget.html">QWidget</a> * item ) </h3> Removes the widget <em>item</em> from the toolbox. Note that the widget is <em>not</em> deleted. Returns the removed widget's index, or -1 if the widget was not in this tool box. <h3 class=fn>void <a name="setCurrentIndex"></a>QToolBox::setCurrentIndex ( int index )<tt> [slot]</tt> </h3><p>Sets the index of the current item, or -1 if the toolbox is empty to <em>index</em>. See the <a href="qtoolbox.html#currentIndex-prop">"currentIndex"</a> property for details. <h3 class=fn>void <a name="setCurrentItem"></a>QToolBox::setCurrentItem ( <a href="qwidget.html">QWidget</a> * item ) </h3> Sets the current item to be <em>item</em>. <h3 class=fn>void <a name="setItemEnabled"></a>QToolBox::setItemEnabled ( int index, bool enabled ) </h3> If <em>enabled</em> is TRUE then the item at position <em>index</em> is enabled; otherwise item <em>index</em> is disabled. <h3 class=fn>void <a name="setItemIconSet"></a>QToolBox::setItemIconSet ( int index, const <a href="qiconset.html">QIconSet</a> & iconSet ) </h3> Sets the icon of the item at position <em>index</em> to <em>iconSet</em>. <h3 class=fn>void <a name="setItemLabel"></a>QToolBox::setItemLabel ( int index, const <a href="qstring.html">QString</a> & label ) </h3> Sets the label of the item at position <em>index</em> to <em>label</em>. <h3 class=fn>void <a name="setItemToolTip"></a>QToolBox::setItemToolTip ( int index, const <a href="qstring.html">QString</a> & toolTip ) </h3> Sets the tooltip of the item at position <em>index</em> to <em>toolTip</em>. <hr><h2>Property Documentation</h2> <h3 class=fn>int <a name="count-prop"></a>count</h3> <p>This property holds the number of items contained in the toolbox. <p> <p>Get this property's value with <a href="#count">count</a>(). <h3 class=fn>int <a name="currentIndex-prop"></a>currentIndex</h3> <p>This property holds the index of the current item, or -1 if the toolbox is empty. <p>Set this property's value with <a href="#setCurrentIndex">setCurrentIndex</a>() and get this property's value with <a href="#currentIndex">currentIndex</a>(). <p><p>See also <a href="#currentItem">currentItem</a>(), <a href="#indexOf">indexOf</a>(), and <a href="#item">item</a>(). <!-- eof --> <hr><p> This file is part of the <a href="index.html">Qt toolkit</a>. Copyright © 1995-2007 <a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center> <table width=100% cellspacing=0 border=0><tr> <td>Copyright © 2007 <a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a> <td align=right><div align=right>Qt 3.3.8</div> </table></div></address></body> </html>