qlistboxitem.html
来自「QT 下载资料仅供参考」· HTML 代码 · 共 212 行
HTML
212 行
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><!-- /home/reggie/tmp/qt-3.0-reggie-5401/qt-x11-commercial-3.0.5/src/widgets/qlistbox.cpp:158 --><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>QListBoxItem Class</title><style type="text/css"><!--h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }a:link { color: #004faf; text-decoration: none }a:visited { color: #672967; text-decoration: none }body { background: #ffffff; color: black; }--></style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr bgcolor="#E5E5E5"><td valign=center> <a href="index.html"><font color="#004faf">Home</font></a> | <a href="classes.html"><font color="#004faf">All Classes</font></a> | <a href="mainclasses.html"><font color="#004faf">Main Classes</font></a> | <a href="annotated.html"><font color="#004faf">Annotated</font></a> | <a href="groups.html"><font color="#004faf">Grouped Classes</font></a> | <a href="functions.html"><font color="#004faf">Functions</font></a></td><td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QListBoxItem Class Reference</h1><p>The QListBoxItem class is the base class of all list box items.<a href="#details">More...</a><p><tt>#include <<a href="qlistbox-h.html">qlistbox.h</a>></tt><p>Inherited by <a href="qlistboxtext.html">QListBoxText</a> and <a href="qlistboxpixmap.html">QListBoxPixmap</a>.<p><a href="qlistboxitem-members.html">List of all member functions.</a><h2>Public Members</h2><ul><li><div class=fn><a href="#QListBoxItem"><b>QListBoxItem</b></a> ( QListBox * listbox = 0 )</div></li><li><div class=fn><a href="#QListBoxItem-2"><b>QListBoxItem</b></a> ( QListBox * listbox, QListBoxItem * after )</div></li><li><div class=fn>virtual <a href="#~QListBoxItem"><b>~QListBoxItem</b></a> ()</div></li><li><div class=fn>virtual QString <a href="#text"><b>text</b></a> () const</div></li><li><div class=fn>virtual const QPixmap * <a href="#pixmap"><b>pixmap</b></a> () const</div></li><li><div class=fn>virtual int <a href="#height"><b>height</b></a> ( const QListBox * lb ) const</div></li><li><div class=fn>virtual int <a href="#width"><b>width</b></a> ( const QListBox * lb ) const</div></li><li><div class=fn>bool <a href="#isSelected"><b>isSelected</b></a> () const</div></li><li><div class=fn>bool <a href="#isCurrent"><b>isCurrent</b></a> () const</div></li><li><div class=fn>bool selected () const <em>(obsolete)</em></div></li><li><div class=fn>bool current () const <em>(obsolete)</em></div></li><li><div class=fn>QListBox * <a href="#listBox"><b>listBox</b></a> () const</div></li><li><div class=fn>void <a href="#setSelectable"><b>setSelectable</b></a> ( bool b )</div></li><li><div class=fn>bool <a href="#isSelectable"><b>isSelectable</b></a> () const</div></li><li><div class=fn>QListBoxItem * <a href="#next"><b>next</b></a> () const</div></li><li><div class=fn>QListBoxItem * <a href="#prev"><b>prev</b></a> () const</div></li><li><div class=fn>virtual int <a href="#rtti"><b>rtti</b></a> () const</div></li></ul><h2>Protected Members</h2><ul><li><div class=fn>virtual void <a href="#paint"><b>paint</b></a> ( QPainter * p ) = 0</div></li><li><div class=fn>virtual void <a href="#setText"><b>setText</b></a> ( const QString & text )</div></li><li><div class=fn>void <a href="#setCustomHighlighting"><b>setCustomHighlighting</b></a> ( bool b )</div></li></ul><hr><a name="details"></a><h2>Detailed Description</h2><p> The QListBoxItem class is the base class of all list box items.<p> This class is an abstract base class used for all list box items. If youneed to insert customized items into a <a href="qlistbox.html">QListBox</a> you must inheritthis class and reimplement <a href="#paint">paint</a>(), <a href="#height">height</a>() and <a href="#width">width</a>().<p> <p>See also <a href="qlistbox.html">QListBox</a> and <a href="advanced.html">Advanced Widgets</a>.<hr><h2>Member Function Documentation</h2><h3 class=fn><a name="QListBoxItem"></a>QListBoxItem::QListBoxItem ( <a href="qlistbox.html">QListBox</a> * listbox = 0 )</h3>Constructs an empty list box item in the list box <em>listbox</em>.<h3 class=fn><a name="QListBoxItem-2"></a>QListBoxItem::QListBoxItem ( <a href="qlistbox.html">QListBox</a> * listbox, <a href="qlistboxitem.html">QListBoxItem</a> * after )</h3>Constructs an empty list box item in the list box <em>listbox</em> andinserts it after the item <em>after</em>. If <em>after</em> is 0, the itemis inserted at the beginning.<h3 class=fn><a name="~QListBoxItem"></a>QListBoxItem::~QListBoxItem ()<tt> [virtual]</tt></h3>Destroys the list box item.<h3 class=fn>bool <a name="current"></a>QListBoxItem::current () const</h3><b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.<p> <h3 class=fn>int <a name="height"></a>QListBoxItem::height ( const <a href="qlistbox.html">QListBox</a> * lb ) const<tt> [virtual]</tt></h3><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 providedfor convenience and compatibility.<p> <p>See also <a href="#paint">paint</a>() and <a href="#width">width</a>().<p>Reimplemented in <a href="qlistboxtext.html#height">QListBoxText</a> and <a href="qlistboxpixmap.html#height">QListBoxPixmap</a>.<h3 class=fn>bool <a name="isCurrent"></a>QListBoxItem::isCurrent () const</h3>Returns TRUE if the item is the current item; otherwise returns FALSE.<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>().<h3 class=fn>bool <a name="isSelectable"></a>QListBoxItem::isSelectable () const</h3>Returns TRUE if this item is selectable; otherwise returns FALSE.<p> <p>See also <a href="#setSelectable">setSelectable</a>().<h3 class=fn>bool <a name="isSelected"></a>QListBoxItem::isSelected () const</h3> Returns TRUE if the item is selected; otherwise returns FALSE.<p> <p>See also <a href="qlistbox.html#isSelected">QListBox::isSelected</a>() and <a href="#isCurrent">isCurrent</a>().<p>Example: <a href="listboxcombo-example.html#x1136">listboxcombo/listboxcombo.cpp</a>.<h3 class=fn><a href="qlistbox.html">QListBox</a> * <a name="listBox"></a>QListBoxItem::listBox () const</h3> Returns a pointer to the list box containing this item.<h3 class=fn><a href="qlistboxitem.html">QListBoxItem</a> * <a name="next"></a>QListBoxItem::next () const</h3> Returns the item that comes after this in the list box. If this isthe last item, a null pointer is returned.<p> <p>See also <a href="#prev">prev</a>().<h3 class=fn>void <a name="paint"></a>QListBoxItem::paint ( <a href="qpainter.html">QPainter</a> * p )<tt> [pure virtual protected]</tt></h3><p> Implement this function to draw your item. You willneed to pass the <a href="qpainter.html">QPainter</a> that will draw the item in <em>p</em>.<p> <p>See also <a href="#height">height</a>() and <a href="#width">width</a>().<p>Example: <a href="listboxcombo-example.html#x1137">listboxcombo/listboxcombo.cpp</a>.<p>Reimplemented in <a href="qlistboxtext.html#paint">QListBoxText</a> and <a href="qlistboxpixmap.html#paint">QListBoxPixmap</a>.<h3 class=fn>const <a href="qpixmap.html">QPixmap</a> * <a name="pixmap"></a>QListBoxItem::pixmap () const<tt> [virtual]</tt></h3>Returns the pixmap associated with the item, if any.<p> The default implementation returns a null pointer.<p>Example: <a href="listboxcombo-example.html#x1138">listboxcombo/listboxcombo.cpp</a>.<p>Reimplemented in <a href="qlistboxpixmap.html#pixmap">QListBoxPixmap</a>.<h3 class=fn><a href="qlistboxitem.html">QListBoxItem</a> * <a name="prev"></a>QListBoxItem::prev () const</h3> Returns the item which comes before this in the list box. If this isthe first item, a null pointer is returned.<p> <p>See also <a href="#next">next</a>().<h3 class=fn>int <a name="rtti"></a>QListBoxItem::rtti () const<tt> [virtual]</tt></h3> Returns 0.<p> Although often frowned upon by purists, Run Time Type Identificationis very useful in this case, as it allows a <a href="qlistbox.html">QListBox</a> to be anefficient indexed storage mechanism.<p> Make your derived classes return their own values for <a href="#rtti">rtti</a>(), andyou can distinguish between listbox items. You should use valuesgreater than 1000 preferably a large random number, to allow forextensions to this class.<h3 class=fn>bool <a name="selected"></a>QListBoxItem::selected () const</h3><b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.<p> <h3 class=fn>void <a name="setCustomHighlighting"></a>QListBoxItem::setCustomHighlighting ( bool b )<tt> [protected]</tt></h3>Defines whether the list box item is responsible for drawing itselfin a highlighted state when being selected.<p> If <em>b</em> is FALSE (the default), the list box will draw somedefault highlight indicator before calling <a href="#paint">paint</a>().<p> <p>See also <a href="#selected">selected</a>() and <a href="#paint">paint</a>().<h3 class=fn>void <a name="setSelectable"></a>QListBoxItem::setSelectable ( bool b )</h3>If <em>b</em> is TRUE then this item can be selected by the user;otherwise this item cannot be selected by the user.<p> <p>See also <a href="#isSelectable">isSelectable</a>().<h3 class=fn>void <a name="setText"></a>QListBoxItem::setText ( const <a href="qstring.html">QString</a> & text )<tt> [virtual protected]</tt></h3><p> Sets the text of the QListBoxItem to <em>text</em>. This <em>text</em> isalso used for sorting. The text is not shown unlessexplicitly drawn in <a href="#paint">paint</a>().<p> <p>See also <a href="#text">text</a>().<h3 class=fn><a href="qstring.html">QString</a> <a name="text"></a>QListBoxItem::text () const<tt> [virtual]</tt></h3>Returns the text of the item. This text is also used for sorting.<p> <p>See also <a href="#setText">setText</a>().<p>Example: <a href="listboxcombo-example.html#x1139">listboxcombo/listboxcombo.cpp</a>.<h3 class=fn>int <a name="width"></a>QListBoxItem::width ( const <a href="qlistbox.html">QListBox</a> * lb ) const<tt> [virtual]</tt></h3><p> Implement 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 providedfor convenience and compatibility.<p> <p>See also <a href="#paint">paint</a>() and <a href="#height">height</a>().<p>Reimplemented in <a href="qlistboxtext.html#width">QListBoxText</a> and <a href="qlistboxpixmap.html#width">QListBoxPixmap</a>.<!-- eof --><hr><p>This file is part of the <a href="index.html">Qt toolkit</a>.Copyright © 1995-2002<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center><table width=100% cellspacing=0 border=0><tr><td>Copyright © 2002 <a href="http://www.trolltech.com">Trolltech</a><td><a href="http://www.trolltech.com/trademarks.html">Trademarks</a><td align=right><div align=right>Qt version 3.0.5</div></table></div></address></body></html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?