[190] | 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/table/qtable.cpp:1154 -->
|
---|
| 3 | <html>
|
---|
| 4 | <head>
|
---|
| 5 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
---|
| 6 | <title>QComboTableItem 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>QComboTableItem Class Reference<br><small>[<a href="table.html">table module</a>]</small></h1>
|
---|
| 33 |
|
---|
| 34 | <p>The QComboTableItem class provides a means of using
|
---|
| 35 | comboboxes in QTables.
|
---|
| 36 | <a href="#details">More...</a>
|
---|
| 37 | <p><tt>#include <<a href="qtable-h.html">qtable.h</a>></tt>
|
---|
| 38 | <p>Inherits <a href="qtableitem.html">QTableItem</a>.
|
---|
| 39 | <p><a href="qcombotableitem-members.html">List of all member functions.</a>
|
---|
| 40 | <h2>Public Members</h2>
|
---|
| 41 | <ul>
|
---|
| 42 | <li class=fn><a href="#QComboTableItem"><b>QComboTableItem</b></a> ( QTable * table, const QStringList & list, bool editable = FALSE )</li>
|
---|
| 43 | <li class=fn><a href="#~QComboTableItem"><b>~QComboTableItem</b></a> ()</li>
|
---|
| 44 | <li class=fn>virtual void <a href="#setCurrentItem"><b>setCurrentItem</b></a> ( int i )</li>
|
---|
| 45 | <li class=fn>virtual void <a href="#setCurrentItem-2"><b>setCurrentItem</b></a> ( const QString & s )</li>
|
---|
| 46 | <li class=fn>int <a href="#currentItem"><b>currentItem</b></a> () const</li>
|
---|
| 47 | <li class=fn>QString <a href="#currentText"><b>currentText</b></a> () const</li>
|
---|
| 48 | <li class=fn>int <a href="#count"><b>count</b></a> () const</li>
|
---|
| 49 | <li class=fn>QString <a href="#text"><b>text</b></a> ( int i ) const</li>
|
---|
| 50 | <li class=fn>virtual void <a href="#setEditable"><b>setEditable</b></a> ( bool b )</li>
|
---|
| 51 | <li class=fn>bool <a href="#isEditable"><b>isEditable</b></a> () const</li>
|
---|
| 52 | <li class=fn>virtual void <a href="#setStringList"><b>setStringList</b></a> ( const QStringList & l )</li>
|
---|
| 53 | <li class=fn>virtual int <a href="#rtti"><b>rtti</b></a> () const</li>
|
---|
| 54 | </ul>
|
---|
| 55 | <hr><a name="details"></a><h2>Detailed Description</h2>
|
---|
| 56 |
|
---|
| 57 |
|
---|
| 58 | The QComboTableItem class provides a means of using
|
---|
| 59 | comboboxes in QTables.
|
---|
| 60 |
|
---|
| 61 | <p>
|
---|
| 62 |
|
---|
| 63 | <p> A QComboTableItem is a table item which looks and behaves like a
|
---|
| 64 | combobox. The advantage of using QComboTableItems rather than real
|
---|
| 65 | comboboxes is that a QComboTableItem uses far less resources than
|
---|
| 66 | real comboboxes in <a href="qtable.html">QTable</a>s. When the cell has the focus it
|
---|
| 67 | displays a real combobox which the user can interact with. When
|
---|
| 68 | the cell does not have the focus the cell <em>looks</em> like a
|
---|
| 69 | combobox. Only text items (i.e. no pixmaps) may be used in
|
---|
| 70 | QComboTableItems.
|
---|
| 71 | <p> QComboTableItem items have the edit type <a href="qtableitem.html#EditType-enum">WhenCurrent</a> (see
|
---|
| 72 | <a href="qtableitem.html#EditType-enum">EditType</a>). The QComboTableItem's list of items is provided by
|
---|
| 73 | a <a href="qstringlist.html">QStringList</a> passed to the constructor.
|
---|
| 74 | <p> The list of items may be changed using <a href="#setStringList">setStringList</a>(). The
|
---|
| 75 | current item can be set with <a href="#setCurrentItem">setCurrentItem</a>() and retrieved with
|
---|
| 76 | <a href="#currentItem">currentItem</a>(). The text of the current item can be obtained with
|
---|
| 77 | <a href="#currentText">currentText</a>(), and the text of a particular item can be retrieved
|
---|
| 78 | with <a href="#text">text</a>().
|
---|
| 79 | <p> If <a href="#isEditable">isEditable</a>() is TRUE the QComboTableItem will permit the user
|
---|
| 80 | to either choose an existing list item, or create a new list item
|
---|
| 81 | by entering their own text; otherwise the user may only choose one
|
---|
| 82 | of the existing list items.
|
---|
| 83 | <p> To populate a table cell with a QComboTableItem use
|
---|
| 84 | <a href="qtable.html#setItem">QTable::setItem</a>().
|
---|
| 85 | <p> QComboTableItems may be deleted with <a href="qtable.html#clearCell">QTable::clearCell</a>().
|
---|
| 86 | <p> QComboTableItems can be distinguished from <a href="qtableitem.html">QTableItem</a>s and
|
---|
| 87 | <a href="qchecktableitem.html">QCheckTableItem</a>s using their Run Time Type Identification
|
---|
| 88 | number (see <a href="#rtti">rtti</a>()).
|
---|
| 89 | <p> <center><img src="qtableitems.png" alt="Table Items"></center>
|
---|
| 90 | <p> <p>See also <a href="qchecktableitem.html">QCheckTableItem</a>, <a href="qtableitem.html">QTableItem</a>, <a href="qcombobox.html">QComboBox</a>, and <a href="advanced.html">Advanced Widgets</a>.
|
---|
| 91 |
|
---|
| 92 | <hr><h2>Member Function Documentation</h2>
|
---|
| 93 | <h3 class=fn><a name="QComboTableItem"></a>QComboTableItem::QComboTableItem ( <a href="qtable.html">QTable</a> * table, const <a href="qstringlist.html">QStringList</a> & list, bool editable = FALSE )
|
---|
| 94 | </h3>
|
---|
| 95 | Creates a combo table item for the table <em>table</em>. The combobox's
|
---|
| 96 | list of items is passed in the <em>list</em> argument. If <em>editable</em> is
|
---|
| 97 | TRUE the user may type in new list items; if <em>editable</em> is FALSE
|
---|
| 98 | the user may only select from the list of items provided.
|
---|
| 99 | <p> By default QComboTableItems cannot be replaced by other table
|
---|
| 100 | items since <a href="qtableitem.html#isReplaceable">isReplaceable</a>() returns FALSE by default.
|
---|
| 101 | <p> <p>See also <a href="qtable.html#clearCell">QTable::clearCell</a>() and <a href="qtableitem.html#EditType-enum">EditType</a>.
|
---|
| 102 |
|
---|
| 103 | <h3 class=fn><a name="~QComboTableItem"></a>QComboTableItem::~QComboTableItem ()
|
---|
| 104 | </h3>
|
---|
| 105 | QComboTableItem destructor.
|
---|
| 106 |
|
---|
| 107 | <h3 class=fn>int <a name="count"></a>QComboTableItem::count () const
|
---|
| 108 | </h3>
|
---|
| 109 | Returns the total number of list items in the combo table item.
|
---|
| 110 |
|
---|
| 111 | <h3 class=fn>int <a name="currentItem"></a>QComboTableItem::currentItem () const
|
---|
| 112 | </h3>
|
---|
| 113 | Returns the index of the combo table item's current list item.
|
---|
| 114 | <p> <p>See also <a href="#setCurrentItem">setCurrentItem</a>().
|
---|
| 115 |
|
---|
| 116 | <h3 class=fn><a href="qstring.html">QString</a> <a name="currentText"></a>QComboTableItem::currentText () const
|
---|
| 117 | </h3>
|
---|
| 118 | Returns the text of the combo table item's current list item.
|
---|
| 119 | <p> <p>See also <a href="#currentItem">currentItem</a>() and <a href="#text">text</a>().
|
---|
| 120 |
|
---|
| 121 | <h3 class=fn>bool <a name="isEditable"></a>QComboTableItem::isEditable () const
|
---|
| 122 | </h3>
|
---|
| 123 | Returns TRUE if the user can add their own list items to the
|
---|
| 124 | combobox's list of items; otherwise returns FALSE.
|
---|
| 125 | <p> <p>See also <a href="#setEditable">setEditable</a>().
|
---|
| 126 |
|
---|
| 127 | <h3 class=fn>int <a name="rtti"></a>QComboTableItem::rtti () const<tt> [virtual]</tt>
|
---|
| 128 | </h3>
|
---|
| 129 |
|
---|
| 130 | <p> Returns 1.
|
---|
| 131 | <p> Make your derived classes return their own values for <a href="#rtti">rtti</a>()to
|
---|
| 132 | distinguish between different table item subclasses. You should
|
---|
| 133 | use values greater than 1000, preferably a large random number, to
|
---|
| 134 | allow for extensions to this class.
|
---|
| 135 | <p> <p>See also <a href="qtableitem.html#rtti">QTableItem::rtti</a>().
|
---|
| 136 |
|
---|
| 137 | <p>Reimplemented from <a href="qtableitem.html#rtti">QTableItem</a>.
|
---|
| 138 | <h3 class=fn>void <a name="setCurrentItem"></a>QComboTableItem::setCurrentItem ( int i )<tt> [virtual]</tt>
|
---|
| 139 | </h3>
|
---|
| 140 | Sets the list item <em>i</em> to be the combo table item's current list
|
---|
| 141 | item.
|
---|
| 142 | <p> <p>See also <a href="#currentItem">currentItem</a>().
|
---|
| 143 |
|
---|
| 144 | <p>Example: <a href="small-table-example-example.html#x2797">table/small-table-demo/main.cpp</a>.
|
---|
| 145 | <h3 class=fn>void <a name="setCurrentItem-2"></a>QComboTableItem::setCurrentItem ( const <a href="qstring.html">QString</a> & s )<tt> [virtual]</tt>
|
---|
| 146 | </h3>
|
---|
| 147 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
---|
| 148 | <p> Sets the list item whose text is <em>s</em> to be the combo table item's
|
---|
| 149 | current list item. Does nothing if no list item has the text <em>s</em>.
|
---|
| 150 | <p> <p>See also <a href="#currentItem">currentItem</a>().
|
---|
| 151 |
|
---|
| 152 | <h3 class=fn>void <a name="setEditable"></a>QComboTableItem::setEditable ( bool b )<tt> [virtual]</tt>
|
---|
| 153 | </h3>
|
---|
| 154 | If <em>b</em> is TRUE the combo table item can be edited, i.e. the user
|
---|
| 155 | may enter a new text item themselves. If <em>b</em> is FALSE the user may
|
---|
| 156 | may only choose one of the existing items.
|
---|
| 157 | <p> <p>See also <a href="#isEditable">isEditable</a>().
|
---|
| 158 |
|
---|
| 159 | <h3 class=fn>void <a name="setStringList"></a>QComboTableItem::setStringList ( const <a href="qstringlist.html">QStringList</a> & l )<tt> [virtual]</tt>
|
---|
| 160 | </h3>
|
---|
| 161 | Sets the list items of this QComboTableItem to the strings in the
|
---|
| 162 | string list <em>l</em>.
|
---|
| 163 |
|
---|
| 164 | <h3 class=fn><a href="qstring.html">QString</a> <a name="text"></a>QComboTableItem::text ( int i ) const
|
---|
| 165 | </h3>
|
---|
| 166 | Returns the text of the combo's list item at index <em>i</em>.
|
---|
| 167 | <p> <p>See also <a href="#currentText">currentText</a>().
|
---|
| 168 |
|
---|
| 169 | <!-- eof -->
|
---|
| 170 | <hr><p>
|
---|
| 171 | This file is part of the <a href="index.html">Qt toolkit</a>.
|
---|
| 172 | Copyright © 1995-2007
|
---|
| 173 | <a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
|
---|
| 174 | <table width=100% cellspacing=0 border=0><tr>
|
---|
| 175 | <td>Copyright © 2007
|
---|
| 176 | <a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
---|
| 177 | <td align=right><div align=right>Qt 3.3.8</div>
|
---|
| 178 | </table></div></address></body>
|
---|
| 179 | </html>
|
---|