| 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:160 -->
|
|---|
| 3 | <html>
|
|---|
| 4 | <head>
|
|---|
| 5 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
|---|
| 6 | <title>QListBoxItem 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>QListBoxItem Class Reference</h1>
|
|---|
| 33 |
|
|---|
| 34 | <p>The QListBoxItem class is the base class of all list box items.
|
|---|
| 35 | <a href="#details">More...</a>
|
|---|
| 36 | <p><tt>#include <<a href="qlistbox-h.html">qlistbox.h</a>></tt>
|
|---|
| 37 | <p>Inherited by <a href="qlistboxtext.html">QListBoxText</a> and <a href="qlistboxpixmap.html">QListBoxPixmap</a>.
|
|---|
| 38 | <p><a href="qlistboxitem-members.html">List of all member functions.</a>
|
|---|
| 39 | <h2>Public Members</h2>
|
|---|
| 40 | <ul>
|
|---|
| 41 | <li class=fn><a href="#QListBoxItem"><b>QListBoxItem</b></a> ( QListBox * listbox = 0 )</li>
|
|---|
| 42 | <li class=fn><a href="#QListBoxItem-2"><b>QListBoxItem</b></a> ( QListBox * listbox, QListBoxItem * after )</li>
|
|---|
| 43 | <li class=fn>virtual <a href="#~QListBoxItem"><b>~QListBoxItem</b></a> ()</li>
|
|---|
| 44 | <li class=fn>virtual QString <a href="#text"><b>text</b></a> () const</li>
|
|---|
| 45 | <li class=fn>virtual const QPixmap * <a href="#pixmap"><b>pixmap</b></a> () const</li>
|
|---|
| 46 | <li class=fn>virtual int <a href="#height"><b>height</b></a> ( const QListBox * lb ) const</li>
|
|---|
| 47 | <li class=fn>virtual int <a href="#width"><b>width</b></a> ( const QListBox * lb ) const</li>
|
|---|
| 48 | <li class=fn>bool <a href="#isSelected"><b>isSelected</b></a> () const</li>
|
|---|
| 49 | <li class=fn>bool <a href="#isCurrent"><b>isCurrent</b></a> () const</li>
|
|---|
| 50 | <li class=fn>bool selected () const <em>(obsolete)</em></li>
|
|---|
| 51 | <li class=fn>bool current () const <em>(obsolete)</em></li>
|
|---|
| 52 | <li class=fn>QListBox * <a href="#listBox"><b>listBox</b></a> () const</li>
|
|---|
| 53 | <li class=fn>void <a href="#setSelectable"><b>setSelectable</b></a> ( bool b )</li>
|
|---|
| 54 | <li class=fn>bool <a href="#isSelectable"><b>isSelectable</b></a> () const</li>
|
|---|
| 55 | <li class=fn>QListBoxItem * <a href="#next"><b>next</b></a> () const</li>
|
|---|
| 56 | <li class=fn>QListBoxItem * <a href="#prev"><b>prev</b></a> () const</li>
|
|---|
| 57 | <li class=fn>virtual int <a href="#rtti"><b>rtti</b></a> () const</li>
|
|---|
| 58 | </ul>
|
|---|
| 59 | <h2>Protected Members</h2>
|
|---|
| 60 | <ul>
|
|---|
| 61 | <li class=fn>virtual void <a href="#paint"><b>paint</b></a> ( QPainter * p ) = 0</li>
|
|---|
| 62 | <li class=fn>virtual void <a href="#setText"><b>setText</b></a> ( const QString & text )</li>
|
|---|
| 63 | <li class=fn>void <a href="#setCustomHighlighting"><b>setCustomHighlighting</b></a> ( bool b )</li>
|
|---|
| 64 | </ul>
|
|---|
| 65 | <hr><a name="details"></a><h2>Detailed Description</h2>
|
|---|
| 66 |
|
|---|
| 67 |
|
|---|
| 68 | The QListBoxItem class is the base class of all list box items.
|
|---|
| 69 | <p> This class is an abstract base class used for all list box items.
|
|---|
| 70 | If you need to insert customized items into a <a href="qlistbox.html">QListBox</a> you must
|
|---|
| 71 | inherit this class and reimplement <a href="#paint">paint</a>(), <a href="#height">height</a>() and <a href="#width">width</a>().
|
|---|
| 72 | <p> <p>See also <a href="qlistbox.html">QListBox</a>.
|
|---|
| 73 |
|
|---|
| 74 | <hr><h2>Member Function Documentation</h2>
|
|---|
| 75 | <h3 class=fn><a name="QListBoxItem"></a>QListBoxItem::QListBoxItem ( <a href="qlistbox.html">QListBox</a> * listbox = 0 )
|
|---|
| 76 | </h3>
|
|---|
| 77 | Constructs an empty list box item in the list box <em>listbox</em>.
|
|---|
| 78 |
|
|---|
| 79 | <h3 class=fn><a name="QListBoxItem-2"></a>QListBoxItem::QListBoxItem ( <a href="qlistbox.html">QListBox</a> * listbox, <a href="qlistboxitem.html">QListBoxItem</a> * after )
|
|---|
| 80 | </h3>
|
|---|
| 81 | Constructs an empty list box item in the list box <em>listbox</em> and
|
|---|
| 82 | inserts it after the item <em>after</em> or at the beginning if <em>after</em>
|
|---|
| 83 | is 0.
|
|---|
| 84 |
|
|---|
| 85 | <h3 class=fn><a name="~QListBoxItem"></a>QListBoxItem::~QListBoxItem ()<tt> [virtual]</tt>
|
|---|
| 86 | </h3>
|
|---|
| 87 | Destroys the list box item.
|
|---|
| 88 |
|
|---|
| 89 | <h3 class=fn>bool <a name="current"></a>QListBoxItem::current () const
|
|---|
| 90 | </h3>
|
|---|
| 91 |
|
|---|
| 92 | <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
|
|---|
| 93 | <p>
|
|---|
| 94 | <h3 class=fn>int <a name="height"></a>QListBoxItem::height ( const <a href="qlistbox.html">QListBox</a> * lb ) const<tt> [virtual]</tt>
|
|---|
| 95 | </h3>
|
|---|
| 96 |
|
|---|
| 97 | <p> Implement this function to return the height of your item. The <em>lb</em> parameter is the same as <a href="#listBox">listBox</a>() and is provided for
|
|---|
| 98 | convenience and compatibility.
|
|---|
| 99 | <p> The default implementation returns
|
|---|
| 100 | <a href="qapplication.html#globalStrut">QApplication::globalStrut</a>()'s height.
|
|---|
| 101 | <p> <p>See also <a href="#paint">paint</a>() and <a href="#width">width</a>().
|
|---|
| 102 |
|
|---|
| 103 | <p>Reimplemented in <a href="qlistboxtext.html#height">QListBoxText</a> and <a href="qlistboxpixmap.html#height">QListBoxPixmap</a>.
|
|---|
| 104 | <h3 class=fn>bool <a name="isCurrent"></a>QListBoxItem::isCurrent () const
|
|---|
| 105 | </h3>
|
|---|
| 106 | Returns TRUE if the item is the current item; otherwise returns
|
|---|
| 107 | FALSE.
|
|---|
| 108 | <p> <p>See also <a href="qlistbox.html#currentItem-prop">QListBox::currentItem</a>, <a href="qlistbox.html#item">QListBox::item</a>(), and <a href="#isSelected">isSelected</a>().
|
|---|
| 109 |
|
|---|
| 110 | <h3 class=fn>bool <a name="isSelectable"></a>QListBoxItem::isSelectable () const
|
|---|
| 111 | </h3>
|
|---|
| 112 | Returns TRUE if this item is selectable (the default); otherwise
|
|---|
| 113 | returns FALSE.
|
|---|
| 114 | <p> <p>See also <a href="#setSelectable">setSelectable</a>().
|
|---|
| 115 |
|
|---|
| 116 | <h3 class=fn>bool <a name="isSelected"></a>QListBoxItem::isSelected () const
|
|---|
| 117 | </h3>
|
|---|
| 118 |
|
|---|
| 119 | <p> Returns TRUE if the item is selected; otherwise returns FALSE.
|
|---|
| 120 | <p> <p>See also <a href="qlistbox.html#isSelected">QListBox::isSelected</a>() and <a href="#isCurrent">isCurrent</a>().
|
|---|
| 121 |
|
|---|
| 122 | <p>Example: <a href="listboxcombo-example.html#x1409">listboxcombo/listboxcombo.cpp</a>.
|
|---|
| 123 | <h3 class=fn><a href="qlistbox.html">QListBox</a> * <a name="listBox"></a>QListBoxItem::listBox () const
|
|---|
| 124 | </h3>
|
|---|
| 125 | Returns a pointer to the list box containing this item.
|
|---|
| 126 |
|
|---|
| 127 | <h3 class=fn><a href="qlistboxitem.html">QListBoxItem</a> * <a name="next"></a>QListBoxItem::next () const
|
|---|
| 128 | </h3>
|
|---|
| 129 | Returns the item that comes after this in the list box. If this is
|
|---|
| 130 | the last item, 0 is returned.
|
|---|
| 131 | <p> <p>See also <a href="#prev">prev</a>().
|
|---|
| 132 |
|
|---|
| 133 | <h3 class=fn>void <a name="paint"></a>QListBoxItem::paint ( <a href="qpainter.html">QPainter</a> * p )<tt> [pure virtual protected]</tt>
|
|---|
| 134 | </h3>
|
|---|
| 135 |
|
|---|
| 136 | <p> Implement this function to draw your item. The painter, <em>p</em>, is
|
|---|
| 137 | already open for painting.
|
|---|
| 138 | <p> <p>See also <a href="#height">height</a>() and <a href="#width">width</a>().
|
|---|
| 139 |
|
|---|
| 140 | <p>Example: <a href="listboxcombo-example.html#x1410">listboxcombo/listboxcombo.cpp</a>.
|
|---|
| 141 | <p>Reimplemented in <a href="qlistboxtext.html#paint">QListBoxText</a> and <a href="qlistboxpixmap.html#paint">QListBoxPixmap</a>.
|
|---|
| 142 | <h3 class=fn>const <a href="qpixmap.html">QPixmap</a> * <a name="pixmap"></a>QListBoxItem::pixmap () const<tt> [virtual]</tt>
|
|---|
| 143 | </h3>
|
|---|
| 144 | Returns the pixmap associated with the item, or 0 if there isn't
|
|---|
| 145 | one.
|
|---|
| 146 | <p> The default implementation returns 0.
|
|---|
| 147 |
|
|---|
| 148 | <p>Example: <a href="listboxcombo-example.html#x1411">listboxcombo/listboxcombo.cpp</a>.
|
|---|
| 149 | <p>Reimplemented in <a href="qlistboxpixmap.html#pixmap">QListBoxPixmap</a>.
|
|---|
| 150 | <h3 class=fn><a href="qlistboxitem.html">QListBoxItem</a> * <a name="prev"></a>QListBoxItem::prev () const
|
|---|
| 151 | </h3>
|
|---|
| 152 | Returns the item which comes before this in the list box. If this
|
|---|
| 153 | is the first item, 0 is returned.
|
|---|
| 154 | <p> <p>See also <a href="#next">next</a>().
|
|---|
| 155 |
|
|---|
| 156 | <h3 class=fn>int <a name="rtti"></a>QListBoxItem::rtti () const<tt> [virtual]</tt>
|
|---|
| 157 | </h3>
|
|---|
| 158 | Returns 0.
|
|---|
| 159 | <p> Make your derived classes return their own values for <a href="#rtti">rtti</a>(), and
|
|---|
| 160 | you can distinguish between listbox items. You should use values
|
|---|
| 161 | greater than 1000 preferably a large random number, to allow for
|
|---|
| 162 | extensions to this class.
|
|---|
| 163 |
|
|---|
| 164 | <h3 class=fn>bool <a name="selected"></a>QListBoxItem::selected () const
|
|---|
| 165 | </h3>
|
|---|
| 166 |
|
|---|
| 167 | <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
|
|---|
| 168 | <p>
|
|---|
| 169 | <h3 class=fn>void <a name="setCustomHighlighting"></a>QListBoxItem::setCustomHighlighting ( bool b )<tt> [protected]</tt>
|
|---|
| 170 | </h3>
|
|---|
| 171 | Defines whether the list box item is responsible for drawing
|
|---|
| 172 | itself in a highlighted state when being selected.
|
|---|
| 173 | <p> If <em>b</em> is FALSE (the default), the list box will draw some
|
|---|
| 174 | default highlight indicator before calling <a href="#paint">paint</a>().
|
|---|
| 175 | <p> <p>See also <a href="#selected">selected</a>() and <a href="#paint">paint</a>().
|
|---|
| 176 |
|
|---|
| 177 | <h3 class=fn>void <a name="setSelectable"></a>QListBoxItem::setSelectable ( bool b )
|
|---|
| 178 | </h3>
|
|---|
| 179 | If <em>b</em> is TRUE (the default) then this item can be selected by
|
|---|
| 180 | the user; otherwise this item cannot be selected by the user.
|
|---|
| 181 | <p> <p>See also <a href="#isSelectable">isSelectable</a>().
|
|---|
| 182 |
|
|---|
| 183 | <h3 class=fn>void <a name="setText"></a>QListBoxItem::setText ( const <a href="qstring.html">QString</a> & text )<tt> [virtual protected]</tt>
|
|---|
| 184 | </h3>
|
|---|
| 185 |
|
|---|
| 186 | <p> Sets the text of the QListBoxItem to <em>text</em>. This <em>text</em> is also
|
|---|
| 187 | used for sorting. The text is not shown unless explicitly drawn in
|
|---|
| 188 | <a href="#paint">paint</a>().
|
|---|
| 189 | <p> <p>See also <a href="#text">text</a>().
|
|---|
| 190 |
|
|---|
| 191 | <h3 class=fn><a href="qstring.html">QString</a> <a name="text"></a>QListBoxItem::text () const<tt> [virtual]</tt>
|
|---|
| 192 | </h3>
|
|---|
| 193 | Returns the text of the item. This text is also used for sorting.
|
|---|
| 194 | <p> <p>See also <a href="#setText">setText</a>().
|
|---|
| 195 |
|
|---|
| 196 | <p>Example: <a href="listboxcombo-example.html#x1412">listboxcombo/listboxcombo.cpp</a>.
|
|---|
| 197 | <h3 class=fn>int <a name="width"></a>QListBoxItem::width ( const <a href="qlistbox.html">QListBox</a> * lb ) const<tt> [virtual]</tt>
|
|---|
| 198 | </h3>
|
|---|
| 199 |
|
|---|
| 200 | <p> Reimplement this function to return the width of your item. The <em>lb</em> parameter is the same as <a href="#listBox">listBox</a>() and is provided for
|
|---|
| 201 | convenience and compatibility.
|
|---|
| 202 | <p> The default implementation returns
|
|---|
| 203 | <a href="qapplication.html#globalStrut">QApplication::globalStrut</a>()'s width.
|
|---|
| 204 | <p> <p>See also <a href="#paint">paint</a>() and <a href="#height">height</a>().
|
|---|
| 205 |
|
|---|
| 206 | <p>Reimplemented in <a href="qlistboxtext.html#width">QListBoxText</a> and <a href="qlistboxpixmap.html#width">QListBoxPixmap</a>.
|
|---|
| 207 | <!-- eof -->
|
|---|
| 208 | <hr><p>
|
|---|
| 209 | This file is part of the <a href="index.html">Qt toolkit</a>.
|
|---|
| 210 | Copyright © 1995-2007
|
|---|
| 211 | <a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
|
|---|
| 212 | <table width=100% cellspacing=0 border=0><tr>
|
|---|
| 213 | <td>Copyright © 2007
|
|---|
| 214 | <a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
|---|
| 215 | <td align=right><div align=right>Qt 3.3.8</div>
|
|---|
| 216 | </table></div></address></body>
|
|---|
| 217 | </html>
|
|---|