| 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
 | 
|---|
| 2 | <!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/widgets/qlistbox.cpp:805 -->
 | 
|---|
| 3 | <html>
 | 
|---|
| 4 | <head>
 | 
|---|
| 5 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
 | 
|---|
| 6 | <title>QListBox Class</title>
 | 
|---|
| 7 | <style type="text/css"><!--
 | 
|---|
| 8 | fn { margin-left: 1cm; text-indent: -1cm; }
 | 
|---|
| 9 | a:link { color: #004faf; text-decoration: none }
 | 
|---|
| 10 | a:visited { color: #672967; text-decoration: none }
 | 
|---|
| 11 | body { background: #ffffff; color: black; }
 | 
|---|
| 12 | --></style>
 | 
|---|
| 13 | </head>
 | 
|---|
| 14 | <body>
 | 
|---|
| 15 | 
 | 
|---|
| 16 | <table border="0" cellpadding="0" cellspacing="0" width="100%">
 | 
|---|
| 17 | <tr bgcolor="#E5E5E5">
 | 
|---|
| 18 | <td valign=center>
 | 
|---|
| 19 |  <a href="index.html">
 | 
|---|
| 20 | <font color="#004faf">Home</font></a>
 | 
|---|
| 21 |  | <a href="classes.html">
 | 
|---|
| 22 | <font color="#004faf">All Classes</font></a>
 | 
|---|
| 23 |  | <a href="mainclasses.html">
 | 
|---|
| 24 | <font color="#004faf">Main Classes</font></a>
 | 
|---|
| 25 |  | <a href="annotated.html">
 | 
|---|
| 26 | <font color="#004faf">Annotated</font></a>
 | 
|---|
| 27 |  | <a href="groups.html">
 | 
|---|
| 28 | <font color="#004faf">Grouped Classes</font></a>
 | 
|---|
| 29 |  | <a href="functions.html">
 | 
|---|
| 30 | <font color="#004faf">Functions</font></a>
 | 
|---|
| 31 | </td>
 | 
|---|
| 32 | <td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QListBox Class Reference</h1>
 | 
|---|
| 33 | 
 | 
|---|
| 34 | <p>The QListBox widget provides a list of selectable, read-only items.
 | 
|---|
| 35 | <a href="#details">More...</a>
 | 
|---|
| 36 | <p><tt>#include <<a href="qlistbox-h.html">qlistbox.h</a>></tt>
 | 
|---|
| 37 | <p>Inherits <a href="qscrollview.html">QScrollView</a>.
 | 
|---|
| 38 | <p><a href="qlistbox-members.html">List of all member functions.</a>
 | 
|---|
| 39 | <h2>Public Members</h2>
 | 
|---|
| 40 | <ul>
 | 
|---|
| 41 | <li class=fn><a href="#QListBox"><b>QListBox</b></a> ( QWidget * parent = 0, const char * name = 0, WFlags f = 0 )</li>
 | 
|---|
| 42 | <li class=fn><a href="#~QListBox"><b>~QListBox</b></a> ()</li>
 | 
|---|
| 43 | <li class=fn>uint <a href="#count"><b>count</b></a> () const</li>
 | 
|---|
| 44 | <li class=fn>void <a href="#insertStringList"><b>insertStringList</b></a> ( const QStringList & list, int index = -1 )</li>
 | 
|---|
| 45 | <li class=fn>void <a href="#insertStrList"><b>insertStrList</b></a> ( const QStrList * list, int index = -1 )</li>
 | 
|---|
| 46 | <li class=fn>void <a href="#insertStrList-2"><b>insertStrList</b></a> ( const QStrList & list, int index = -1 )</li>
 | 
|---|
| 47 | <li class=fn>void <a href="#insertStrList-3"><b>insertStrList</b></a> ( const char ** strings, int numStrings = -1, int index = -1 )</li>
 | 
|---|
| 48 | <li class=fn>void <a href="#insertItem"><b>insertItem</b></a> ( const QListBoxItem * lbi, int index = -1 )</li>
 | 
|---|
| 49 | <li class=fn>void <a href="#insertItem-2"><b>insertItem</b></a> ( const QListBoxItem * lbi, const QListBoxItem * after )</li>
 | 
|---|
| 50 | <li class=fn>void <a href="#insertItem-3"><b>insertItem</b></a> ( const QString & text, int index = -1 )</li>
 | 
|---|
| 51 | <li class=fn>void <a href="#insertItem-4"><b>insertItem</b></a> ( const QPixmap & pixmap, int index = -1 )</li>
 | 
|---|
| 52 | <li class=fn>void <a href="#insertItem-5"><b>insertItem</b></a> ( const QPixmap & pixmap, const QString & text, int index = -1 )</li>
 | 
|---|
| 53 | <li class=fn>void <a href="#removeItem"><b>removeItem</b></a> ( int index )</li>
 | 
|---|
| 54 | <li class=fn>QString <a href="#text"><b>text</b></a> ( int index ) const</li>
 | 
|---|
| 55 | <li class=fn>const QPixmap * <a href="#pixmap"><b>pixmap</b></a> ( int index ) const</li>
 | 
|---|
| 56 | <li class=fn>void <a href="#changeItem"><b>changeItem</b></a> ( const QListBoxItem * lbi, int index )</li>
 | 
|---|
| 57 | <li class=fn>void <a href="#changeItem-2"><b>changeItem</b></a> ( const QString & text, int index )</li>
 | 
|---|
| 58 | <li class=fn>void <a href="#changeItem-3"><b>changeItem</b></a> ( const QPixmap & pixmap, int index )</li>
 | 
|---|
| 59 | <li class=fn>void <a href="#changeItem-4"><b>changeItem</b></a> ( const QPixmap & pixmap, const QString & text, int index )</li>
 | 
|---|
| 60 | <li class=fn>void <a href="#takeItem"><b>takeItem</b></a> ( const QListBoxItem * item )</li>
 | 
|---|
| 61 | <li class=fn>int <a href="#numItemsVisible"><b>numItemsVisible</b></a> () const</li>
 | 
|---|
| 62 | <li class=fn>int <a href="#currentItem"><b>currentItem</b></a> () const</li>
 | 
|---|
| 63 | <li class=fn>QString <a href="#currentText"><b>currentText</b></a> () const</li>
 | 
|---|
| 64 | <li class=fn>virtual void <a href="#setCurrentItem"><b>setCurrentItem</b></a> ( int index )</li>
 | 
|---|
| 65 | <li class=fn>virtual void <a href="#setCurrentItem-2"><b>setCurrentItem</b></a> ( QListBoxItem * i )</li>
 | 
|---|
| 66 | <li class=fn>void centerCurrentItem ()  <em>(obsolete)</em></li>
 | 
|---|
| 67 | <li class=fn>int <a href="#topItem"><b>topItem</b></a> () const</li>
 | 
|---|
| 68 | <li class=fn>virtual void <a href="#setTopItem"><b>setTopItem</b></a> ( int index )</li>
 | 
|---|
| 69 | <li class=fn>virtual void <a href="#setBottomItem"><b>setBottomItem</b></a> ( int index )</li>
 | 
|---|
| 70 | <li class=fn>long <a href="#maxItemWidth"><b>maxItemWidth</b></a> () const</li>
 | 
|---|
| 71 | <li class=fn>enum <a href="#SelectionMode-enum"><b>SelectionMode</b></a> { Single, Multi, Extended, NoSelection }</li>
 | 
|---|
| 72 | <li class=fn>virtual void <a href="#setSelectionMode"><b>setSelectionMode</b></a> ( SelectionMode )</li>
 | 
|---|
| 73 | <li class=fn>SelectionMode <a href="#selectionMode"><b>selectionMode</b></a> () const</li>
 | 
|---|
| 74 | <li class=fn>void setMultiSelection ( bool multi )  <em>(obsolete)</em></li>
 | 
|---|
| 75 | <li class=fn>bool isMultiSelection () const  <em>(obsolete)</em></li>
 | 
|---|
| 76 | <li class=fn>virtual void <a href="#setSelected"><b>setSelected</b></a> ( QListBoxItem * item, bool select )</li>
 | 
|---|
| 77 | <li class=fn>void <a href="#setSelected-2"><b>setSelected</b></a> ( int index, bool select )</li>
 | 
|---|
| 78 | <li class=fn>bool <a href="#isSelected"><b>isSelected</b></a> ( int i ) const</li>
 | 
|---|
| 79 | <li class=fn>bool <a href="#isSelected-2"><b>isSelected</b></a> ( const QListBoxItem * i ) const</li>
 | 
|---|
| 80 | <li class=fn>QListBoxItem * <a href="#selectedItem"><b>selectedItem</b></a> () const</li>
 | 
|---|
| 81 | <li class=fn>QListBoxItem * <a href="#item"><b>item</b></a> ( int index ) const</li>
 | 
|---|
| 82 | <li class=fn>int <a href="#index"><b>index</b></a> ( const QListBoxItem * lbi ) const</li>
 | 
|---|
| 83 | <li class=fn>QListBoxItem * <a href="#findItem"><b>findItem</b></a> ( const QString & text, ComparisonFlags compare = BeginsWith ) const</li>
 | 
|---|
| 84 | <li class=fn>void <a href="#triggerUpdate"><b>triggerUpdate</b></a> ( bool doLayout )</li>
 | 
|---|
| 85 | <li class=fn>bool <a href="#itemVisible"><b>itemVisible</b></a> ( int index )</li>
 | 
|---|
| 86 | <li class=fn>bool <a href="#itemVisible-2"><b>itemVisible</b></a> ( const QListBoxItem * item )</li>
 | 
|---|
| 87 | <li class=fn>enum <a href="#LayoutMode-enum"><b>LayoutMode</b></a> { FixedNumber, FitToWidth, FitToHeight = FitToWidth, Variable }</li>
 | 
|---|
| 88 | <li class=fn>virtual void <a href="#setColumnMode"><b>setColumnMode</b></a> ( LayoutMode )</li>
 | 
|---|
| 89 | <li class=fn>virtual void <a href="#setColumnMode-2"><b>setColumnMode</b></a> ( int )</li>
 | 
|---|
| 90 | <li class=fn>virtual void <a href="#setRowMode"><b>setRowMode</b></a> ( LayoutMode )</li>
 | 
|---|
| 91 | <li class=fn>virtual void <a href="#setRowMode-2"><b>setRowMode</b></a> ( int )</li>
 | 
|---|
| 92 | <li class=fn>LayoutMode <a href="#columnMode"><b>columnMode</b></a> () const</li>
 | 
|---|
| 93 | <li class=fn>LayoutMode <a href="#rowMode"><b>rowMode</b></a> () const</li>
 | 
|---|
| 94 | <li class=fn>int <a href="#numColumns"><b>numColumns</b></a> () const</li>
 | 
|---|
| 95 | <li class=fn>int <a href="#numRows"><b>numRows</b></a> () const</li>
 | 
|---|
| 96 | <li class=fn>bool <a href="#variableWidth"><b>variableWidth</b></a> () const</li>
 | 
|---|
| 97 | <li class=fn>virtual void <a href="#setVariableWidth"><b>setVariableWidth</b></a> ( bool )</li>
 | 
|---|
| 98 | <li class=fn>bool <a href="#variableHeight"><b>variableHeight</b></a> () const</li>
 | 
|---|
| 99 | <li class=fn>virtual void <a href="#setVariableHeight"><b>setVariableHeight</b></a> ( bool )</li>
 | 
|---|
| 100 | <li class=fn>bool autoScrollBar () const  <em>(obsolete)</em></li>
 | 
|---|
| 101 | <li class=fn>void setAutoScrollBar ( bool enable )  <em>(obsolete)</em></li>
 | 
|---|
| 102 | <li class=fn>bool scrollBar () const  <em>(obsolete)</em></li>
 | 
|---|
| 103 | <li class=fn>void setScrollBar ( bool enable )  <em>(obsolete)</em></li>
 | 
|---|
| 104 | <li class=fn>bool autoBottomScrollBar () const  <em>(obsolete)</em></li>
 | 
|---|
| 105 | <li class=fn>void setAutoBottomScrollBar ( bool enable )  <em>(obsolete)</em></li>
 | 
|---|
| 106 | <li class=fn>bool bottomScrollBar () const  <em>(obsolete)</em></li>
 | 
|---|
| 107 | <li class=fn>void setBottomScrollBar ( bool enable )  <em>(obsolete)</em></li>
 | 
|---|
| 108 | <li class=fn>int inSort ( const QListBoxItem * lbi )  <em>(obsolete)</em></li>
 | 
|---|
| 109 | <li class=fn>int inSort ( const QString & text )  <em>(obsolete)</em></li>
 | 
|---|
| 110 | <li class=fn>int cellHeight ( int i ) const  <em>(obsolete)</em></li>
 | 
|---|
| 111 | <li class=fn>int cellHeight () const  <em>(obsolete)</em></li>
 | 
|---|
| 112 | <li class=fn>int cellWidth () const  <em>(obsolete)</em></li>
 | 
|---|
| 113 | <li class=fn>int numCols () const  <em>(obsolete)</em></li>
 | 
|---|
| 114 | <li class=fn>int <a href="#itemHeight"><b>itemHeight</b></a> ( int index = 0 ) const</li>
 | 
|---|
| 115 | <li class=fn>QListBoxItem * <a href="#itemAt"><b>itemAt</b></a> ( const QPoint & p ) const</li>
 | 
|---|
| 116 | <li class=fn>QRect <a href="#itemRect"><b>itemRect</b></a> ( QListBoxItem * item ) const</li>
 | 
|---|
| 117 | <li class=fn>QListBoxItem * <a href="#firstItem"><b>firstItem</b></a> () const</li>
 | 
|---|
| 118 | <li class=fn>void <a href="#sort"><b>sort</b></a> ( bool ascending = TRUE )</li>
 | 
|---|
| 119 | </ul>
 | 
|---|
| 120 | <h2>Public Slots</h2>
 | 
|---|
| 121 | <ul>
 | 
|---|
| 122 | <li class=fn>void <a href="#clear"><b>clear</b></a> ()</li>
 | 
|---|
| 123 | <li class=fn>virtual void <a href="#ensureCurrentVisible"><b>ensureCurrentVisible</b></a> ()</li>
 | 
|---|
| 124 | <li class=fn>virtual void <a href="#clearSelection"><b>clearSelection</b></a> ()</li>
 | 
|---|
| 125 | <li class=fn>virtual void <a href="#selectAll"><b>selectAll</b></a> ( bool select )</li>
 | 
|---|
| 126 | <li class=fn>virtual void <a href="#invertSelection"><b>invertSelection</b></a> ()</li>
 | 
|---|
| 127 | </ul>
 | 
|---|
| 128 | <h2>Signals</h2>
 | 
|---|
| 129 | <ul>
 | 
|---|
| 130 | <li class=fn>void <a href="#highlighted"><b>highlighted</b></a> ( int index )</li>
 | 
|---|
| 131 | <li class=fn>void <a href="#selected"><b>selected</b></a> ( int index )</li>
 | 
|---|
| 132 | <li class=fn>void <a href="#highlighted-2"><b>highlighted</b></a> ( const QString & )</li>
 | 
|---|
| 133 | <li class=fn>void <a href="#selected-2"><b>selected</b></a> ( const QString & )</li>
 | 
|---|
| 134 | <li class=fn>void <a href="#highlighted-3"><b>highlighted</b></a> ( QListBoxItem * )</li>
 | 
|---|
| 135 | <li class=fn>void <a href="#selected-3"><b>selected</b></a> ( QListBoxItem * )</li>
 | 
|---|
| 136 | <li class=fn>void <a href="#selectionChanged"><b>selectionChanged</b></a> ()</li>
 | 
|---|
| 137 | <li class=fn>void <a href="#selectionChanged-2"><b>selectionChanged</b></a> ( QListBoxItem * item )</li>
 | 
|---|
| 138 | <li class=fn>void <a href="#currentChanged"><b>currentChanged</b></a> ( QListBoxItem * item )</li>
 | 
|---|
| 139 | <li class=fn>void <a href="#clicked"><b>clicked</b></a> ( QListBoxItem * item )</li>
 | 
|---|
| 140 | <li class=fn>void <a href="#clicked-2"><b>clicked</b></a> ( QListBoxItem * item, const QPoint & pnt )</li>
 | 
|---|
| 141 | <li class=fn>void <a href="#pressed"><b>pressed</b></a> ( QListBoxItem * item )</li>
 | 
|---|
| 142 | <li class=fn>void <a href="#pressed-2"><b>pressed</b></a> ( QListBoxItem * item, const QPoint & pnt )</li>
 | 
|---|
| 143 | <li class=fn>void <a href="#doubleClicked"><b>doubleClicked</b></a> ( QListBoxItem * item )</li>
 | 
|---|
| 144 | <li class=fn>void <a href="#returnPressed"><b>returnPressed</b></a> ( QListBoxItem * )</li>
 | 
|---|
| 145 | <li class=fn>void <a href="#rightButtonClicked"><b>rightButtonClicked</b></a> ( QListBoxItem *, const QPoint & )</li>
 | 
|---|
| 146 | <li class=fn>void <a href="#rightButtonPressed"><b>rightButtonPressed</b></a> ( QListBoxItem *, const QPoint & )</li>
 | 
|---|
| 147 | <li class=fn>void <a href="#mouseButtonPressed"><b>mouseButtonPressed</b></a> ( int button, QListBoxItem * item, const QPoint & pos )</li>
 | 
|---|
| 148 | <li class=fn>void <a href="#mouseButtonClicked"><b>mouseButtonClicked</b></a> ( int button, QListBoxItem * item, const QPoint & pos )</li>
 | 
|---|
| 149 | <li class=fn>void <a href="#contextMenuRequested"><b>contextMenuRequested</b></a> ( QListBoxItem * item, const QPoint & pos )</li>
 | 
|---|
| 150 | <li class=fn>void <a href="#onItem"><b>onItem</b></a> ( QListBoxItem * i )</li>
 | 
|---|
| 151 | <li class=fn>void <a href="#onViewport"><b>onViewport</b></a> ()</li>
 | 
|---|
| 152 | </ul>
 | 
|---|
| 153 | <h2>Properties</h2>
 | 
|---|
| 154 | <ul>
 | 
|---|
| 155 | <li class=fn>LayoutMode <a href="#columnMode-prop"><b>columnMode</b></a> - the column layout mode for this list box</li>
 | 
|---|
| 156 | <li class=fn>uint <a href="#count-prop"><b>count</b></a> - the number of items in the list box  <em>(read only)</em></li>
 | 
|---|
| 157 | <li class=fn>int <a href="#currentItem-prop"><b>currentItem</b></a> - the current highlighted item</li>
 | 
|---|
| 158 | <li class=fn>QString <a href="#currentText-prop"><b>currentText</b></a> - the text of the current item  <em>(read only)</em></li>
 | 
|---|
| 159 | <li class=fn>bool multiSelection - whether or not the list box is in Multi selection mode  <em>(obsolete)</em></li>
 | 
|---|
| 160 | <li class=fn>int <a href="#numColumns-prop"><b>numColumns</b></a> - the number of columns in the list box  <em>(read only)</em></li>
 | 
|---|
| 161 | <li class=fn>int <a href="#numItemsVisible-prop"><b>numItemsVisible</b></a> - the number of visible items  <em>(read only)</em></li>
 | 
|---|
| 162 | <li class=fn>int <a href="#numRows-prop"><b>numRows</b></a> - the number of rows in the list box  <em>(read only)</em></li>
 | 
|---|
| 163 | <li class=fn>LayoutMode <a href="#rowMode-prop"><b>rowMode</b></a> - the row layout mode for this list box</li>
 | 
|---|
| 164 | <li class=fn>SelectionMode <a href="#selectionMode-prop"><b>selectionMode</b></a> - the selection mode of the list box</li>
 | 
|---|
| 165 | <li class=fn>int <a href="#topItem-prop"><b>topItem</b></a> - the index of an item at the top of the screen</li>
 | 
|---|
| 166 | <li class=fn>bool <a href="#variableHeight-prop"><b>variableHeight</b></a> - whether this list box has variable-height rows</li>
 | 
|---|
| 167 | <li class=fn>bool <a href="#variableWidth-prop"><b>variableWidth</b></a> - whether this list box has variable-width columns</li>
 | 
|---|
| 168 | </ul>
 | 
|---|
| 169 | <h2>Protected Members</h2>
 | 
|---|
| 170 | <ul>
 | 
|---|
| 171 | <li class=fn>void <a href="#updateItem"><b>updateItem</b></a> ( int index )</li>
 | 
|---|
| 172 | <li class=fn>void <a href="#updateItem-2"><b>updateItem</b></a> ( QListBoxItem * i )</li>
 | 
|---|
| 173 | <li class=fn>int totalWidth () const  <em>(obsolete)</em></li>
 | 
|---|
| 174 | <li class=fn>int totalHeight () const  <em>(obsolete)</em></li>
 | 
|---|
| 175 | <li class=fn>virtual void <a href="#paintCell"><b>paintCell</b></a> ( QPainter * p, int row, int col )</li>
 | 
|---|
| 176 | <li class=fn>void <a href="#toggleCurrentItem"><b>toggleCurrentItem</b></a> ()</li>
 | 
|---|
| 177 | <li class=fn>bool <a href="#isRubberSelecting"><b>isRubberSelecting</b></a> () const</li>
 | 
|---|
| 178 | <li class=fn>void <a href="#doLayout"><b>doLayout</b></a> () const</li>
 | 
|---|
| 179 | <li class=fn>bool itemYPos ( int index, int * yPos ) const  <em>(obsolete)</em></li>
 | 
|---|
| 180 | <li class=fn>int findItem ( int yPos ) const  <em>(obsolete)</em></li>
 | 
|---|
| 181 | </ul>
 | 
|---|
| 182 | <hr><a name="details"></a><h2>Detailed Description</h2>
 | 
|---|
| 183 | 
 | 
|---|
| 184 | 
 | 
|---|
| 185 | The QListBox widget provides a list of selectable, read-only items.
 | 
|---|
| 186 | <p> 
 | 
|---|
| 187 | 
 | 
|---|
| 188 | <p> This is typically a single-column list in which either no item or
 | 
|---|
| 189 | one item is selected, but it can also be used in many other ways.
 | 
|---|
| 190 | <p> QListBox will add scroll bars as necessary, but it isn't intended
 | 
|---|
| 191 | for <em>really</em> big lists. If you want more than a few thousand
 | 
|---|
| 192 | items, it's probably better to use a different widget mainly
 | 
|---|
| 193 | because the scroll bars won't provide very good navigation, but
 | 
|---|
| 194 | also because QListBox may become slow with huge lists. (See
 | 
|---|
| 195 | <a href="qlistview.html">QListView</a> and <a href="qtable.html">QTable</a> for possible alternatives.)
 | 
|---|
| 196 | <p> There are a variety of selection modes described in the
 | 
|---|
| 197 | QListBox::SelectionMode documentation. The default is <a href="#SelectionMode-enum">Single</a>
 | 
|---|
| 198 | selection mode, but you can change it using <a href="#setSelectionMode">setSelectionMode</a>().
 | 
|---|
| 199 | (<a href="#setMultiSelection">setMultiSelection</a>() is still provided for compatibility with Qt
 | 
|---|
| 200 | 1.x. We recommend using setSelectionMode() in all code.)
 | 
|---|
| 201 | <p> Because QListBox offers multiple selection it must display
 | 
|---|
| 202 | <a href="focus.html#keyboard-focus">keyboard focus</a> and selection state separately. Therefore there are
 | 
|---|
| 203 | functions both to set the selection state of an item, i.e.
 | 
|---|
| 204 | <a href="#setSelected">setSelected</a>(), and to set which item displays keyboard focus, i.e.
 | 
|---|
| 205 | <a href="#setCurrentItem">setCurrentItem</a>().
 | 
|---|
| 206 | <p> The list box normally arranges its items in a single column and
 | 
|---|
| 207 | adds a vertical scroll bar if required. It is possible to have a
 | 
|---|
| 208 | different fixed number of columns (<a href="#setColumnMode">setColumnMode</a>()), or as many
 | 
|---|
| 209 | columns as will fit in the list box's assigned screen space
 | 
|---|
| 210 | (setColumnMode(FitToWidth)), or to have a fixed number of rows
 | 
|---|
| 211 | (<a href="#setRowMode">setRowMode</a>()) or as many rows as will fit in the list box's
 | 
|---|
| 212 | assigned screen space (setRowMode(FitToHeight)). In all these
 | 
|---|
| 213 | cases QListBox will add scroll bars, as appropriate, in at least
 | 
|---|
| 214 | one direction.
 | 
|---|
| 215 | <p> If multiple rows are used, each row can be as high as necessary
 | 
|---|
| 216 | (the normal setting), or you can request that all items will have
 | 
|---|
| 217 | the same height by calling <a href="#setVariableHeight">setVariableHeight</a>(FALSE). The same
 | 
|---|
| 218 | applies to a column's width, see <a href="#setVariableWidth">setVariableWidth</a>().
 | 
|---|
| 219 | <p> The QListBox's items are <a href="qlistboxitem.html">QListBoxItem</a> objects. QListBox provides
 | 
|---|
| 220 | methods to insert new items as strings, as pixmaps, and as
 | 
|---|
| 221 | QListBoxItem * (<a href="#insertItem">insertItem</a>() with various arguments), and to
 | 
|---|
| 222 | replace an existing item with a new string, pixmap or QListBoxItem
 | 
|---|
| 223 | (<a href="#changeItem">changeItem</a>() with various arguments). You can also remove items
 | 
|---|
| 224 | singly with <a href="#removeItem">removeItem</a>() or <a href="#clear">clear</a>() the entire list box. Note that
 | 
|---|
| 225 | if you create a QListBoxItem yourself and insert it, QListBox
 | 
|---|
| 226 | takes ownership of the item.
 | 
|---|
| 227 | <p> You can also create a QListBoxItem, such as <a href="qlistboxtext.html">QListBoxText</a> or
 | 
|---|
| 228 | <a href="qlistboxpixmap.html">QListBoxPixmap</a>, with the list box as first parameter. The item
 | 
|---|
| 229 | will then append itself. When you delete an item it is
 | 
|---|
| 230 | automatically removed from the list box.
 | 
|---|
| 231 | <p> The list of items can be arbitrarily large; QListBox will add
 | 
|---|
| 232 | scroll bars if necessary. QListBox can display a single-column
 | 
|---|
| 233 | (the common case) or multiple-columns, and offers both single and
 | 
|---|
| 234 | multiple selection. QListBox does not support multiple-column
 | 
|---|
| 235 | items (but <a href="qlistview.html">QListView</a> and <a href="qtable.html">QTable</a> do), or tree hierarchies (but
 | 
|---|
| 236 | QListView does).
 | 
|---|
| 237 | <p> The list box items can be accessed both as <a href="qlistboxitem.html">QListBoxItem</a> objects
 | 
|---|
| 238 | (recommended) and using integer indexes (the original QListBox
 | 
|---|
| 239 | implementation used an array of strings internally, and the API
 | 
|---|
| 240 | still supports this mode of operation). Everything can be done
 | 
|---|
| 241 | using the new objects, and most things can be done using indexes.
 | 
|---|
| 242 | <p> Each item in a QListBox contains a QListBoxItem. One of the items
 | 
|---|
| 243 | can be the current item. The <a href="#currentChanged">currentChanged</a>() signal and the
 | 
|---|
| 244 | <a href="#highlighted">highlighted</a>() signal are emitted when a new item becomes current,
 | 
|---|
| 245 | e.g. because the user clicks on it or <a href="#setCurrentItem">QListBox::setCurrentItem</a>()
 | 
|---|
| 246 | is called. The <a href="#selected">selected</a>() signal is emitted when the user
 | 
|---|
| 247 | double-clicks on an item or presses Enter on the current item.
 | 
|---|
| 248 | <p> If the user does not select anything, no signals are emitted and
 | 
|---|
| 249 | <a href="#currentItem">currentItem</a>() returns -1.
 | 
|---|
| 250 | <p> A list box has <a href="qwidget.html#FocusPolicy-enum">WheelFocus</a> as a default <a href="qwidget.html#focusPolicy">focusPolicy</a>(), i.e. it
 | 
|---|
| 251 | can get keyboard focus by tabbing, clicking and through the use of
 | 
|---|
| 252 | the mouse wheel.
 | 
|---|
| 253 | <p> New items can be inserted using <a href="#insertItem">insertItem</a>(), <a href="#insertStrList">insertStrList</a>() or
 | 
|---|
| 254 | <a href="#insertStringList">insertStringList</a>(). <a href="#inSort">inSort</a>() is obsolete because this method is
 | 
|---|
| 255 | quite inefficient. It's preferable to insert the items normally
 | 
|---|
| 256 | and call <a href="#sort">sort</a>() afterwards, or to insert a sorted <a href="qstringlist.html">QStringList</a>().
 | 
|---|
| 257 | <p> By default, vertical and horizontal scroll bars are added and
 | 
|---|
| 258 | removed as necessary. <a href="qscrollview.html#setHScrollBarMode">setHScrollBarMode</a>() and <a href="qscrollview.html#setVScrollBarMode">setVScrollBarMode</a>()
 | 
|---|
| 259 | can be used to change this policy.
 | 
|---|
| 260 | <p> If you need to insert types other than strings and pixmaps, you
 | 
|---|
| 261 | must define new classes which inherit <a href="qlistboxitem.html">QListBoxItem</a>.
 | 
|---|
| 262 | <p> <b>Warning:</b> The list box assumes ownership of all list box items and
 | 
|---|
| 263 | will delete them when it does not need them any more.
 | 
|---|
| 264 | <p> <img src=qlistbox-m.png> <img src=qlistbox-w.png>
 | 
|---|
| 265 | <p> <p>See also <a href="qlistview.html">QListView</a>, <a href="qcombobox.html">QComboBox</a>, <a href="qbuttongroup.html">QButtonGroup</a>, <a href="guibooks.html#fowler">GUI Design Handbook: List Box (two
 | 
|---|
| 266 |  sections)</a>, and <a href="advanced.html">Advanced Widgets</a>.
 | 
|---|
| 267 | 
 | 
|---|
| 268 | <hr><h2>Member Type Documentation</h2>
 | 
|---|
| 269 | <h3 class=fn><a name="LayoutMode-enum"></a>QListBox::LayoutMode</h3>
 | 
|---|
| 270 | 
 | 
|---|
| 271 | <p> This enum type is used to specify how QListBox lays out its rows
 | 
|---|
| 272 | and columns.
 | 
|---|
| 273 | <ul>
 | 
|---|
| 274 | <li><tt>QListBox::FixedNumber</tt> - There is a fixed number of rows (or columns).
 | 
|---|
| 275 | <li><tt>QListBox::FitToWidth</tt> - There are as many columns as will fit
 | 
|---|
| 276 | on-screen.
 | 
|---|
| 277 | <li><tt>QListBox::FitToHeight</tt> - There are as many rows as will fit on-screen.
 | 
|---|
| 278 | <li><tt>QListBox::Variable</tt> - There are as many rows as are required by the
 | 
|---|
| 279 | column mode. (Or as many columns as required by the row mode.)
 | 
|---|
| 280 | </ul><p> Example: When you call <a href="#setRowMode">setRowMode</a>( FitToHeight ), <a href="#columnMode">columnMode</a>()
 | 
|---|
| 281 | automatically becomes <a href="#LayoutMode-enum">Variable</a> to accommodate the row mode
 | 
|---|
| 282 | you've set.
 | 
|---|
| 283 | 
 | 
|---|
| 284 | <h3 class=fn><a name="SelectionMode-enum"></a>QListBox::SelectionMode</h3>
 | 
|---|
| 285 | 
 | 
|---|
| 286 | <p> This enumerated type is used by QListBox to indicate how it reacts
 | 
|---|
| 287 | to selection by the user.
 | 
|---|
| 288 | <ul>
 | 
|---|
| 289 | <li><tt>QListBox::Single</tt> - When the user selects an item, any already-selected
 | 
|---|
| 290 | item becomes unselected and the user cannot unselect the selected
 | 
|---|
| 291 | item. This means that the user can never clear the selection, even
 | 
|---|
| 292 | though the selection may be cleared by the application programmer
 | 
|---|
| 293 | using <a href="#clearSelection">QListBox::clearSelection</a>().
 | 
|---|
| 294 | <li><tt>QListBox::Multi</tt> - When the user selects an item the selection status
 | 
|---|
| 295 | of that item is toggled and the other items are left alone. Also,
 | 
|---|
| 296 | multiple items can be selected by dragging the mouse while the
 | 
|---|
| 297 | left mouse button is kept pressed.
 | 
|---|
| 298 | <li><tt>QListBox::Extended</tt> - When the user selects an item the selection is
 | 
|---|
| 299 | cleared and the new item selected. However, if the user presses
 | 
|---|
| 300 | the Ctrl key when clicking on an item, the clicked item gets
 | 
|---|
| 301 | toggled and all other items are left untouched. And if the user
 | 
|---|
| 302 | presses the Shift key while clicking on an item, all items between
 | 
|---|
| 303 | the current item and the clicked item get selected or unselected,
 | 
|---|
| 304 | depending on the state of the clicked item. Also, multiple items
 | 
|---|
| 305 | can be selected by dragging the mouse while the left mouse button
 | 
|---|
| 306 | is kept pressed.
 | 
|---|
| 307 | <li><tt>QListBox::NoSelection</tt> - Items cannot be selected.
 | 
|---|
| 308 | </ul><p> In other words, <a href="#SelectionMode-enum">Single</a> is a real single-selection list box, <a href="#SelectionMode-enum">Multi</a> is a real multi-selection list box, <a href="#SelectionMode-enum">Extended</a> is a list
 | 
|---|
| 309 | box in which users can select multiple items but usually want to
 | 
|---|
| 310 | select either just one or a range of contiguous items, and <a href="#SelectionMode-enum">NoSelection</a> is for a list box where the user can look but not
 | 
|---|
| 311 | touch.
 | 
|---|
| 312 | 
 | 
|---|
| 313 | <hr><h2>Member Function Documentation</h2>
 | 
|---|
| 314 | <h3 class=fn><a name="QListBox"></a>QListBox::QListBox ( <a href="qwidget.html">QWidget</a> * parent = 0, const char * name = 0, WFlags f = 0 )
 | 
|---|
| 315 | </h3>
 | 
|---|
| 316 | Constructs a new empty list box called <em>name</em> and with parent <em>parent</em>.
 | 
|---|
| 317 | <p> Performance is boosted by modifying the widget flags <em>f</em> so that
 | 
|---|
| 318 | only part of the <a href="qlistboxitem.html">QListBoxItem</a> children is redrawn. This may be
 | 
|---|
| 319 | unsuitable for custom QListBoxItem classes, in which case <a href="qt.html#WidgetFlags-enum">WStaticContents</a> and <a href="qt.html#WidgetFlags-enum">WNoAutoErase</a> should be cleared
 | 
|---|
| 320 | immediately after construction.
 | 
|---|
| 321 | <p> <p>See also <a href="qwidget.html#clearWFlags">QWidget::clearWFlags</a>() and <a href="qt.html#WidgetFlags-enum">Qt::WidgetFlags</a>.
 | 
|---|
| 322 | 
 | 
|---|
| 323 | <h3 class=fn><a name="~QListBox"></a>QListBox::~QListBox ()
 | 
|---|
| 324 | </h3>
 | 
|---|
| 325 | Destroys the list box. Deletes all list box items.
 | 
|---|
| 326 | 
 | 
|---|
| 327 | <h3 class=fn>bool <a name="autoBottomScrollBar"></a>QListBox::autoBottomScrollBar () const
 | 
|---|
| 328 | </h3>
 | 
|---|
| 329 | 
 | 
|---|
| 330 | <p> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
 | 
|---|
| 331 | <p> Returns TRUE if <a href="qscrollview.html#hScrollBarMode">hScrollBarMode</a>() is <a href="qscrollview.html#ScrollBarMode-enum">Auto</a>; otherwise returns
 | 
|---|
| 332 | FALSE.
 | 
|---|
| 333 | 
 | 
|---|
| 334 | <h3 class=fn>bool <a name="autoScrollBar"></a>QListBox::autoScrollBar () const
 | 
|---|
| 335 | </h3>
 | 
|---|
| 336 | 
 | 
|---|
| 337 | <p> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
 | 
|---|
| 338 | <p> Returns TRUE if <a href="qscrollview.html#vScrollBarMode">vScrollBarMode</a>() is <a href="qscrollview.html#ScrollBarMode-enum">Auto</a>; otherwise returns
 | 
|---|
| 339 | FALSE.
 | 
|---|
| 340 | 
 | 
|---|
| 341 | <h3 class=fn>bool <a name="bottomScrollBar"></a>QListBox::bottomScrollBar () const
 | 
|---|
| 342 | </h3>
 | 
|---|
| 343 | 
 | 
|---|
| 344 | <p> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
 | 
|---|
| 345 | <p> Returns FALSE if <a href="qscrollview.html#vScrollBarMode">vScrollBarMode</a>() is <a href="qscrollview.html#ScrollBarMode-enum">AlwaysOff</a>; otherwise
 | 
|---|
| 346 | returns TRUE.
 | 
|---|
| 347 | 
 | 
|---|
| 348 | <h3 class=fn>int <a name="cellHeight"></a>QListBox::cellHeight ( int i ) const
 | 
|---|
| 349 | </h3>
 | 
|---|
| 350 | <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
 | 
|---|
| 351 | <p> 
 | 
|---|
| 352 | Returns the item height of item <em>i</em>.
 | 
|---|
| 353 | <p>See also <a href="#itemHeight">itemHeight</a>().
 | 
|---|
| 354 | 
 | 
|---|
| 355 | <h3 class=fn>int <a name="cellHeight-2"></a>QListBox::cellHeight () const
 | 
|---|
| 356 | </h3>
 | 
|---|
| 357 | <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
 | 
|---|
| 358 | <p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
 | 
|---|
| 359 | <p> Returns the item height of the first item, item 0.
 | 
|---|
| 360 | <p>See also <a href="#itemHeight">itemHeight</a>().
 | 
|---|
| 361 | 
 | 
|---|
| 362 | <h3 class=fn>int <a name="cellWidth"></a>QListBox::cellWidth () const
 | 
|---|
| 363 | </h3>
 | 
|---|
| 364 | <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
 | 
|---|
| 365 | <p> 
 | 
|---|
| 366 | Returns the maximum item width.
 | 
|---|
| 367 | <p>See also <a href="#maxItemWidth">maxItemWidth</a>().
 | 
|---|
| 368 | 
 | 
|---|
| 369 | <h3 class=fn>void <a name="centerCurrentItem"></a>QListBox::centerCurrentItem ()
 | 
|---|
| 370 | </h3>
 | 
|---|
| 371 | 
 | 
|---|
| 372 | <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
 | 
|---|
| 373 | <p> This function does exactly the same as <a href="#ensureCurrentVisible">ensureCurrentVisible</a>()
 | 
|---|
| 374 | <p> <p>See also <a href="#ensureCurrentVisible">QListBox::ensureCurrentVisible</a>().
 | 
|---|
| 375 | 
 | 
|---|
| 376 | <h3 class=fn>void <a name="changeItem"></a>QListBox::changeItem ( const <a href="qlistboxitem.html">QListBoxItem</a> * lbi, int index )
 | 
|---|
| 377 | </h3>
 | 
|---|
| 378 | Replaces the item at position <em>index</em> with <em>lbi</em>. If <em>index</em> is
 | 
|---|
| 379 | negative or too large, <a href="#changeItem">changeItem</a>() does nothing.
 | 
|---|
| 380 | <p> The item that has been changed will become selected.
 | 
|---|
| 381 | <p> <p>See also <a href="#insertItem">insertItem</a>() and <a href="#removeItem">removeItem</a>().
 | 
|---|
| 382 | 
 | 
|---|
| 383 | <h3 class=fn>void <a name="changeItem-2"></a>QListBox::changeItem ( const <a href="qstring.html">QString</a> & text, int index )
 | 
|---|
| 384 | </h3>
 | 
|---|
| 385 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
 | 
|---|
| 386 | <p> Replaces the item at position <em>index</em> with a new list box text
 | 
|---|
| 387 | item with text <em>text</em>.
 | 
|---|
| 388 | <p> The operation is ignored if <em>index</em> is out of range.
 | 
|---|
| 389 | <p> <p>See also <a href="#insertItem">insertItem</a>() and <a href="#removeItem">removeItem</a>().
 | 
|---|
| 390 | 
 | 
|---|
| 391 | <h3 class=fn>void <a name="changeItem-3"></a>QListBox::changeItem ( const <a href="qpixmap.html">QPixmap</a> & pixmap, int index )
 | 
|---|
| 392 | </h3>
 | 
|---|
| 393 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
 | 
|---|
| 394 | <p> Replaces the item at position <em>index</em> with a new list box pixmap
 | 
|---|
| 395 | item with pixmap <em>pixmap</em>.
 | 
|---|
| 396 | <p> The operation is ignored if <em>index</em> is out of range.
 | 
|---|
| 397 | <p> <p>See also <a href="#insertItem">insertItem</a>() and <a href="#removeItem">removeItem</a>().
 | 
|---|
| 398 | 
 | 
|---|
| 399 | <h3 class=fn>void <a name="changeItem-4"></a>QListBox::changeItem ( const <a href="qpixmap.html">QPixmap</a> & pixmap, const <a href="qstring.html">QString</a> & text, int index )
 | 
|---|
| 400 | </h3>
 | 
|---|
| 401 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
 | 
|---|
| 402 | <p> Replaces the item at position <em>index</em> with a new list box pixmap
 | 
|---|
| 403 | item with pixmap <em>pixmap</em> and text <em>text</em>.
 | 
|---|
| 404 | <p> The operation is ignored if <em>index</em> is out of range.
 | 
|---|
| 405 | <p> <p>See also <a href="#insertItem">insertItem</a>() and <a href="#removeItem">removeItem</a>().
 | 
|---|
| 406 | 
 | 
|---|
| 407 | <h3 class=fn>void <a name="clear"></a>QListBox::clear ()<tt> [slot]</tt>
 | 
|---|
| 408 | </h3>
 | 
|---|
| 409 | Deletes all the items in the list.
 | 
|---|
| 410 | <p> <p>See also <a href="#removeItem">removeItem</a>().
 | 
|---|
| 411 | 
 | 
|---|
| 412 | <h3 class=fn>void <a name="clearSelection"></a>QListBox::clearSelection ()<tt> [virtual slot]</tt>
 | 
|---|
| 413 | </h3>
 | 
|---|
| 414 | Deselects all items, if possible.
 | 
|---|
| 415 | <p> Note that a <a href="#SelectionMode-enum">Single</a> selection list box will automatically select
 | 
|---|
| 416 | an item if it has <a href="focus.html#keyboard-focus">keyboard focus</a>.
 | 
|---|
| 417 | 
 | 
|---|
| 418 | <p>Example: <a href="listbox-example.html#x1432">listbox/listbox.cpp</a>.
 | 
|---|
| 419 | <h3 class=fn>void <a name="clicked"></a>QListBox::clicked ( <a href="qlistboxitem.html">QListBoxItem</a> * item )<tt> [signal]</tt>
 | 
|---|
| 420 | </h3>
 | 
|---|
| 421 | 
 | 
|---|
| 422 | <p> This signal is emitted when the user clicks any mouse button. If
 | 
|---|
| 423 | <em>item</em> is not 0, the cursor is on <em>item</em>. If <em>item</em> is 0, the
 | 
|---|
| 424 | mouse cursor isn't on any item.
 | 
|---|
| 425 | <p> Note that you must not delete any <a href="qlistboxitem.html">QListBoxItem</a> objects in slots
 | 
|---|
| 426 | connected to this signal.
 | 
|---|
| 427 | 
 | 
|---|
| 428 | <h3 class=fn>void <a name="clicked-2"></a>QListBox::clicked ( <a href="qlistboxitem.html">QListBoxItem</a> * item, const <a href="qpoint.html">QPoint</a> & pnt )<tt> [signal]</tt>
 | 
|---|
| 429 | </h3>
 | 
|---|
| 430 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
 | 
|---|
| 431 | <p> This signal is emitted when the user clicks any mouse button. If
 | 
|---|
| 432 | <em>item</em> is not 0, the cursor is on <em>item</em>. If <em>item</em> is 0, the
 | 
|---|
| 433 | mouse cursor isn't on any item.
 | 
|---|
| 434 | <p> <em>pnt</em> is the position of the mouse cursor in the global
 | 
|---|
| 435 | coordinate system (<a href="qmouseevent.html#globalPos">QMouseEvent::globalPos</a>()). (If the click's
 | 
|---|
| 436 | press and release differs by a pixel or two, <em>pnt</em> is the
 | 
|---|
| 437 | position at release time.)
 | 
|---|
| 438 | <p> Note that you must not delete any <a href="qlistboxitem.html">QListBoxItem</a> objects in slots
 | 
|---|
| 439 | connected to this signal.
 | 
|---|
| 440 | 
 | 
|---|
| 441 | <h3 class=fn><a href="qlistbox.html#LayoutMode-enum">LayoutMode</a> <a name="columnMode"></a>QListBox::columnMode () const
 | 
|---|
| 442 | </h3><p>Returns the column layout mode for this list box.
 | 
|---|
| 443 | See the <a href="qlistbox.html#columnMode-prop">"columnMode"</a> property for details.
 | 
|---|
| 444 | <h3 class=fn>void <a name="contextMenuRequested"></a>QListBox::contextMenuRequested ( <a href="qlistboxitem.html">QListBoxItem</a> * item, const <a href="qpoint.html">QPoint</a> & pos )<tt> [signal]</tt>
 | 
|---|
| 445 | </h3>
 | 
|---|
| 446 | 
 | 
|---|
| 447 | <p> This signal is emitted when the user invokes a context menu with
 | 
|---|
| 448 | the right mouse button or with special system keys, with <em>item</em>
 | 
|---|
| 449 | being the item under the mouse cursor or the current item,
 | 
|---|
| 450 | respectively.
 | 
|---|
| 451 | <p> <em>pos</em> is the position for the context menu in the global
 | 
|---|
| 452 | coordinate system.
 | 
|---|
| 453 | 
 | 
|---|
| 454 | <h3 class=fn>uint <a name="count"></a>QListBox::count () const
 | 
|---|
| 455 | </h3><p>Returns the number of items in the list box.
 | 
|---|
| 456 | See the <a href="qlistbox.html#count-prop">"count"</a> property for details.
 | 
|---|
| 457 | <h3 class=fn>void <a name="currentChanged"></a>QListBox::currentChanged ( <a href="qlistboxitem.html">QListBoxItem</a> * item )<tt> [signal]</tt>
 | 
|---|
| 458 | </h3>
 | 
|---|
| 459 | 
 | 
|---|
| 460 | <p> This signal is emitted when the user makes a new item the current
 | 
|---|
| 461 | item. <em>item</em> is the new current list box item.
 | 
|---|
| 462 | <p> <p>See also <a href="#currentItem-prop">currentItem</a> and <a href="#currentItem-prop">currentItem</a>.
 | 
|---|
| 463 | 
 | 
|---|
| 464 | <h3 class=fn>int <a name="currentItem"></a>QListBox::currentItem () const
 | 
|---|
| 465 | </h3><p>Returns the current highlighted item.
 | 
|---|
| 466 | See the <a href="qlistbox.html#currentItem-prop">"currentItem"</a> property for details.
 | 
|---|
| 467 | <h3 class=fn><a href="qstring.html">QString</a> <a name="currentText"></a>QListBox::currentText () const
 | 
|---|
| 468 | </h3><p>Returns the text of the current item.
 | 
|---|
| 469 | See the <a href="qlistbox.html#currentText-prop">"currentText"</a> property for details.
 | 
|---|
| 470 | <h3 class=fn>void <a name="doLayout"></a>QListBox::doLayout () const<tt> [protected]</tt>
 | 
|---|
| 471 | </h3>
 | 
|---|
| 472 | This function does the hard layout work. You should never need to
 | 
|---|
| 473 | call it.
 | 
|---|
| 474 | 
 | 
|---|
| 475 | <h3 class=fn>void <a name="doubleClicked"></a>QListBox::doubleClicked ( <a href="qlistboxitem.html">QListBoxItem</a> * item )<tt> [signal]</tt>
 | 
|---|
| 476 | </h3>
 | 
|---|
| 477 | 
 | 
|---|
| 478 | <p> This signal is emitted whenever an item is double-clicked. It's
 | 
|---|
| 479 | emitted on the second button press, not the second button release.
 | 
|---|
| 480 | If <em>item</em> is not 0, the cursor is on <em>item</em>. If <em>item</em> is 0,
 | 
|---|
| 481 | the mouse cursor isn't on any item.
 | 
|---|
| 482 | 
 | 
|---|
| 483 | <h3 class=fn>void <a name="ensureCurrentVisible"></a>QListBox::ensureCurrentVisible ()<tt> [virtual slot]</tt>
 | 
|---|
| 484 | </h3>
 | 
|---|
| 485 | Ensures that the current item is visible.
 | 
|---|
| 486 | 
 | 
|---|
| 487 | <h3 class=fn><a href="qlistboxitem.html">QListBoxItem</a> * <a name="findItem"></a>QListBox::findItem ( const <a href="qstring.html">QString</a> & text, ComparisonFlags compare = BeginsWith ) const
 | 
|---|
| 488 | </h3>
 | 
|---|
| 489 | Finds the first list box item that has the text <em>text</em> and
 | 
|---|
| 490 | returns it, or returns 0 of no such item could be found.
 | 
|---|
| 491 | The search starts from the current item if the current item exists,
 | 
|---|
| 492 | otherwise it starts from the first list box item.
 | 
|---|
| 493 | If <tt>ComparisonFlags</tt> are specified in <em>compare</em> then these flags
 | 
|---|
| 494 | are used, otherwise the default is a case-insensitive, "begins
 | 
|---|
| 495 | with" search.
 | 
|---|
| 496 | <p> <p>See also <a href="qt.html#StringComparisonMode-enum">Qt::StringComparisonMode</a>.
 | 
|---|
| 497 | 
 | 
|---|
| 498 | <h3 class=fn>int <a name="findItem-2"></a>QListBox::findItem ( int yPos ) const<tt> [protected]</tt>
 | 
|---|
| 499 | </h3>
 | 
|---|
| 500 | <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
 | 
|---|
| 501 | <p> 
 | 
|---|
| 502 | Returns the index of the item a point (0, <em>yPos</em>).
 | 
|---|
| 503 | <p>See also <a href="#index">index</a>() and <a href="#itemAt">itemAt</a>().
 | 
|---|
| 504 | 
 | 
|---|
| 505 | <h3 class=fn><a href="qlistboxitem.html">QListBoxItem</a> * <a name="firstItem"></a>QListBox::firstItem () const
 | 
|---|
| 506 | </h3>
 | 
|---|
| 507 | Returns the first item in this list box. If the list box is empty,
 | 
|---|
| 508 | returns 0.
 | 
|---|
| 509 | 
 | 
|---|
| 510 | <h3 class=fn>void <a name="highlighted"></a>QListBox::highlighted ( int index )<tt> [signal]</tt>
 | 
|---|
| 511 | </h3>
 | 
|---|
| 512 | 
 | 
|---|
| 513 | <p> This signal is emitted when the user makes a new item the current
 | 
|---|
| 514 | item. <em>index</em> is the index of the new current item.
 | 
|---|
| 515 | <p> <p>See also <a href="#currentChanged">currentChanged</a>(), <a href="#selected">selected</a>(), <a href="#currentItem-prop">currentItem</a>, and <a href="#selectionChanged">selectionChanged</a>().
 | 
|---|
| 516 | 
 | 
|---|
| 517 | <h3 class=fn>void <a name="highlighted-2"></a>QListBox::highlighted ( const <a href="qstring.html">QString</a> & )<tt> [signal]</tt>
 | 
|---|
| 518 | </h3>
 | 
|---|
| 519 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
 | 
|---|
| 520 | <p> This signal is emitted when the user makes a new item the current
 | 
|---|
| 521 | item and the item is (or has) a string. The argument is the text
 | 
|---|
| 522 | of the new current item.
 | 
|---|
| 523 | <p> <p>See also <a href="#currentChanged">currentChanged</a>(), <a href="#selected">selected</a>(), <a href="#currentItem-prop">currentItem</a>, and <a href="#selectionChanged">selectionChanged</a>().
 | 
|---|
| 524 | 
 | 
|---|
| 525 | <h3 class=fn>void <a name="highlighted-3"></a>QListBox::highlighted ( <a href="qlistboxitem.html">QListBoxItem</a> * )<tt> [signal]</tt>
 | 
|---|
| 526 | </h3>
 | 
|---|
| 527 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
 | 
|---|
| 528 | <p> This signal is emitted when the user makes a new item the current
 | 
|---|
| 529 | item. The argument is a pointer to the new current item.
 | 
|---|
| 530 | <p> <p>See also <a href="#currentChanged">currentChanged</a>(), <a href="#selected">selected</a>(), <a href="#currentItem-prop">currentItem</a>, and <a href="#selectionChanged">selectionChanged</a>().
 | 
|---|
| 531 | 
 | 
|---|
| 532 | <h3 class=fn>int <a name="inSort"></a>QListBox::inSort ( const <a href="qlistboxitem.html">QListBoxItem</a> * lbi )
 | 
|---|
| 533 | </h3>
 | 
|---|
| 534 | <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
 | 
|---|
| 535 | <p> Using this method is quite inefficient. We suggest to use <a href="#insertItem">insertItem</a>()
 | 
|---|
| 536 | for inserting and <a href="#sort">sort</a>() afterwards.
 | 
|---|
| 537 | <p> Inserts <em>lbi</em> at its sorted position in the list box and returns the
 | 
|---|
| 538 | position.
 | 
|---|
| 539 | <p> All items must be inserted with <a href="#inSort">inSort</a>() to maintain the sorting
 | 
|---|
| 540 | order. inSort() treats any pixmap (or user-defined type) as
 | 
|---|
| 541 | lexicographically less than any string.
 | 
|---|
| 542 | <p> <p>See also <a href="#insertItem">insertItem</a>() and <a href="#sort">sort</a>().
 | 
|---|
| 543 | 
 | 
|---|
| 544 | <h3 class=fn>int <a name="inSort-2"></a>QListBox::inSort ( const <a href="qstring.html">QString</a> & text )
 | 
|---|
| 545 | </h3>
 | 
|---|
| 546 | <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
 | 
|---|
| 547 | <p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
 | 
|---|
| 548 | <p> Using this method is quite inefficient. We suggest to use <a href="#insertItem">insertItem</a>()
 | 
|---|
| 549 | for inserting and <a href="#sort">sort</a>() afterwards.
 | 
|---|
| 550 | <p> Inserts a new item of <em>text</em> at its sorted position in the list box and
 | 
|---|
| 551 | returns the position.
 | 
|---|
| 552 | <p> All items must be inserted with <a href="#inSort">inSort</a>() to maintain the sorting
 | 
|---|
| 553 | order. inSort() treats any pixmap (or user-defined type) as
 | 
|---|
| 554 | lexicographically less than any string.
 | 
|---|
| 555 | <p> <p>See also <a href="#insertItem">insertItem</a>() and <a href="#sort">sort</a>().
 | 
|---|
| 556 | 
 | 
|---|
| 557 | <h3 class=fn>int <a name="index"></a>QListBox::index ( const <a href="qlistboxitem.html">QListBoxItem</a> * lbi ) const
 | 
|---|
| 558 | </h3>
 | 
|---|
| 559 | Returns the index of <em>lbi</em>, or -1 if the item is not in this list
 | 
|---|
| 560 | box or <em>lbi</em> is 0.
 | 
|---|
| 561 | <p> <p>See also <a href="#item">item</a>().
 | 
|---|
| 562 | 
 | 
|---|
| 563 | <h3 class=fn>void <a name="insertItem"></a>QListBox::insertItem ( const <a href="qlistboxitem.html">QListBoxItem</a> * lbi, int index = -1 )
 | 
|---|
| 564 | </h3>
 | 
|---|
| 565 | Inserts the item <em>lbi</em> into the list at position <em>index</em>.
 | 
|---|
| 566 | <p> If <em>index</em> is negative or larger than the number of items in the
 | 
|---|
| 567 | list box, <em>lbi</em> is inserted at the end of the list.
 | 
|---|
| 568 | <p> <p>See also <a href="#insertStrList">insertStrList</a>().
 | 
|---|
| 569 | 
 | 
|---|
| 570 | <p>Examples: <a href="i18n-example.html#x1925">i18n/mywidget.cpp</a>, <a href="listbox-example.html#x1433">listbox/listbox.cpp</a>, <a href="listboxcombo-example.html#x1406">listboxcombo/listboxcombo.cpp</a>, and <a href="tabdialog-example.html#x55">tabdialog/tabdialog.cpp</a>.
 | 
|---|
| 571 | <h3 class=fn>void <a name="insertItem-2"></a>QListBox::insertItem ( const <a href="qlistboxitem.html">QListBoxItem</a> * lbi, const <a href="qlistboxitem.html">QListBoxItem</a> * after )
 | 
|---|
| 572 | </h3>
 | 
|---|
| 573 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
 | 
|---|
| 574 | <p> Inserts the item <em>lbi</em> into the list after the item <em>after</em>, or
 | 
|---|
| 575 | at the beginning if <em>after</em> is 0.
 | 
|---|
| 576 | <p> <p>See also <a href="#insertStrList">insertStrList</a>().
 | 
|---|
| 577 | 
 | 
|---|
| 578 | <h3 class=fn>void <a name="insertItem-3"></a>QListBox::insertItem ( const <a href="qstring.html">QString</a> & text, int index = -1 )
 | 
|---|
| 579 | </h3>
 | 
|---|
| 580 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
 | 
|---|
| 581 | <p> Inserts a new list box text item with the text <em>text</em> into the
 | 
|---|
| 582 | list at position <em>index</em>.
 | 
|---|
| 583 | <p> If <em>index</em> is negative, <em>text</em> is inserted at the end of the
 | 
|---|
| 584 | list.
 | 
|---|
| 585 | <p> <p>See also <a href="#insertStrList">insertStrList</a>().
 | 
|---|
| 586 | 
 | 
|---|
| 587 | <h3 class=fn>void <a name="insertItem-4"></a>QListBox::insertItem ( const <a href="qpixmap.html">QPixmap</a> & pixmap, int index = -1 )
 | 
|---|
| 588 | </h3>
 | 
|---|
| 589 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
 | 
|---|
| 590 | <p> Inserts a new list box pixmap item with the pixmap <em>pixmap</em> into
 | 
|---|
| 591 | the list at position <em>index</em>.
 | 
|---|
| 592 | <p> If <em>index</em> is negative, <em>pixmap</em> is inserted at the end of the
 | 
|---|
| 593 | list.
 | 
|---|
| 594 | <p> <p>See also <a href="#insertStrList">insertStrList</a>().
 | 
|---|
| 595 | 
 | 
|---|
| 596 | <h3 class=fn>void <a name="insertItem-5"></a>QListBox::insertItem ( const <a href="qpixmap.html">QPixmap</a> & pixmap, const <a href="qstring.html">QString</a> & text, int index = -1 )
 | 
|---|
| 597 | </h3>
 | 
|---|
| 598 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
 | 
|---|
| 599 | <p> Inserts a new list box pixmap item with the pixmap <em>pixmap</em> and
 | 
|---|
| 600 | the text <em>text</em> into the list at position <em>index</em>.
 | 
|---|
| 601 | <p> If <em>index</em> is negative, <em>pixmap</em> is inserted at the end of the
 | 
|---|
| 602 | list.
 | 
|---|
| 603 | <p> <p>See also <a href="#insertStrList">insertStrList</a>().
 | 
|---|
| 604 | 
 | 
|---|
| 605 | <h3 class=fn>void <a name="insertStrList"></a>QListBox::insertStrList ( const <a href="qstrlist.html">QStrList</a> * list, int index = -1 )
 | 
|---|
| 606 | </h3>
 | 
|---|
| 607 | Inserts the string list <em>list</em> into the list at position <em>index</em>.
 | 
|---|
| 608 | <p> If <em>index</em> is negative, <em>list</em> is inserted at the end of the
 | 
|---|
| 609 | list. If <em>index</em> is too large, the operation is ignored.
 | 
|---|
| 610 | <p> <b>Warning:</b> This function uses <tt>const char *</tt> rather than <a href="qstring.html">QString</a>,
 | 
|---|
| 611 | so we recommend against using it. It is provided so that legacy
 | 
|---|
| 612 | code will continue to work, and so that programs that certainly
 | 
|---|
| 613 | will not need to handle code outside a single 8-bit locale can use
 | 
|---|
| 614 | it. See <a href="#insertStringList">insertStringList</a>() which uses real QStrings.
 | 
|---|
| 615 | <p> <b>Warning:</b> This function is never significantly faster than a loop
 | 
|---|
| 616 | around <a href="#insertItem">insertItem</a>().
 | 
|---|
| 617 | <p> <p>See also <a href="#insertItem">insertItem</a>() and <a href="#insertStringList">insertStringList</a>().
 | 
|---|
| 618 | 
 | 
|---|
| 619 | <h3 class=fn>void <a name="insertStrList-2"></a>QListBox::insertStrList ( const <a href="qstrlist.html">QStrList</a> & list, int index = -1 )
 | 
|---|
| 620 | </h3>
 | 
|---|
| 621 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
 | 
|---|
| 622 | <p> Inserts the string list <em>list</em> into the list at position <em>index</em>.
 | 
|---|
| 623 | <p> If <em>index</em> is negative, <em>list</em> is inserted at the end of the
 | 
|---|
| 624 | list. If <em>index</em> is too large, the operation is ignored.
 | 
|---|
| 625 | <p> <b>Warning:</b> This function uses <tt>const char *</tt> rather than <a href="qstring.html">QString</a>,
 | 
|---|
| 626 | so we recommend against using it. It is provided so that legacy
 | 
|---|
| 627 | code will continue to work, and so that programs that certainly
 | 
|---|
| 628 | will not need to handle code outside a single 8-bit locale can use
 | 
|---|
| 629 | it. See <a href="#insertStringList">insertStringList</a>() which uses real QStrings.
 | 
|---|
| 630 | <p> <b>Warning:</b> This function is never significantly faster than a loop
 | 
|---|
| 631 | around <a href="#insertItem">insertItem</a>().
 | 
|---|
| 632 | <p> <p>See also <a href="#insertItem">insertItem</a>() and <a href="#insertStringList">insertStringList</a>().
 | 
|---|
| 633 | 
 | 
|---|
| 634 | <h3 class=fn>void <a name="insertStrList-3"></a>QListBox::insertStrList ( const char ** strings, int numStrings = -1, int index = -1 )
 | 
|---|
| 635 | </h3>
 | 
|---|
| 636 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
 | 
|---|
| 637 | <p> Inserts the <em>numStrings</em> strings of the array <em>strings</em> into the
 | 
|---|
| 638 | list at position <em>index</em>.
 | 
|---|
| 639 | <p> If <em>index</em> is negative, <a href="#insertStrList">insertStrList</a>() inserts <em>strings</em> at the
 | 
|---|
| 640 | end of the list. If <em>index</em> is too large, the operation is
 | 
|---|
| 641 | ignored.
 | 
|---|
| 642 | <p> <b>Warning:</b> This function uses <tt>const char *</tt> rather than <a href="qstring.html">QString</a>,
 | 
|---|
| 643 | so we recommend against using it. It is provided so that legacy
 | 
|---|
| 644 | code will continue to work, and so that programs that certainly
 | 
|---|
| 645 | will not need to handle code outside a single 8-bit locale can use
 | 
|---|
| 646 | it. See <a href="#insertStringList">insertStringList</a>() which uses real QStrings.
 | 
|---|
| 647 | <p> <b>Warning:</b> This function is never significantly faster than a loop
 | 
|---|
| 648 | around <a href="#insertItem">insertItem</a>().
 | 
|---|
| 649 | <p> <p>See also <a href="#insertItem">insertItem</a>() and <a href="#insertStringList">insertStringList</a>().
 | 
|---|
| 650 | 
 | 
|---|
| 651 | <h3 class=fn>void <a name="insertStringList"></a>QListBox::insertStringList ( const <a href="qstringlist.html">QStringList</a> & list, int index = -1 )
 | 
|---|
| 652 | </h3>
 | 
|---|
| 653 | Inserts the string list <em>list</em> into the list at position <em>index</em>.
 | 
|---|
| 654 | <p> If <em>index</em> is negative, <em>list</em> is inserted at the end of the
 | 
|---|
| 655 | list. If <em>index</em> is too large, the operation is ignored.
 | 
|---|
| 656 | <p> <b>Warning:</b> This function is never significantly faster than a loop
 | 
|---|
| 657 | around <a href="#insertItem">insertItem</a>().
 | 
|---|
| 658 | <p> <p>See also <a href="#insertItem">insertItem</a>() and <a href="#insertStrList">insertStrList</a>().
 | 
|---|
| 659 | 
 | 
|---|
| 660 | <h3 class=fn>void <a name="invertSelection"></a>QListBox::invertSelection ()<tt> [virtual slot]</tt>
 | 
|---|
| 661 | </h3>
 | 
|---|
| 662 | Inverts the selection. Only works in <a href="#SelectionMode-enum">Multi</a> and <a href="#SelectionMode-enum">Extended</a>
 | 
|---|
| 663 | selection mode.
 | 
|---|
| 664 | 
 | 
|---|
| 665 | <h3 class=fn>bool <a name="isMultiSelection"></a>QListBox::isMultiSelection () const
 | 
|---|
| 666 | </h3><p>Returns TRUE if or not the list box is in Multi selection mode; otherwise returns FALSE.
 | 
|---|
| 667 | See the <a href="qlistbox.html#multiSelection-prop">"multiSelection"</a> property for details.
 | 
|---|
| 668 | <h3 class=fn>bool <a name="isRubberSelecting"></a>QListBox::isRubberSelecting () const<tt> [protected]</tt>
 | 
|---|
| 669 | </h3>
 | 
|---|
| 670 | Returns TRUE if the user is selecting items using a rubber band
 | 
|---|
| 671 | rectangle; otherwise returns FALSE.
 | 
|---|
| 672 | 
 | 
|---|
| 673 | <h3 class=fn>bool <a name="isSelected"></a>QListBox::isSelected ( int i ) const
 | 
|---|
| 674 | </h3>
 | 
|---|
| 675 | Returns TRUE if item <em>i</em> is selected; otherwise returns FALSE.
 | 
|---|
| 676 | 
 | 
|---|
| 677 | <h3 class=fn>bool <a name="isSelected-2"></a>QListBox::isSelected ( const <a href="qlistboxitem.html">QListBoxItem</a> * i ) const
 | 
|---|
| 678 | </h3>
 | 
|---|
| 679 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
 | 
|---|
| 680 | <p> Returns TRUE if item <em>i</em> is selected; otherwise returns FALSE.
 | 
|---|
| 681 | 
 | 
|---|
| 682 | <h3 class=fn><a href="qlistboxitem.html">QListBoxItem</a> * <a name="item"></a>QListBox::item ( int index ) const
 | 
|---|
| 683 | </h3>
 | 
|---|
| 684 | Returns a pointer to the item at position <em>index</em>, or 0 if <em>index</em> is out of bounds.
 | 
|---|
| 685 | <p> <p>See also <a href="#index">index</a>().
 | 
|---|
| 686 | 
 | 
|---|
| 687 | <p>Example: <a href="listboxcombo-example.html#x1407">listboxcombo/listboxcombo.cpp</a>.
 | 
|---|
| 688 | <h3 class=fn><a href="qlistboxitem.html">QListBoxItem</a> * <a name="itemAt"></a>QListBox::itemAt ( const <a href="qpoint.html">QPoint</a> & p ) const
 | 
|---|
| 689 | </h3>
 | 
|---|
| 690 | Returns the item at point <em>p</em>, specified in viewport coordinates,
 | 
|---|
| 691 | or a 0 if there is no item at <em>p</em>.
 | 
|---|
| 692 | <p> Use <a href="qscrollview.html#contentsToViewport">contentsToViewport</a>() to convert between widget coordinates and
 | 
|---|
| 693 | viewport coordinates.
 | 
|---|
| 694 | 
 | 
|---|
| 695 | <h3 class=fn>int <a name="itemHeight"></a>QListBox::itemHeight ( int index = 0 ) const
 | 
|---|
| 696 | </h3>
 | 
|---|
| 697 | Returns the height in pixels of the item with index <em>index</em>. <em>index</em> defaults to 0.
 | 
|---|
| 698 | <p> If <em>index</em> is too large, this function returns 0.
 | 
|---|
| 699 | 
 | 
|---|
| 700 | <h3 class=fn><a href="qrect.html">QRect</a> <a name="itemRect"></a>QListBox::itemRect ( <a href="qlistboxitem.html">QListBoxItem</a> * item ) const
 | 
|---|
| 701 | </h3>
 | 
|---|
| 702 | Returns the rectangle on the screen that <em>item</em> occupies in
 | 
|---|
| 703 | <a href="qscrollview.html#viewport">viewport</a>()'s coordinates, or an invalid rectangle if <em>item</em> is 0
 | 
|---|
| 704 | or is not currently visible.
 | 
|---|
| 705 | 
 | 
|---|
| 706 | <h3 class=fn>bool <a name="itemVisible"></a>QListBox::itemVisible ( int index )
 | 
|---|
| 707 | </h3>
 | 
|---|
| 708 | Returns TRUE if the item at position <em>index</em> is at least partly
 | 
|---|
| 709 | visible; otherwise returns FALSE.
 | 
|---|
| 710 | 
 | 
|---|
| 711 | <h3 class=fn>bool <a name="itemVisible-2"></a>QListBox::itemVisible ( const <a href="qlistboxitem.html">QListBoxItem</a> * item )
 | 
|---|
| 712 | </h3>
 | 
|---|
| 713 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
 | 
|---|
| 714 | <p> Returns TRUE if <em>item</em> is at least partly visible; otherwise
 | 
|---|
| 715 | returns FALSE.
 | 
|---|
| 716 | 
 | 
|---|
| 717 | <h3 class=fn>bool <a name="itemYPos"></a>QListBox::itemYPos ( int index, int * yPos ) const<tt> [protected]</tt>
 | 
|---|
| 718 | </h3>
 | 
|---|
| 719 | <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
 | 
|---|
| 720 | <p> Returns the vertical pixel-coordinate in <em>*yPos</em>, of the list box
 | 
|---|
| 721 | item at position <em>index</em> in the list. Returns FALSE if the item is
 | 
|---|
| 722 | outside the visible area.
 | 
|---|
| 723 | 
 | 
|---|
| 724 | <h3 class=fn>long <a name="maxItemWidth"></a>QListBox::maxItemWidth () const
 | 
|---|
| 725 | </h3>
 | 
|---|
| 726 | Returns the width of the widest item in the list box.
 | 
|---|
| 727 | 
 | 
|---|
| 728 | <h3 class=fn>void <a name="mouseButtonClicked"></a>QListBox::mouseButtonClicked ( int button, <a href="qlistboxitem.html">QListBoxItem</a> * item, const <a href="qpoint.html">QPoint</a> & pos )<tt> [signal]</tt>
 | 
|---|
| 729 | </h3>
 | 
|---|
| 730 | 
 | 
|---|
| 731 | <p> This signal is emitted when the user clicks mouse button <em>button</em>. If <em>item</em> is not 0, the cursor is on <em>item</em>. If <em>item</em>
 | 
|---|
| 732 | is 0, the mouse cursor isn't on any item.
 | 
|---|
| 733 | <p> <em>pos</em> is the position of the mouse cursor in the global
 | 
|---|
| 734 | coordinate system (<a href="qmouseevent.html#globalPos">QMouseEvent::globalPos</a>()). (If the click's
 | 
|---|
| 735 | press and release differs by a pixel or two, <em>pos</em> is the
 | 
|---|
| 736 | position at release time.)
 | 
|---|
| 737 | <p> Note that you must not delete any <a href="qlistboxitem.html">QListBoxItem</a> objects in slots
 | 
|---|
| 738 | connected to this signal.
 | 
|---|
| 739 | 
 | 
|---|
| 740 | <h3 class=fn>void <a name="mouseButtonPressed"></a>QListBox::mouseButtonPressed ( int button, <a href="qlistboxitem.html">QListBoxItem</a> * item, const <a href="qpoint.html">QPoint</a> & pos )<tt> [signal]</tt>
 | 
|---|
| 741 | </h3>
 | 
|---|
| 742 | 
 | 
|---|
| 743 | <p> This signal is emitted when the user presses mouse button <em>button</em>. If <em>item</em> is not 0, the cursor is on <em>item</em>. If <em>item</em>
 | 
|---|
| 744 | is 0, the mouse cursor isn't on any item.
 | 
|---|
| 745 | <p> <em>pos</em> is the position of the mouse cursor in the global
 | 
|---|
| 746 | coordinate system (<a href="qmouseevent.html#globalPos">QMouseEvent::globalPos</a>()).
 | 
|---|
| 747 | <p> Note that you must not delete any <a href="qlistboxitem.html">QListBoxItem</a> objects in slots
 | 
|---|
| 748 | connected to this signal.
 | 
|---|
| 749 | 
 | 
|---|
| 750 | <h3 class=fn>int <a name="numCols"></a>QListBox::numCols () const
 | 
|---|
| 751 | </h3>
 | 
|---|
| 752 | <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
 | 
|---|
| 753 | <p> 
 | 
|---|
| 754 | Returns the number of columns.
 | 
|---|
| 755 | <p>See also <a href="#numColumns-prop">numColumns</a>.
 | 
|---|
| 756 | 
 | 
|---|
| 757 | <h3 class=fn>int <a name="numColumns"></a>QListBox::numColumns () const
 | 
|---|
| 758 | </h3><p>Returns the number of columns in the list box.
 | 
|---|
| 759 | See the <a href="qlistbox.html#numColumns-prop">"numColumns"</a> property for details.
 | 
|---|
| 760 | <h3 class=fn>int <a name="numItemsVisible"></a>QListBox::numItemsVisible () const
 | 
|---|
| 761 | </h3><p>Returns the number of visible items.
 | 
|---|
| 762 | See the <a href="qlistbox.html#numItemsVisible-prop">"numItemsVisible"</a> property for details.
 | 
|---|
| 763 | <h3 class=fn>int <a name="numRows"></a>QListBox::numRows () const
 | 
|---|
| 764 | </h3><p>Returns the number of rows in the list box.
 | 
|---|
| 765 | See the <a href="qlistbox.html#numRows-prop">"numRows"</a> property for details.
 | 
|---|
| 766 | <h3 class=fn>void <a name="onItem"></a>QListBox::onItem ( <a href="qlistboxitem.html">QListBoxItem</a> * i )<tt> [signal]</tt>
 | 
|---|
| 767 | </h3>
 | 
|---|
| 768 | 
 | 
|---|
| 769 | <p> This signal is emitted when the user moves the mouse cursor onto
 | 
|---|
| 770 | an item, similar to the <a href="qwidget.html#enterEvent">QWidget::enterEvent</a>() function. <em>i</em> is
 | 
|---|
| 771 | the <a href="qlistboxitem.html">QListBoxItem</a> that the mouse has moved on.
 | 
|---|
| 772 | 
 | 
|---|
| 773 | <h3 class=fn>void <a name="onViewport"></a>QListBox::onViewport ()<tt> [signal]</tt>
 | 
|---|
| 774 | </h3>
 | 
|---|
| 775 | 
 | 
|---|
| 776 | <p> This signal is emitted when the user moves the mouse cursor from
 | 
|---|
| 777 | an item to an empty part of the list box.
 | 
|---|
| 778 | 
 | 
|---|
| 779 | <h3 class=fn>void <a name="paintCell"></a>QListBox::paintCell ( <a href="qpainter.html">QPainter</a> * p, int row, int col )<tt> [virtual protected]</tt>
 | 
|---|
| 780 | </h3>
 | 
|---|
| 781 | Provided for compatibility with the old QListBox. We recommend
 | 
|---|
| 782 | using <a href="qlistboxitem.html#paint">QListBoxItem::paint</a>() instead.
 | 
|---|
| 783 | <p> Repaints the cell at <em>row</em>, <em>col</em> using painter <em>p</em>.
 | 
|---|
| 784 | 
 | 
|---|
| 785 | <h3 class=fn>const <a href="qpixmap.html">QPixmap</a> * <a name="pixmap"></a>QListBox::pixmap ( int index ) const
 | 
|---|
| 786 | </h3>
 | 
|---|
| 787 | Returns a pointer to the pixmap at position <em>index</em>, or 0 if
 | 
|---|
| 788 | there is no pixmap there.
 | 
|---|
| 789 | <p> <p>See also <a href="#text">text</a>().
 | 
|---|
| 790 | 
 | 
|---|
| 791 | <h3 class=fn>void <a name="pressed"></a>QListBox::pressed ( <a href="qlistboxitem.html">QListBoxItem</a> * item )<tt> [signal]</tt>
 | 
|---|
| 792 | </h3>
 | 
|---|
| 793 | 
 | 
|---|
| 794 | <p> This signal is emitted when the user presses any mouse button. If
 | 
|---|
| 795 | <em>item</em> is not 0, the cursor is on <em>item</em>. If <em>item</em> is 0, the
 | 
|---|
| 796 | mouse cursor isn't on any item.
 | 
|---|
| 797 | <p> Note that you must not delete any <a href="qlistboxitem.html">QListBoxItem</a> objects in slots
 | 
|---|
| 798 | connected to this signal.
 | 
|---|
| 799 | 
 | 
|---|
| 800 | <h3 class=fn>void <a name="pressed-2"></a>QListBox::pressed ( <a href="qlistboxitem.html">QListBoxItem</a> * item, const <a href="qpoint.html">QPoint</a> & pnt )<tt> [signal]</tt>
 | 
|---|
| 801 | </h3>
 | 
|---|
| 802 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
 | 
|---|
| 803 | <p> This signal is emitted when the user presses any mouse button. If
 | 
|---|
| 804 | <em>item</em> is not 0, the cursor is on <em>item</em>. If <em>item</em> is 0, the
 | 
|---|
| 805 | mouse cursor isn't on any item.
 | 
|---|
| 806 | <p> <em>pnt</em> is the position of the mouse cursor in the global
 | 
|---|
| 807 | coordinate system (<a href="qmouseevent.html#globalPos">QMouseEvent::globalPos</a>()).
 | 
|---|
| 808 | <p> Note that you must not delete any <a href="qlistboxitem.html">QListBoxItem</a> objects in slots
 | 
|---|
| 809 | connected to this signal.
 | 
|---|
| 810 | <p> <p>See also <a href="#mouseButtonPressed">mouseButtonPressed</a>(), <a href="#rightButtonPressed">rightButtonPressed</a>(), and <a href="#clicked">clicked</a>().
 | 
|---|
| 811 | 
 | 
|---|
| 812 | <h3 class=fn>void <a name="removeItem"></a>QListBox::removeItem ( int index )
 | 
|---|
| 813 | </h3>
 | 
|---|
| 814 | Removes and deletes the item at position <em>index</em>. If <em>index</em> is
 | 
|---|
| 815 | equal to <a href="#currentItem">currentItem</a>(), a new item becomes current and the
 | 
|---|
| 816 | <a href="#currentChanged">currentChanged</a>() and <a href="#highlighted">highlighted</a>() signals are emitted.
 | 
|---|
| 817 | <p> <p>See also <a href="#insertItem">insertItem</a>() and <a href="#clear">clear</a>().
 | 
|---|
| 818 | 
 | 
|---|
| 819 | <h3 class=fn>void <a name="returnPressed"></a>QListBox::returnPressed ( <a href="qlistboxitem.html">QListBoxItem</a> * )<tt> [signal]</tt>
 | 
|---|
| 820 | </h3>
 | 
|---|
| 821 | 
 | 
|---|
| 822 | <p> This signal is emitted when Enter or Return is pressed. The
 | 
|---|
| 823 | argument is <a href="#currentItem">currentItem</a>().
 | 
|---|
| 824 | 
 | 
|---|
| 825 | <h3 class=fn>void <a name="rightButtonClicked"></a>QListBox::rightButtonClicked ( <a href="qlistboxitem.html">QListBoxItem</a> *, const <a href="qpoint.html">QPoint</a> & )<tt> [signal]</tt>
 | 
|---|
| 826 | </h3>
 | 
|---|
| 827 | 
 | 
|---|
| 828 | <p> This signal is emitted when the right button is clicked (i.e. when
 | 
|---|
| 829 | it's released at the same point where it was pressed). The
 | 
|---|
| 830 | arguments are the relevant <a href="qlistboxitem.html">QListBoxItem</a> (may be 0) and the point
 | 
|---|
| 831 | in global coordinates.
 | 
|---|
| 832 | 
 | 
|---|
| 833 | <h3 class=fn>void <a name="rightButtonPressed"></a>QListBox::rightButtonPressed ( <a href="qlistboxitem.html">QListBoxItem</a> *, const <a href="qpoint.html">QPoint</a> & )<tt> [signal]</tt>
 | 
|---|
| 834 | </h3>
 | 
|---|
| 835 | 
 | 
|---|
| 836 | <p> This signal is emitted when the right button is pressed. The
 | 
|---|
| 837 | arguments are the relevant <a href="qlistboxitem.html">QListBoxItem</a> (may be 0) and the point
 | 
|---|
| 838 | in global coordinates.
 | 
|---|
| 839 | 
 | 
|---|
| 840 | <h3 class=fn><a href="qlistbox.html#LayoutMode-enum">LayoutMode</a> <a name="rowMode"></a>QListBox::rowMode () const
 | 
|---|
| 841 | </h3><p>Returns the row layout mode for this list box.
 | 
|---|
| 842 | See the <a href="qlistbox.html#rowMode-prop">"rowMode"</a> property for details.
 | 
|---|
| 843 | <h3 class=fn>bool <a name="scrollBar"></a>QListBox::scrollBar () const
 | 
|---|
| 844 | </h3>
 | 
|---|
| 845 | 
 | 
|---|
| 846 | <p> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
 | 
|---|
| 847 | <p> Returns FALSE if <a href="qscrollview.html#vScrollBarMode">vScrollBarMode</a>() is <a href="qscrollview.html#ScrollBarMode-enum">AlwaysOff</a>; otherwise
 | 
|---|
| 848 | returns TRUE.
 | 
|---|
| 849 | 
 | 
|---|
| 850 | <h3 class=fn>void <a name="selectAll"></a>QListBox::selectAll ( bool select )<tt> [virtual slot]</tt>
 | 
|---|
| 851 | </h3>
 | 
|---|
| 852 | In <a href="#SelectionMode-enum">Multi</a> and <a href="#SelectionMode-enum">Extended</a> modes, this function sets all items to
 | 
|---|
| 853 | be selected if <em>select</em> is TRUE, and to be unselected if <em>select</em> is FALSE.
 | 
|---|
| 854 | <p> In <a href="#SelectionMode-enum">Single</a> and <a href="#SelectionMode-enum">NoSelection</a> modes, this function only changes
 | 
|---|
| 855 | the selection status of <a href="#currentItem">currentItem</a>().
 | 
|---|
| 856 | 
 | 
|---|
| 857 | <h3 class=fn>void <a name="selected"></a>QListBox::selected ( int index )<tt> [signal]</tt>
 | 
|---|
| 858 | </h3>
 | 
|---|
| 859 | 
 | 
|---|
| 860 | <p> This signal is emitted when the user double-clicks on an item or
 | 
|---|
| 861 | presses Enter on the current item. <em>index</em> is the index of the
 | 
|---|
| 862 | selected item.
 | 
|---|
| 863 | <p> <p>See also <a href="#currentChanged">currentChanged</a>(), <a href="#highlighted">highlighted</a>(), and <a href="#selectionChanged">selectionChanged</a>().
 | 
|---|
| 864 | 
 | 
|---|
| 865 | <h3 class=fn>void <a name="selected-2"></a>QListBox::selected ( const <a href="qstring.html">QString</a> & )<tt> [signal]</tt>
 | 
|---|
| 866 | </h3>
 | 
|---|
| 867 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
 | 
|---|
| 868 | <p> This signal is emitted when the user double-clicks on an item or
 | 
|---|
| 869 | presses Enter on the current item, and the item is (or has) a
 | 
|---|
| 870 | string. The argument is the text of the selected item.
 | 
|---|
| 871 | <p> <p>See also <a href="#currentChanged">currentChanged</a>(), <a href="#highlighted">highlighted</a>(), and <a href="#selectionChanged">selectionChanged</a>().
 | 
|---|
| 872 | 
 | 
|---|
| 873 | <h3 class=fn>void <a name="selected-3"></a>QListBox::selected ( <a href="qlistboxitem.html">QListBoxItem</a> * )<tt> [signal]</tt>
 | 
|---|
| 874 | </h3>
 | 
|---|
| 875 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
 | 
|---|
| 876 | <p> This signal is emitted when the user double-clicks on an item or
 | 
|---|
| 877 | presses Enter on the current item. The argument is a pointer to
 | 
|---|
| 878 | the new selected item.
 | 
|---|
| 879 | <p> <p>See also <a href="#currentChanged">currentChanged</a>(), <a href="#highlighted">highlighted</a>(), and <a href="#selectionChanged">selectionChanged</a>().
 | 
|---|
| 880 | 
 | 
|---|
| 881 | <h3 class=fn><a href="qlistboxitem.html">QListBoxItem</a> * <a name="selectedItem"></a>QListBox::selectedItem () const
 | 
|---|
| 882 | </h3>  Returns the selected item if the list box is in
 | 
|---|
| 883 | single-selection mode and an item is selected.
 | 
|---|
| 884 | <p> If no items are selected or the list box is in another selection mode
 | 
|---|
| 885 | this function returns 0.
 | 
|---|
| 886 | <p> <p>See also <a href="#setSelected">setSelected</a>() and <a href="#multiSelection-prop">multiSelection</a>.
 | 
|---|
| 887 | 
 | 
|---|
| 888 | <h3 class=fn>void <a name="selectionChanged"></a>QListBox::selectionChanged ()<tt> [signal]</tt>
 | 
|---|
| 889 | </h3>
 | 
|---|
| 890 | 
 | 
|---|
| 891 | <p> This signal is emitted when the selection set of a list box
 | 
|---|
| 892 | changes. This signal is emitted in each selection mode. If the
 | 
|---|
| 893 | user selects five items by drag-selecting, QListBox tries to emit
 | 
|---|
| 894 | just one <a href="#selectionChanged">selectionChanged</a>() signal so the signal can be connected
 | 
|---|
| 895 | to computationally expensive slots.
 | 
|---|
| 896 | <p> <p>See also <a href="#selected">selected</a>() and <a href="#currentItem-prop">currentItem</a>.
 | 
|---|
| 897 | 
 | 
|---|
| 898 | <h3 class=fn>void <a name="selectionChanged-2"></a>QListBox::selectionChanged ( <a href="qlistboxitem.html">QListBoxItem</a> * item )<tt> [signal]</tt>
 | 
|---|
| 899 | </h3>
 | 
|---|
| 900 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
 | 
|---|
| 901 | <p> This signal is emitted when the selection in a <a href="#SelectionMode-enum">Single</a> selection
 | 
|---|
| 902 | list box changes. <em>item</em> is the newly selected list box item.
 | 
|---|
| 903 | <p> <p>See also <a href="#selected">selected</a>() and <a href="#currentItem-prop">currentItem</a>.
 | 
|---|
| 904 | 
 | 
|---|
| 905 | <h3 class=fn><a href="qlistbox.html#SelectionMode-enum">SelectionMode</a> <a name="selectionMode"></a>QListBox::selectionMode () const
 | 
|---|
| 906 | </h3><p>Returns the selection mode of the list box.
 | 
|---|
| 907 | See the <a href="qlistbox.html#selectionMode-prop">"selectionMode"</a> property for details.
 | 
|---|
| 908 | <h3 class=fn>void <a name="setAutoBottomScrollBar"></a>QListBox::setAutoBottomScrollBar ( bool enable )
 | 
|---|
| 909 | </h3>
 | 
|---|
| 910 | 
 | 
|---|
| 911 | <p> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
 | 
|---|
| 912 | <p> If <em>enable</em> is TRUE sets <a href="qscrollview.html#setHScrollBarMode">setHScrollBarMode</a>() to <a href="qscrollview.html#ScrollBarMode-enum">AlwaysOn</a>;
 | 
|---|
| 913 | otherwise sets setHScrollBarMode() to <a href="qscrollview.html#ScrollBarMode-enum">AlwaysOff</a>.
 | 
|---|
| 914 | 
 | 
|---|
| 915 | <h3 class=fn>void <a name="setAutoScrollBar"></a>QListBox::setAutoScrollBar ( bool enable )
 | 
|---|
| 916 | </h3>
 | 
|---|
| 917 | 
 | 
|---|
| 918 | <p> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
 | 
|---|
| 919 | <p> If <em>enable</em> is TRUE sets <a href="qscrollview.html#setVScrollBarMode">setVScrollBarMode</a>() to <a href="qscrollview.html#ScrollBarMode-enum">AlwaysOn</a>;
 | 
|---|
| 920 | otherwise sets setVScrollBarMode() to <a href="qscrollview.html#ScrollBarMode-enum">AlwaysOff</a>.
 | 
|---|
| 921 | 
 | 
|---|
| 922 | <h3 class=fn>void <a name="setBottomItem"></a>QListBox::setBottomItem ( int index )<tt> [virtual]</tt>
 | 
|---|
| 923 | </h3>
 | 
|---|
| 924 | Scrolls the list box so the item at position <em>index</em> in the list
 | 
|---|
| 925 | is displayed in the bottom row of the list box.
 | 
|---|
| 926 | <p> <p>See also <a href="#topItem-prop">topItem</a>.
 | 
|---|
| 927 | 
 | 
|---|
| 928 | <h3 class=fn>void <a name="setBottomScrollBar"></a>QListBox::setBottomScrollBar ( bool enable )
 | 
|---|
| 929 | </h3>
 | 
|---|
| 930 | 
 | 
|---|
| 931 | <p> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
 | 
|---|
| 932 | <p> If <em>enable</em> is TRUE sets <a href="qscrollview.html#setHScrollBarMode">setHScrollBarMode</a>() to <a href="qscrollview.html#ScrollBarMode-enum">AlwaysOn</a>;
 | 
|---|
| 933 | otherwise sets setHScrollBarMode() to <a href="qscrollview.html#ScrollBarMode-enum">AlwaysOff</a>.
 | 
|---|
| 934 | 
 | 
|---|
| 935 | <h3 class=fn>void <a name="setColumnMode"></a>QListBox::setColumnMode ( <a href="qlistbox.html#LayoutMode-enum">LayoutMode</a> )<tt> [virtual]</tt>
 | 
|---|
| 936 | </h3><p>Sets the column layout mode for this list box.
 | 
|---|
| 937 | See the <a href="qlistbox.html#columnMode-prop">"columnMode"</a> property for details.
 | 
|---|
| 938 | <h3 class=fn>void <a name="setColumnMode-2"></a>QListBox::setColumnMode ( int )<tt> [virtual]</tt>
 | 
|---|
| 939 | </h3><p>Sets the column layout mode for this list box.
 | 
|---|
| 940 | See the <a href="qlistbox.html#columnMode-prop">"columnMode"</a> property for details.
 | 
|---|
| 941 | <h3 class=fn>void <a name="setCurrentItem"></a>QListBox::setCurrentItem ( int index )<tt> [virtual]</tt>
 | 
|---|
| 942 | </h3><p>Sets the current highlighted item to <em>index</em>.
 | 
|---|
| 943 | See the <a href="qlistbox.html#currentItem-prop">"currentItem"</a> property for details.
 | 
|---|
| 944 | <h3 class=fn>void <a name="setCurrentItem-2"></a>QListBox::setCurrentItem ( <a href="qlistboxitem.html">QListBoxItem</a> * i )<tt> [virtual]</tt>
 | 
|---|
| 945 | </h3>
 | 
|---|
| 946 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
 | 
|---|
| 947 | <p> Sets the current item to the <a href="qlistboxitem.html">QListBoxItem</a> <em>i</em>.
 | 
|---|
| 948 | 
 | 
|---|
| 949 | <h3 class=fn>void <a name="setMultiSelection"></a>QListBox::setMultiSelection ( bool multi )
 | 
|---|
| 950 | </h3><p>Sets whether or not the list box is in Multi selection mode to <em>multi</em>.
 | 
|---|
| 951 | See the <a href="qlistbox.html#multiSelection-prop">"multiSelection"</a> property for details.
 | 
|---|
| 952 | <h3 class=fn>void <a name="setRowMode"></a>QListBox::setRowMode ( <a href="qlistbox.html#LayoutMode-enum">LayoutMode</a> )<tt> [virtual]</tt>
 | 
|---|
| 953 | </h3><p>Sets the row layout mode for this list box.
 | 
|---|
| 954 | See the <a href="qlistbox.html#rowMode-prop">"rowMode"</a> property for details.
 | 
|---|
| 955 | <h3 class=fn>void <a name="setRowMode-2"></a>QListBox::setRowMode ( int )<tt> [virtual]</tt>
 | 
|---|
| 956 | </h3><p>Sets the row layout mode for this list box.
 | 
|---|
| 957 | See the <a href="qlistbox.html#rowMode-prop">"rowMode"</a> property for details.
 | 
|---|
| 958 | <h3 class=fn>void <a name="setScrollBar"></a>QListBox::setScrollBar ( bool enable )
 | 
|---|
| 959 | </h3>
 | 
|---|
| 960 | 
 | 
|---|
| 961 | <p> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
 | 
|---|
| 962 | <p> If <em>enable</em> is TRUE sets <a href="qscrollview.html#setVScrollBarMode">setVScrollBarMode</a>() to <a href="qscrollview.html#ScrollBarMode-enum">AlwaysOn</a>;
 | 
|---|
| 963 | otherwise sets setVScrollBarMode() to <a href="qscrollview.html#ScrollBarMode-enum">AlwaysOff</a>.
 | 
|---|
| 964 | 
 | 
|---|
| 965 | <h3 class=fn>void <a name="setSelected"></a>QListBox::setSelected ( <a href="qlistboxitem.html">QListBoxItem</a> * item, bool select )<tt> [virtual]</tt>
 | 
|---|
| 966 | </h3>
 | 
|---|
| 967 | Selects <em>item</em> if <em>select</em> is TRUE or unselects it if <em>select</em>
 | 
|---|
| 968 | is FALSE, and repaints the item appropriately.
 | 
|---|
| 969 | <p> If the list box is a <a href="#SelectionMode-enum">Single</a> selection list box and <em>select</em> is
 | 
|---|
| 970 | TRUE, <a href="#setSelected">setSelected</a>() calls <a href="#setCurrentItem">setCurrentItem</a>().
 | 
|---|
| 971 | <p> If the list box is a <a href="#SelectionMode-enum">Single</a> selection list box, <em>select</em> is
 | 
|---|
| 972 | FALSE, setSelected() calls <a href="#clearSelection">clearSelection</a>().
 | 
|---|
| 973 | <p> <p>See also <a href="#multiSelection-prop">multiSelection</a>, <a href="#currentItem-prop">currentItem</a>, <a href="#clearSelection">clearSelection</a>(), and <a href="#currentItem-prop">currentItem</a>.
 | 
|---|
| 974 | 
 | 
|---|
| 975 | <h3 class=fn>void <a name="setSelected-2"></a>QListBox::setSelected ( int index, bool select )
 | 
|---|
| 976 | </h3>
 | 
|---|
| 977 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
 | 
|---|
| 978 | <p> If <em>select</em> is TRUE the item at position <em>index</em> is selected;
 | 
|---|
| 979 | otherwise the item is deselected.
 | 
|---|
| 980 | 
 | 
|---|
| 981 | <h3 class=fn>void <a name="setSelectionMode"></a>QListBox::setSelectionMode ( <a href="qlistbox.html#SelectionMode-enum">SelectionMode</a> )<tt> [virtual]</tt>
 | 
|---|
| 982 | </h3><p>Sets the selection mode of the list box.
 | 
|---|
| 983 | See the <a href="qlistbox.html#selectionMode-prop">"selectionMode"</a> property for details.
 | 
|---|
| 984 | <h3 class=fn>void <a name="setTopItem"></a>QListBox::setTopItem ( int index )<tt> [virtual]</tt>
 | 
|---|
| 985 | </h3><p>Sets the index of an item at the top of the screen to <em>index</em>.
 | 
|---|
| 986 | See the <a href="qlistbox.html#topItem-prop">"topItem"</a> property for details.
 | 
|---|
| 987 | <h3 class=fn>void <a name="setVariableHeight"></a>QListBox::setVariableHeight ( bool )<tt> [virtual]</tt>
 | 
|---|
| 988 | </h3><p>Sets whether this list box has variable-height rows.
 | 
|---|
| 989 | See the <a href="qlistbox.html#variableHeight-prop">"variableHeight"</a> property for details.
 | 
|---|
| 990 | <h3 class=fn>void <a name="setVariableWidth"></a>QListBox::setVariableWidth ( bool )<tt> [virtual]</tt>
 | 
|---|
| 991 | </h3><p>Sets whether this list box has variable-width columns.
 | 
|---|
| 992 | See the <a href="qlistbox.html#variableWidth-prop">"variableWidth"</a> property for details.
 | 
|---|
| 993 | <h3 class=fn>void <a name="sort"></a>QListBox::sort ( bool ascending = TRUE )
 | 
|---|
| 994 | </h3>
 | 
|---|
| 995 | If <em>ascending</em> is TRUE sorts the items in ascending order;
 | 
|---|
| 996 | otherwise sorts in descending order.
 | 
|---|
| 997 | <p> To compare the items, the text (<a href="qlistboxitem.html#text">QListBoxItem::text</a>()) of the items
 | 
|---|
| 998 | is used.
 | 
|---|
| 999 | 
 | 
|---|
| 1000 | <p>Example: <a href="listbox-example.html#x1439">listbox/listbox.cpp</a>.
 | 
|---|
| 1001 | <h3 class=fn>void <a name="takeItem"></a>QListBox::takeItem ( const <a href="qlistboxitem.html">QListBoxItem</a> * item )
 | 
|---|
| 1002 | </h3>
 | 
|---|
| 1003 | Removes <em>item</em> from the list box and causes an update of the
 | 
|---|
| 1004 | screen display. The item is not deleted. You should normally not
 | 
|---|
| 1005 | need to call this function because <a href="qlistboxitem.html#~QListBoxItem">QListBoxItem::~QListBoxItem</a>()
 | 
|---|
| 1006 | calls it. The normal way to delete an item is with <tt>delete</tt>.
 | 
|---|
| 1007 | <p> <p>See also <a href="#insertItem">QListBox::insertItem</a>().
 | 
|---|
| 1008 | 
 | 
|---|
| 1009 | <h3 class=fn><a href="qstring.html">QString</a> <a name="text"></a>QListBox::text ( int index ) const
 | 
|---|
| 1010 | </h3>
 | 
|---|
| 1011 | Returns the text at position <em>index</em>, or <a href="qstring.html#QString-null">QString::null</a> if there
 | 
|---|
| 1012 | is no text at that position.
 | 
|---|
| 1013 | <p> <p>See also <a href="#pixmap">pixmap</a>().
 | 
|---|
| 1014 | 
 | 
|---|
| 1015 | <h3 class=fn>void <a name="toggleCurrentItem"></a>QListBox::toggleCurrentItem ()<tt> [protected]</tt>
 | 
|---|
| 1016 | </h3>
 | 
|---|
| 1017 | Toggles the selection status of <a href="#currentItem">currentItem</a>() and repaints if the
 | 
|---|
| 1018 | list box is a <a href="#SelectionMode-enum">Multi</a> selection list box.
 | 
|---|
| 1019 | <p> <p>See also <a href="#multiSelection-prop">multiSelection</a>.
 | 
|---|
| 1020 | 
 | 
|---|
| 1021 | <h3 class=fn>int <a name="topItem"></a>QListBox::topItem () const
 | 
|---|
| 1022 | </h3><p>Returns the index of an item at the top of the screen.
 | 
|---|
| 1023 | See the <a href="qlistbox.html#topItem-prop">"topItem"</a> property for details.
 | 
|---|
| 1024 | <h3 class=fn>int <a name="totalHeight"></a>QListBox::totalHeight () const<tt> [protected]</tt>
 | 
|---|
| 1025 | </h3>
 | 
|---|
| 1026 | <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
 | 
|---|
| 1027 | <p> 
 | 
|---|
| 1028 | Returns <a href="qscrollview.html#contentsHeight">contentsHeight</a>().
 | 
|---|
| 1029 | 
 | 
|---|
| 1030 | <h3 class=fn>int <a name="totalWidth"></a>QListBox::totalWidth () const<tt> [protected]</tt>
 | 
|---|
| 1031 | </h3>
 | 
|---|
| 1032 | <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
 | 
|---|
| 1033 | <p> 
 | 
|---|
| 1034 | Returns <a href="qscrollview.html#contentsWidth">contentsWidth</a>().
 | 
|---|
| 1035 | 
 | 
|---|
| 1036 | <h3 class=fn>void <a name="triggerUpdate"></a>QListBox::triggerUpdate ( bool doLayout )
 | 
|---|
| 1037 | </h3>
 | 
|---|
| 1038 | Ensures that a single paint event will occur at the end of the
 | 
|---|
| 1039 | current event loop iteration. If <em>doLayout</em> is TRUE, the layout
 | 
|---|
| 1040 | is also redone.
 | 
|---|
| 1041 | 
 | 
|---|
| 1042 | <h3 class=fn>void <a name="updateItem"></a>QListBox::updateItem ( int index )<tt> [protected]</tt>
 | 
|---|
| 1043 | </h3>
 | 
|---|
| 1044 | Repaints the item at position <em>index</em> in the list.
 | 
|---|
| 1045 | 
 | 
|---|
| 1046 | <h3 class=fn>void <a name="updateItem-2"></a>QListBox::updateItem ( <a href="qlistboxitem.html">QListBoxItem</a> * i )<tt> [protected]</tt>
 | 
|---|
| 1047 | </h3>
 | 
|---|
| 1048 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
 | 
|---|
| 1049 | <p> Repaints the <a href="qlistboxitem.html">QListBoxItem</a> <em>i</em>.
 | 
|---|
| 1050 | 
 | 
|---|
| 1051 | <h3 class=fn>bool <a name="variableHeight"></a>QListBox::variableHeight () const
 | 
|---|
| 1052 | </h3><p>Returns TRUE if this list box has variable-height rows; otherwise returns FALSE.
 | 
|---|
| 1053 | See the <a href="qlistbox.html#variableHeight-prop">"variableHeight"</a> property for details.
 | 
|---|
| 1054 | <h3 class=fn>bool <a name="variableWidth"></a>QListBox::variableWidth () const
 | 
|---|
| 1055 | </h3><p>Returns TRUE if this list box has variable-width columns; otherwise returns FALSE.
 | 
|---|
| 1056 | See the <a href="qlistbox.html#variableWidth-prop">"variableWidth"</a> property for details.
 | 
|---|
| 1057 | <hr><h2>Property Documentation</h2>
 | 
|---|
| 1058 | <h3 class=fn><a href="qlistbox.html#LayoutMode-enum">LayoutMode</a> <a name="columnMode-prop"></a>columnMode</h3>
 | 
|---|
| 1059 | <p>This property holds the column layout mode for this list box.
 | 
|---|
| 1060 | <p>setColumnMode() sets the layout mode and adjusts the number of
 | 
|---|
| 1061 | displayed columns. The row layout mode automatically becomes <a href="#LayoutMode-enum">Variable</a>, unless the column mode is <a href="#LayoutMode-enum">Variable</a>.
 | 
|---|
| 1062 | <p> <p>See also <a href="#rowMode-prop">rowMode</a>, <a href="#rowMode-prop">rowMode</a>, and <a href="#numColumns-prop">numColumns</a>.
 | 
|---|
| 1063 | 
 | 
|---|
| 1064 | <p>Set this property's value with <a href="#setColumnMode">setColumnMode</a>() and get this property's value with <a href="#columnMode">columnMode</a>().
 | 
|---|
| 1065 | <h3 class=fn>uint <a name="count-prop"></a>count</h3>
 | 
|---|
| 1066 | <p>This property holds the number of items in the list box.
 | 
|---|
| 1067 | <p>
 | 
|---|
| 1068 | <p>Get this property's value with <a href="#count">count</a>().
 | 
|---|
| 1069 | <h3 class=fn>int <a name="currentItem-prop"></a>currentItem</h3>
 | 
|---|
| 1070 | <p>This property holds the current highlighted item.
 | 
|---|
| 1071 | <p>When setting this property, the highlighting is moved to the item
 | 
|---|
| 1072 | and the list box scrolled as necessary.
 | 
|---|
| 1073 | <p> If no item is current, <a href="#currentItem">currentItem</a>() returns -1.
 | 
|---|
| 1074 | 
 | 
|---|
| 1075 | <p>Set this property's value with <a href="#setCurrentItem">setCurrentItem</a>() and get this property's value with <a href="#currentItem">currentItem</a>().
 | 
|---|
| 1076 | <h3 class=fn><a href="qstring.html">QString</a> <a name="currentText-prop"></a>currentText</h3>
 | 
|---|
| 1077 | <p>This property holds the text of the current item.
 | 
|---|
| 1078 | <p>This is equivalent to <a href="#text">text</a>(currentItem()).
 | 
|---|
| 1079 | 
 | 
|---|
| 1080 | <p>Get this property's value with <a href="#currentText">currentText</a>().
 | 
|---|
| 1081 | <h3 class=fn>bool <a name="multiSelection-prop"></a>multiSelection</h3>
 | 
|---|
| 1082 | <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
 | 
|---|
| 1083 | <p> <p>This property holds whether or not the list box is in Multi selection mode.
 | 
|---|
| 1084 | <p>Consider using the <a href="#selectionMode-prop">QListBox::selectionMode</a> property instead of
 | 
|---|
| 1085 | this property.
 | 
|---|
| 1086 | <p> When setting this property, Multi selection mode is used if set to TRUE and
 | 
|---|
| 1087 | to Single selection mode if set to FALSE.
 | 
|---|
| 1088 | <p> When getting this property, TRUE is returned if the list box is in
 | 
|---|
| 1089 | Multi selection mode or Extended selection mode, and FALSE if it is
 | 
|---|
| 1090 | in Single selection mode or NoSelection mode.
 | 
|---|
| 1091 | <p> <p>See also <a href="#selectionMode-prop">selectionMode</a>.
 | 
|---|
| 1092 | 
 | 
|---|
| 1093 | <p>Set this property's value with <a href="#setMultiSelection">setMultiSelection</a>() and get this property's value with <a href="#isMultiSelection">isMultiSelection</a>().
 | 
|---|
| 1094 | <h3 class=fn>int <a name="numColumns-prop"></a>numColumns</h3>
 | 
|---|
| 1095 | <p>This property holds the number of columns in the list box.
 | 
|---|
| 1096 | <p>This is normally 1, but can be different if <a href="#columnMode-prop">QListBox::columnMode</a> or <a href="#rowMode-prop">QListBox::rowMode</a> has been set.
 | 
|---|
| 1097 | <p> <p>See also <a href="#columnMode-prop">columnMode</a>, <a href="#rowMode-prop">rowMode</a>, and <a href="#numRows-prop">numRows</a>.
 | 
|---|
| 1098 | 
 | 
|---|
| 1099 | <p>Get this property's value with <a href="#numColumns">numColumns</a>().
 | 
|---|
| 1100 | <h3 class=fn>int <a name="numItemsVisible-prop"></a>numItemsVisible</h3>
 | 
|---|
| 1101 | <p>This property holds the number of visible items.
 | 
|---|
| 1102 | <p>Both partially and entirely visible items are counted.
 | 
|---|
| 1103 | 
 | 
|---|
| 1104 | <p>Get this property's value with <a href="#numItemsVisible">numItemsVisible</a>().
 | 
|---|
| 1105 | <h3 class=fn>int <a name="numRows-prop"></a>numRows</h3>
 | 
|---|
| 1106 | <p>This property holds the number of rows in the list box.
 | 
|---|
| 1107 | <p>This is equal to the number of items in the default single-column
 | 
|---|
| 1108 | layout, but can be different.
 | 
|---|
| 1109 | <p> <p>See also <a href="#columnMode-prop">columnMode</a>, <a href="#rowMode-prop">rowMode</a>, and <a href="#numColumns-prop">numColumns</a>.
 | 
|---|
| 1110 | 
 | 
|---|
| 1111 | <p>Get this property's value with <a href="#numRows">numRows</a>().
 | 
|---|
| 1112 | <h3 class=fn><a href="qlistbox.html#LayoutMode-enum">LayoutMode</a> <a name="rowMode-prop"></a>rowMode</h3>
 | 
|---|
| 1113 | <p>This property holds the row layout mode for this list box.
 | 
|---|
| 1114 | <p>This property is normally <a href="#LayoutMode-enum">Variable</a>.
 | 
|---|
| 1115 | <p> <a href="#setRowMode">setRowMode</a>() sets the layout mode and adjusts the number of
 | 
|---|
| 1116 | displayed rows. The column layout mode automatically becomes <a href="#LayoutMode-enum">Variable</a>, unless the row mode is <a href="#LayoutMode-enum">Variable</a>.
 | 
|---|
| 1117 | <p> <p>See also <a href="#columnMode-prop">columnMode</a>.
 | 
|---|
| 1118 | 
 | 
|---|
| 1119 | <p>Set this property's value with <a href="#setRowMode">setRowMode</a>() and get this property's value with <a href="#rowMode">rowMode</a>().
 | 
|---|
| 1120 | <h3 class=fn><a href="qlistbox.html#SelectionMode-enum">SelectionMode</a> <a name="selectionMode-prop"></a>selectionMode</h3>
 | 
|---|
| 1121 | <p>This property holds the selection mode of the list box.
 | 
|---|
| 1122 | <p>Sets the list box's selection mode, which may be one of <a href="#SelectionMode-enum">Single</a>
 | 
|---|
| 1123 | (the default), <a href="#SelectionMode-enum">Extended</a>, <a href="#SelectionMode-enum">Multi</a> or <a href="#SelectionMode-enum">NoSelection</a>.
 | 
|---|
| 1124 | <p> <p>See also <a href="#SelectionMode-enum">SelectionMode</a>.
 | 
|---|
| 1125 | 
 | 
|---|
| 1126 | <p>Set this property's value with <a href="#setSelectionMode">setSelectionMode</a>() and get this property's value with <a href="#selectionMode">selectionMode</a>().
 | 
|---|
| 1127 | <h3 class=fn>int <a name="topItem-prop"></a>topItem</h3>
 | 
|---|
| 1128 | <p>This property holds the index of an item at the top of the screen.
 | 
|---|
| 1129 | <p>When getting this property and the listbox has multiple columns,
 | 
|---|
| 1130 | an arbitrary item is selected and returned.
 | 
|---|
| 1131 | <p> When setting this property, the list box is scrolled so the item
 | 
|---|
| 1132 | at position <em>index</em> in the list is displayed in the top row of
 | 
|---|
| 1133 | the list box.
 | 
|---|
| 1134 | 
 | 
|---|
| 1135 | <p>Set this property's value with <a href="#setTopItem">setTopItem</a>() and get this property's value with <a href="#topItem">topItem</a>().
 | 
|---|
| 1136 | <h3 class=fn>bool <a name="variableHeight-prop"></a>variableHeight</h3>
 | 
|---|
| 1137 | <p>This property holds whether this list box has variable-height rows.
 | 
|---|
| 1138 | <p>When the list box has variable-height rows (the default), each row
 | 
|---|
| 1139 | is as high as the highest item in that row. When it has same-sized
 | 
|---|
| 1140 | rows, all rows are as high as the highest item in the list box.
 | 
|---|
| 1141 | <p> <p>See also <a href="#variableWidth-prop">variableWidth</a>.
 | 
|---|
| 1142 | 
 | 
|---|
| 1143 | <p>Set this property's value with <a href="#setVariableHeight">setVariableHeight</a>() and get this property's value with <a href="#variableHeight">variableHeight</a>().
 | 
|---|
| 1144 | <h3 class=fn>bool <a name="variableWidth-prop"></a>variableWidth</h3>
 | 
|---|
| 1145 | <p>This property holds whether this list box has variable-width columns.
 | 
|---|
| 1146 | <p>When the list box has variable-width columns, each column is as
 | 
|---|
| 1147 | wide as the widest item in that column. When it has same-sized
 | 
|---|
| 1148 | columns (the default), all columns are as wide as the widest item
 | 
|---|
| 1149 | in the list box.
 | 
|---|
| 1150 | <p> <p>See also <a href="#variableHeight-prop">variableHeight</a>.
 | 
|---|
| 1151 | 
 | 
|---|
| 1152 | <p>Set this property's value with <a href="#setVariableWidth">setVariableWidth</a>() and get this property's value with <a href="#variableWidth">variableWidth</a>().
 | 
|---|
| 1153 | <!-- eof -->
 | 
|---|
| 1154 | <hr><p>
 | 
|---|
| 1155 | This file is part of the <a href="index.html">Qt toolkit</a>.
 | 
|---|
| 1156 | Copyright © 1995-2007
 | 
|---|
| 1157 | <a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
 | 
|---|
| 1158 | <table width=100% cellspacing=0 border=0><tr>
 | 
|---|
| 1159 | <td>Copyright © 2007
 | 
|---|
| 1160 | <a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
 | 
|---|
| 1161 | <td align=right><div align=right>Qt 3.3.8</div>
 | 
|---|
| 1162 | </table></div></address></body>
 | 
|---|
| 1163 | </html>
 | 
|---|