1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Qt Toolkit - QComboBox 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: white; color: black; }
--></style>
</head><body bgcolor="#ffffff">
<table width="100%">
<tr><td><a href="index.html">
<img width="100" height="100" src="qtlogo.png"
alt="Home" border="0"><img width="100"
height="100" src="face.png" alt="Home" border="0">
</a><td valign=top><div align=right><img src="dochead.png" width="472" height="27"><br>
<a href="classes.html"><b>Classes</b></a>
-<a href="annotated.html">Annotated</a>
- <a href="hierarchy.html">Tree</a>
-<a href="functions.html">Functions</a>
-<a href="index.html">Home</a>
-<a href="topicals.html"><b>Structure</b></a>
</div>
</table>
<h1 align=center>QComboBox Class Reference</h1><br clear="all">
<p>
The QComboBox widget is a combined button and popup list.
<a href="#details">More...</a>
<p>
<code>#include <<a href="qcombobox-h.html">qcombobox.h</a>></code>
<p>
Inherits <a href="qwidget.html">QWidget</a>.
<p><a href="qcombobox-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li><div class="fn"><a href="#9aeaf7"><b>QComboBox</b></a>(QWidget*parent=0, constchar*name=0)</div>
<li><div class="fn"><a href="#37545b"><b>QComboBox</b></a>(boolrw, QWidget*parent=0, constchar*name=0)</div>
<li><div class="fn"><a href="#35a094"><b>~QComboBox</b></a>()</div>
<li><div class="fn">int<a href="#a03e60"><b>count</b></a>()const</div>
<li><div class="fn">void<a href="#10781c"><b>insertStringList</b></a>(constQStringList&, intindex=-1)</div>
<li><div class="fn">void<a href="#82b75f"><b>insertStrList</b></a>(constQStrList&, intindex=-1)</div>
<li><div class="fn">void<a href="#ef14d2"><b>insertStrList</b></a>(constQStrList*, intindex=-1)</div>
<li><div class="fn">void<a href="#ae9e6b"><b>insertStrList</b></a>(constchar**, intnumStrings=-1, intindex=-1)</div>
<li><div class="fn">void<a href="#613b4b"><b>insertItem</b></a>(constQString&text, intindex=-1)</div>
<li><div class="fn">void<a href="#e69827"><b>insertItem</b></a>(constQPixmap&pixmap, intindex=-1)</div>
<li><div class="fn">void<a href="#aa530a"><b>insertItem</b></a>(constQPixmap&pixmap, constQString&text, intindex=-1)</div>
<li><div class="fn">void<a href="#15655e"><b>removeItem</b></a>(intindex)</div>
<li><div class="fn">void<a href="#beb40f"><b>clear</b></a>()</div>
<li><div class="fn">QString<a href="#e985db"><b>currentText</b></a>()const</div>
<li><div class="fn">QString<a href="#ebc661"><b>text</b></a>(intindex)const</div>
<li><div class="fn">constQPixmap*<a href="#3e6262"><b>pixmap</b></a>(intindex)const</div>
<li><div class="fn">void<a href="#c755cf"><b>changeItem</b></a>(constQString&text, intindex)</div>
<li><div class="fn">void<a href="#26ab5b"><b>changeItem</b></a>(constQPixmap&pixmap, intindex)</div>
<li><div class="fn">void<a href="#97d5f8"><b>changeItem</b></a>(constQPixmap&pixmap, constQString&text, intindex)</div>
<li><div class="fn">int<a href="#0481dd"><b>currentItem</b></a>()const</div>
<li><div class="fn">virtualvoid<a href="#8a94f7"><b>setCurrentItem</b></a>(intindex)</div>
<li><div class="fn">boolautoResize()const<em>(obsolete)</em></div>
<li><div class="fn">virtualvoidsetAutoResize(bool)<em>(obsolete)</em></div>
<li><div class="fn">virtualvoid<a href="#a9aac2"><b>setBackgroundColor</b></a>(constQColor&)</div>
<li><div class="fn">virtualvoid<a href="#192486"><b>setPalette</b></a>(constQPalette&)</div>
<li><div class="fn">virtualvoid<a href="#30389c"><b>setFont</b></a>(constQFont&)</div>
<li><div class="fn">virtualvoid<a href="#c10101"><b>setSizeLimit</b></a>(int)</div>
<li><div class="fn">int<a href="#2d833e"><b>sizeLimit</b></a>()const</div>
<li><div class="fn">virtualvoid<a href="#6a0caf"><b>setMaxCount</b></a>(int)</div>
<li><div class="fn">int<a href="#c1ab7a"><b>maxCount</b></a>()const</div>
<li><div class="fn">enum<a href="#Policy"><b>Policy</b></a>{NoInsertion, AtTop, AtCurrent, AtBottom, AfterCurrent, BeforeCurrent}</div>
<li><div class="fn">virtualvoid<a href="#8ff986"><b>setInsertionPolicy</b></a>(Policypolicy)</div>
<li><div class="fn">Policy<a href="#b6284b"><b>insertionPolicy</b></a>()const</div>
<li><div class="fn">virtualvoid<a href="#b77831"><b>setValidator</b></a>(constQValidator*)</div>
<li><div class="fn">constQValidator*<a href="#998bac"><b>validator</b></a>()const</div>
<li><div class="fn">virtualvoid<a href="#48c149"><b>setListBox</b></a>(QListBox*)</div>
<li><div class="fn">QListBox*<a href="#9f2e18"><b>listBox</b></a>()const</div>
<li><div class="fn">QLineEdit*<a href="#1449f9"><b>lineEdit</b></a>()const</div>
<li><div class="fn">virtualvoid<a href="#cbfce9"><b>setAutoCompletion</b></a>(bool)</div>
<li><div class="fn">bool<a href="#2235c8"><b>autoCompletion</b></a>()const</div>
<li><div class="fn">void<a href="#d7dfe3"><b>setDuplicatesEnabled</b></a>(boolenable)</div>
<li><div class="fn">bool<a href="#c049fc"><b>duplicatesEnabled</b></a>()const</div>
<li><div class="fn">bool<a href="#b58b7a"><b>editable</b></a>()const</div>
<li><div class="fn">void<a href="#d9da76"><b>setEditable</b></a>(bool)</div>
</ul>
<h2>Public Slots</h2>
<ul>
<li><div class="fn">void<a href="#ea4710"><b>clearValidator</b></a>()</div>
<li><div class="fn">void<a href="#0daaeb"><b>clearEdit</b></a>()</div>
<li><div class="fn">virtualvoid<a href="#6990ed"><b>setEditText</b></a>(constQString&)</div>
</ul>
<h2>Signals</h2>
<ul>
<li><div class="fn">void<a href="#4faa34"><b>activated</b></a>(intindex)</div>
<li><div class="fn">void<a href="#3cc7d6"><b>highlighted</b></a>(intindex)</div>
<li><div class="fn">void<a href="#7bfc9b"><b>activated</b></a>(constQString&)</div>
<li><div class="fn">void<a href="#fa9b8e"><b>highlighted</b></a>(constQString&)</div>
<li><div class="fn">void<a href="#b658b3"><b>textChanged</b></a>(constQString&)</div>
</ul>
<h2>Protected Members</h2>
<ul>
<li><div class="fn">void<a href="#7c1a7f"><b>popup</b></a>()</div>
</ul>
<h2>Properties</h2>
<table border=1 cellpadding=3 cellspacing=0>
<tr><th>Type<th>Name<th>READ<th>WRITE<th>Options
<tr><td>bool<td>editable<td>editable<td>setEditable<td>
<tr><td>int<td>count<td>count<td> <td>
<tr><td>QString<td>currentText<td>currentText<td> <td>
<tr><td>int<td>currentItem<td>currentItem<td>setCurrentItem<td>
<tr><td>bool<td>autoResize<td>autoResize<td>setAutoResize<td>
<tr><td>int<td>sizeLimit<td>sizeLimit<td>setSizeLimit<td>
<tr><td>int<td>maxCount<td>maxCount<td>setMaxCount<td>
<tr><td>Policy<td>insertionPolicy<td>insertionPolicy<td>setInsertionPolicy<td>
<tr><td>bool<td>autoCompletion<td>autoCompletion<td>setAutoCompletion<td>
<tr><td>bool<td>duplicatesEnabled<td>duplicatesEnabled<td>setDuplicatesEnabled<td>
</table>
<hr><h2><a name="details"></a>Detailed Description</h2>
The QComboBox widget is a combined button and popup list.
<p>
A combo box may be defined as a selection widget which displays the
current selection, and which can pop up a list of possible
selections. Some combo boxes also allow the user to select
arbitrary strings, using a line editor.
<p>Since combo boxes occupy little screen space and always display the
current selection, they are very well suited to displaying and
selecting modes (such as font family and size): The user can always
see what mode he/she is in, and the majority of the screen space is
available for real work.
<p>QComboBox supports three different appearances: Motif 1.x, Motif 2.0
and Windows 95. In Motif 1.x, a combo box was called XmOptionMenu.
In Motif 2.0, OSF introduced an improved combo box and
named that XmComboBox. QComboBox provides both.
<p>QComboBox provides two different constructors. The simplest one
creates an old-style combo box in Motif style:
<pre> <a href="qcombobox.html">QComboBox</a> * c = new <a href="qcombobox.html">QComboBox</a>( this, "read-only combo" );
</pre>
<p>The other one creates a new-style combo box in Motif style, and can
create both read-only and read-write combo boxes:
<pre> <a href="qcombobox.html">QComboBox</a> * c1 = new <a href="qcombobox.html">QComboBox</a>( FALSE, this, "read-only combo" );
<a href="qcombobox.html">QComboBox</a> * c2 = new <a href="qcombobox.html">QComboBox</a>( TRUE, this, "read-write combo" );
</pre>
<p>New-style combo boxes use a list box in both Motif and Windows
styles, and both the content size and the on-screen size of the list
box can be limited. Old-style combo boxes use a popup in Motif
style, and that popup will happily grow larger than the desktop if
you put enough data in it.
<p>The two constructors create identical-looking combos in Windows
style.
<p>Combo boxes can contain pixmaps as well as texts; the
insert() and <a href="#26ab5b">changeItem</a>() functions are suitably overloaded. For
read-write combo boxes, the function <a href="#0daaeb">clearEdit</a>()
is provided, to clear the displayed string without changing the
combo box' contents.
<p>A combo box emits two signals, <a href="#4faa34">activated</a>() and <a href="#3cc7d6">highlighted</a>(), when a
new item has been activated (selected) or highlighted (set to
current). Both signals exist in two versions, one with a <code>char*</code>
argument and one with an <code>int</code> argument. If the user highlights or
activates a pixmap, only the <code>int</code> signals are emitted.
<p>When the user enters a new string in a read-write combo, the widget
may or may not insert it, and it can insert it in several locations.
The default policy is is <code>AtBottom,</code> you can change it using
<a href="#8ff986">setInsertionPolicy</a>().
<p>It is possible to constrain the input to an editable combo box using
<a href="qvalidator.html">QValidator</a>; see <a href="#b77831">setValidator</a>(). By default, all input is accepted.
<p>If the combo box is not editable then it has a default <a href="qwidget.html#3d478d">focusPolicy</a>()
of <code>TabFocus,</code> i.e. it will not grab focus if clicked. This
differs from both Windows and Motif. If the combo box is editable then it
has a default focusPolicy() of <code>StrongFocus,</code> i.e. it will grab focus if
clicked.
<p><img src="qcombo1-m.png">(Motif 1, read-only)<br clear=all>
<img src="qcombo2-m.png">(Motif 2, read-write)<br clear=all>
<img src="qcombo3-m.png">(Motif 2, read-only)<br clear=all>
<img src="qcombo1-w.png">(Windows style)
<p>See also <a href="qlineedit.html">QLineEdit</a>, <a href="qlistbox.html">QListBox</a>, <a href="qspinbox.html">QSpinBox</a>, <a href="qradiobutton.html">QRadioButton</a>, <a href="qbuttongroup.html">QButtonGroup</a>, <a href="guibooks.html#fowler">GUI Design Handbook: Combo Box,</a> and <a href="guibooks.html#fowler">GUI Design Handbook: Drop-Down List Box.</a>
<p>Examples:
<a href="qmag-qmag-cpp.html#QComboBox">qmag/qmag.cpp</a>
<hr><h2>Member Type Documentation</h2>
<h3 class="fn"><a name="Policy">QComboBox::Policy</a></h3>
This enum type specifies what QComboBox should do with a new string
entered by the user. The following policies are defined: <ul>
<li> <code>NoInsertion</code> means not to insert the string in the combo.
<li> <code>AtTop</code> means to insert the string at the top of the combo box.
<li> <code>AtCurrent</code> means to replace the previously selected item with
the typed string.
<li> <code>AtBottom</code> means to insert the string at the bottom of the
combo box.
<li> <code>AfterCurrent</code> means to to insert the string just after the
previously selected item.
<li> <code>BeforeCurrent</code> means to to insert the string just before the
previously selected item.
<p></ul>
<p><a href="#4faa34">activated</a>() is always emitted, of course.
<p>If inserting the new string would cause the combo box to breach
its content size limit, the item at the other end of the list is
deleted. The definition of "other end" is implementation-dependent.
<hr><h2>Member Function Documentation</h2>
<h3 class="fn"><a name="9aeaf7"></a>QComboBox::QComboBox(<a href="qwidget.html">QWidget</a>*parent=0, constchar*name=0)</h3>
<p>Constructs a combo box widget with a parent and a name.
<p>This constructor creates a popup menu if the program uses Motif look
and feel; this is compatible with Motif 1.x.
<h3 class="fn"><a name="37545b"></a>QComboBox::QComboBox(boolrw, <a href="qwidget.html">QWidget</a>*parent=0, constchar*name=0)</h3>
<p>Constructs a combo box with a maximum size and either Motif 2.0 or
Windows look and feel.
<p>The input field can be edited if <em>rw</em> is TRUE, otherwise the user
may only choose one of the items in the combo box.
<h3 class="fn"><a name="35a094"></a>QComboBox::~QComboBox()</h3>
<p>Destructs the combo box.
<h3 class="fn">void<a name="7bfc9b"></a>QComboBox::activated(const<a href="qstring.html">QString</a>&string) <code>[signal]</code></h3>
<p>This signal is emitted when a new item has been activated
(selected). <em>string</em> is the activated string.
<p>You can also use <a href="#4faa34">activated</a>(int) signal, but be aware that its
argument is meaningful only for selected strings, not for typed
strings.
<h3 class="fn">void<a name="4faa34"></a>QComboBox::activated(intindex) <code>[signal]</code></h3>
<p>This signal is emitted when a new item has been activated (selected).
The <em>index</em> is the position of the item in the popup list.
<h3 class="fn">bool<a name="2235c8"></a>QComboBox::autoCompletion()const</h3>
<p>Returns TRUE if this combo box is in auto-completion mode.
<p>See also <a href="#cbfce9">setAutoCompletion</a>().
<h3 class="fn">bool<a name="350a45"></a>QComboBox::autoResize()const</h3>
<p><b>This function is obsolete.</b> It is provided to keep old source working, and will probably be removed in a future version of Qt. We strongly advise against using it in new code.<p>
Returns TRUE if auto-resizing is enabled, or FALSE if auto-resizing is
disabled.
<p>Auto-resizing is disabled by default.
<p>See also <a href="#9941f7">setAutoResize</a>().
<h3 class="fn">void<a name="97d5f8"></a>QComboBox::changeItem(const<a href="qpixmap.html">QPixmap</a>&im, const<a href="qstring.html">QString</a>&t, intindex)</h3>
<p>Replaces the item at position <em>index</em> with a pixmap plus text.
<p>See also <a href="#613b4b">insertItem</a>().
<h3 class="fn">void<a name="26ab5b"></a>QComboBox::changeItem(const<a href="qpixmap.html">QPixmap</a>&im, intindex)</h3>
<p>Replaces the item at position <em>index</em> with a pixmap, unless the
combo box is writable.
<p>See also <a href="#613b4b">insertItem</a>().
<h3 class="fn">void<a name="c755cf"></a>QComboBox::changeItem(const<a href="qstring.html">QString</a>&t, intindex)</h3>
<p>Replaces the item at position <em>index</em> with a text.
<h3 class="fn">void<a name="beb40f"></a>QComboBox::clear()</h3>
<p>Removes all combo box items.
<h3 class="fn">void<a name="0daaeb"></a>QComboBox::clearEdit() <code>[slot]</code></h3>
<p>Clears the line edit without changing the combo's contents. Does
nothing if the combo isn't editable.
<p>This is particularly handy when using a combo box as a line edit
with history. For example you can connect the combo's <a href="#4faa34">activated</a>()
signal to clearEdit() in order to present the user with a new, empty
line as soon as return is pressed.
<p>See also <a href="#6990ed">setEditText</a>().
<h3 class="fn">void<a name="ea4710"></a>QComboBox::clearValidator() <code>[slot]</code></h3>
<p>This slot is equivalent to <a href="#b77831">setValidator</a>( 0 ).
<h3 class="fn">int<a name="a03e60"></a>QComboBox::count()const</h3>
<p>Returns the number of items in the combo box.
<h3 class="fn">int<a name="0481dd"></a>QComboBox::currentItem()const</h3>
<p>Returns the index of the current combo box item.
<p>See also <a href="#8a94f7">setCurrentItem</a>().
<h3 class="fn"><a href="qstring.html">QString</a><a name="e985db"></a>QComboBox::currentText()const</h3>
<p>Returns the text item being edited, or the current text item if the combo
box is not editable.
<p>See also <a href="#ebc661">text</a>().
<h3 class="fn">bool<a name="c049fc"></a>QComboBox::duplicatesEnabled()const</h3>
<p>Returns TRUE if the same text can be inserted multiple times
into the list of the combobox, else FALSE.
<p>See also <a href="#d7dfe3">setDuplicatesEnabled</a>();.
<h3 class="fn">bool<a name="b58b7a"></a>QComboBox::editable()const</h3>
<p>Returns whether the combobox is editable or not.
<p>See also <a href="#d9da76">setEditable</a>().
<h3 class="fn">bool<a name="e7e973"></a>QComboBox::eventFilter(<a href="qobject.html">QObject</a>*object, <a href="qevent.html">QEvent</a>*event) <code>[virtual]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qobject.html#bd20fe">QObject.</a>
<h3 class="fn">void<a name="f318de"></a>QComboBox::focusInEvent(<a href="qfocusevent.html">QFocusEvent</a>*e) <code>[virtualprotected]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qwidget.html#21a4b8">QWidget.</a>
<h3 class="fn">void<a name="fa9b8e"></a>QComboBox::highlighted(const<a href="qstring.html">QString</a>&string) <code>[signal]</code></h3>
<p>This signal is emitted when a new item has been highlighted. <em>string</em> is the highlighted string.
<p>You can also use <a href="#3cc7d6">highlighted</a>(int) signal.
<h3 class="fn">void<a name="3cc7d6"></a>QComboBox::highlighted(intindex) <code>[signal]</code></h3>
<p>This signal is emitted when a new item has been set to current.
The <em>index</em> is the position of the item in the popup list.
<h3 class="fn">void<a name="aa530a"></a>QComboBox::insertItem(const<a href="qpixmap.html">QPixmap</a>&pixmap, const<a href="qstring.html">QString</a>&text, intindex=-1)</h3>
<p>Inserts a pixmap item with additional text <em>text</em> at position <em>index.</em> The item will be appended if <em>index</em> is negative.
<h3 class="fn">void<a name="e69827"></a>QComboBox::insertItem(const<a href="qpixmap.html">QPixmap</a>&pixmap, intindex=-1)</h3>
<p>Inserts a pixmap item at position <em>index.</em> The item will be appended if
<em>index</em> is negative.
<h3 class="fn">void<a name="613b4b"></a>QComboBox::insertItem(const<a href="qstring.html">QString</a>&t, intindex=-1)</h3>
<p>Inserts a text item at position <em>index.</em> The item will be appended if
<em>index</em> is negative.
<h3 class="fn">void<a name="ef14d2"></a>QComboBox::insertStrList(const<a href="qstrlist.html">QStrList</a>*list, intindex=-1)</h3>
<p>Inserts the list of strings at the index <em>index</em> in the combo box.
<p>This is only for compatibility, as it does not support Unicode
strings. See <a href="#10781c">insertStringList</a>().
<h3 class="fn">void<a name="ae9e6b"></a>QComboBox::insertStrList(constchar**strings, intnumStrings=-1, intindex=-1)</h3>
<p>Inserts the array of ASCII strings at the index <em>index</em> in the combo box.
<p>The <em>numStrings</em> argument is the number of strings.
If <em>numStrings</em> is -1 (default), the <em>strs</em> array must be
terminated with 0.
<p>Example:
<pre> static const char* items[] = { "red", "green", "blue", 0 };
combo->insertStrList( items );
</pre>
<p>Examples:
<a href="qmag-qmag-cpp.html#insertStrList">qmag/qmag.cpp</a>
<h3 class="fn">void<a name="82b75f"></a>QComboBox::insertStrList(const<a href="qstrlist.html">QStrList</a>&list, intindex=-1)</h3>
<p>This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
<h3 class="fn">void<a name="10781c"></a>QComboBox::insertStringList(const<a href="qstringlist.html">QStringList</a>&list, intindex=-1)</h3>
<p>Inserts the list of strings at the index <em>index</em> in the combo box.
<h3 class="fn">QComboBox::Policy<a name="b6284b"></a>QComboBox::insertionPolicy()const</h3>
<p>Returns the current insertion policy of the combo box.
<p>See also <a href="#8ff986">setInsertionPolicy</a>().
<h3 class="fn">void<a name="a5e157"></a>QComboBox::keyPressEvent(<a href="qkeyevent.html">QKeyEvent</a>*e) <code>[virtualprotected]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qwidget.html#0a4482">QWidget.</a>
<h3 class="fn"><a href="qlineedit.html">QLineEdit</a>*<a name="1449f9"></a>QComboBox::lineEdit()const</h3>
<p>Returns the line editor, or 0 if there is no line editor currently.
<p>Only editable listboxes have a line editor.
<h3 class="fn"><a href="qlistbox.html">QListBox</a>*<a name="9f2e18"></a>QComboBox::listBox()const</h3>
<p>Returns the current list box, or 0 if there is no list box
currently. (QComboBox can use <a href="qpopupmenu.html">QPopupMenu</a> instead of <a href="qlistbox.html">QListBox</a>.)
Provided to match <a href="#48c149">setListBox</a>().
<p>See also <a href="#48c149">setListBox</a>().
<h3 class="fn">int<a name="c1ab7a"></a>QComboBox::maxCount()const</h3>
<p>Returns the current maximum size of the combo box. By default,
there is no limit, so this function returns INT_MAX.
<p>See also <a href="#6a0caf">setMaxCount</a>() and <a href="#a03e60">count</a>().
<h3 class="fn">void<a name="011a20"></a>QComboBox::mouseDoubleClickEvent(<a href="qmouseevent.html">QMouseEvent</a>*e) <code>[virtualprotected]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qwidget.html#e36586">QWidget.</a>
<h3 class="fn">void<a name="4d11c4"></a>QComboBox::mouseMoveEvent(<a href="qmouseevent.html">QMouseEvent</a>*) <code>[virtualprotected]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qwidget.html#a51d92">QWidget.</a>
<h3 class="fn">void<a name="14ceab"></a>QComboBox::mousePressEvent(<a href="qmouseevent.html">QMouseEvent</a>*e) <code>[virtualprotected]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qwidget.html#2ecc04">QWidget.</a>
<h3 class="fn">void<a name="7dbbb8"></a>QComboBox::mouseReleaseEvent(<a href="qmouseevent.html">QMouseEvent</a>*) <code>[virtualprotected]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qwidget.html#9aa77f">QWidget.</a>
<h3 class="fn">void<a name="f737b9"></a>QComboBox::paintEvent(<a href="qpaintevent.html">QPaintEvent</a>*) <code>[virtualprotected]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qwidget.html#e3d821">QWidget.</a>
<h3 class="fn">const<a href="qpixmap.html">QPixmap</a>*<a name="3e6262"></a>QComboBox::pixmap(intindex)const</h3>
<p>Returns the pixmap item at a given index, or 0 if the item is not a pixmap.
<h3 class="fn">void<a name="7c1a7f"></a>QComboBox::popup() <code>[protected]</code></h3>
<p>Popups the combo box popup list.
<p>If the list is empty, no selections appear.
<h3 class="fn">void<a name="15655e"></a>QComboBox::removeItem(intindex)</h3>
<p>Removes the item at position <em>index.</em>
<h3 class="fn">void<a name="4631c5"></a>QComboBox::resizeEvent(<a href="qresizeevent.html">QResizeEvent</a>*e) <code>[virtualprotected]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qwidget.html#7d375f">QWidget.</a>
<h3 class="fn">void<a name="cbfce9"></a>QComboBox::setAutoCompletion(boolenable) <code>[virtual]</code></h3>
<p>Sets this combo box to offer auto-completion while the user is
editing if <em>enable</em> is TRUE, or not to offer auto-completion of <em>enable</em> is FALSE (the default).
<p>The combo box uses the list of items as candidates for completion.
<p>Note: This will only work on editable combo boxes, so make the combo
box editable before you call this function or it will not work.
<p>See also <a href="#2235c8">autoCompletion</a>() and <a href="#6990ed">setEditText</a>().
<h3 class="fn">void<a name="9941f7"></a>QComboBox::setAutoResize(boolenable) <code>[virtual]</code></h3>
<p><b>This function is obsolete.</b> It is provided to keep old source working, and will probably be removed in a future version of Qt. We strongly advise against using it in new code.<p>
Enables auto-resizing if <em>enable</em> is TRUE, or disables it if <em>enable</em> is
FALSE.
<p>When auto-resizing is enabled, the combo box button will resize itself
whenever the current combo box item change.
<p>See also <a href="#350a45">autoResize</a>() and <a href="qwidget.html#2ec710">adjustSize</a>().
<h3 class="fn">void<a name="a9aac2"></a>QComboBox::setBackgroundColor(const<a href="qcolor.html">QColor</a>&color) <code>[virtual]</code></h3>
<p>Reimplements <a href="qwidget.html#c09181">QWidget::setBackgroundColor</a>().
<p>Sets the background color for both the combo box button and the
combo box popup list.
<h3 class="fn">void<a name="8a94f7"></a>QComboBox::setCurrentItem(intindex) <code>[virtual]</code></h3>
<p>Sets the current combo box item.
This is the item to be displayed on the combo box button.
<p>See also <a href="#0481dd">currentItem</a>().
<p>Examples:
<a href="qmag-qmag-cpp.html#setCurrentItem">qmag/qmag.cpp</a>
<h3 class="fn">void<a name="d7dfe3"></a>QComboBox::setDuplicatesEnabled(boolenable)</h3>
<p>If the combobox is editable and the user enters some text in
the lineedit of the combobox and presses return (and the <a href="#b6284b">insertionPolicy</a>()
is different from <code>NoInsertion),</code> the entered text is inserted into the
list of this combobox. Now, if you set <em>enable</em> to TRUE here,
this new text is always inserted, else it's only inserted if it
doesn't already exist in the list. If you set <em>enable</em> to FALSE
and the text exists already in the list, the item which contains
the same text like which should be inserted, this item
gets the new current item.
<p>This setting only applies when the user want's to insert a text
with pressing the return key. It does <em>not</em> affect methods like
<a href="#613b4b">insertItem</a>() and similar.
<h3 class="fn">void<a name="6990ed"></a>QComboBox::setEditText(const<a href="qstring.html">QString</a>&newText) <code>[virtualslot]</code></h3>
<p>Sets the text in the embedded line edit to <em>newText</em> without
changing the combo's contents. Does nothing if the combo isn't
editable.
<p>This is useful e.g. for providing a good starting point for the
user's editing and entering the change in the combo only when the
user presses enter.
<p>See also <a href="#0daaeb">clearEdit</a>() and <a href="#613b4b">insertItem</a>().
<h3 class="fn">void<a name="d9da76"></a>QComboBox::setEditable(booly)</h3>
<p>Make the input field editable, if <em>y</em> is TRUE. Otherwise the user
may only choose one of the items in the combo box.
<p>See also <a href="#b58b7a">editable</a>().
<h3 class="fn">void<a name="f77832"></a>QComboBox::setEnabled(boolenable) <code>[virtual]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<h3 class="fn">void<a name="30389c"></a>QComboBox::setFont(const<a href="qfont.html">QFont</a>&font) <code>[virtual]</code></h3>
<p>Reimplements <a href="qwidget.html#090d60">QWidget::setFont</a>().
<p>Sets the font for both the combo box button and the
combo box popup list.
<h3 class="fn">void<a name="8ff986"></a>QComboBox::setInsertionPolicy(<a href="qcombobox.html#Policy">Policy</a>policy)</h3>
<p>Sets the insertion policy of the combo box to <em>policy.</em>
<p>The insertion policy governs where items typed in by the user are
inserted in the list. The possible values are <ul> <li> <code>NoInsertion:</code> Strings typed by the user aren't inserted anywhere <li>
<code>AtTop:</code> Strings typed by the user are inserted above the top item
in the list <li> AtCurrent: Strings typed by the user replace the
last selected item <li> AtBottom: Strings typed by the user are
inserted at the bottom of the list. </ul>
<p>The default insertion policy is <code>AtBottom.</code>
<p>See also <a href="#b6284b">insertionPolicy</a>().
<h3 class="fn">void<a name="48c149"></a>QComboBox::setListBox(<a href="qlistbox.html">QListBox</a>*newListBox) <code>[virtual]</code></h3>
<p>Sets the combo box to use <em>newListBox</em> instead of the current
list box or popup. As a side effect, clears the combo box of its
current contents.<p><b>Warning:</b> QComboBox assumes that newListBox-><a href="#ebc661">text</a>(<a href="n.html">n</a>) returns
non-null for 0 <= n < newListbox-><a href="#a03e60">count</a>(). This assumption is
necessary because of the line edit in QComboBox.
<h3 class="fn">void<a name="6a0caf"></a>QComboBox::setMaxCount(intcount) <code>[virtual]</code></h3>
<p>Sets the maximum number of items the combo box can hold to <em>count.</em>
<p>If <em>count</em> is smaller than the current number of items, the list is
truncated at the end. There is no limit by default.
<p>See also <a href="#c1ab7a">maxCount</a>() and <a href="#a03e60">count</a>().
<h3 class="fn">void<a name="192486"></a>QComboBox::setPalette(const<a href="qpalette.html">QPalette</a>&palette) <code>[virtual]</code></h3>
<p>Reimplements <a href="qwidget.html#d7e4b9">QWidget::setPalette</a>().
<p>Sets the palette for both the combo box button and the
combo box popup list.
<h3 class="fn">void<a name="c10101"></a>QComboBox::setSizeLimit(intlines) <code>[virtual]</code></h3>
<p>Sets the maximum on-screen size of the combo box to <em>lines.</em> This
is disregarded in Motif 1.x style. The default limit is ten lines.
<p>If the number of items in the combo box is/grows larger than
<code>lines,</code> a list box is added.
<p>See also <a href="#2d833e">sizeLimit</a>(), <a href="#a03e60">count</a>() and <a href="#6a0caf">setMaxCount</a>().
<h3 class="fn">void<a name="b77831"></a>QComboBox::setValidator(const<a href="qvalidator.html">QValidator</a>*v) <code>[virtual]</code></h3>
<p>Sets this combo box to be editable only as allowed by <em>v.</em>
<p>This function does nothing if the combo is not editable.
<p>See also <a href="#998bac">validator</a>(), <a href="#ea4710">clearValidator</a>() and <a href="qvalidator.html">QValidator</a>.
<h3 class="fn"><a href="qsize.html">QSize</a><a name="dd19df"></a>QComboBox::sizeHint()const <code>[virtual]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qwidget.html#4511d1">QWidget.</a>
<h3 class="fn">int<a name="2d833e"></a>QComboBox::sizeLimit()const</h3>
<p>Returns the current maximum on-screen size of the combo box. The
default is ten lines.
<p>See also <a href="#c10101">setSizeLimit</a>(), <a href="#a03e60">count</a>() and <a href="#c1ab7a">maxCount</a>().
<h3 class="fn"><a href="qsizepolicy.html">QSizePolicy</a><a name="892ae1"></a>QComboBox::sizePolicy()const <code>[virtual]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<h3 class="fn">void<a name="150d68"></a>QComboBox::styleChange(<a href="qstyle.html">QStyle</a>&s) <code>[virtualprotected]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qwidget.html#5e2e23">QWidget.</a>
<h3 class="fn"><a href="qstring.html">QString</a><a name="ebc661"></a>QComboBox::text(intindex)const</h3>
<p>Returns the text item at a given index, or
<a href="qstring.html#e21796">null string</a>
if the item is not a string.
<p>See also <a href="#e985db">currentText</a>().
<h3 class="fn">void<a name="b658b3"></a>QComboBox::textChanged(const<a href="qstring.html">QString</a>&string) <code>[signal]</code></h3>
<p>This signal is useful for editable comboboxes. It is emitted whenever
the contents of the text entry field changes.
<h3 class="fn">void<a name="eebc58"></a>QComboBox::updateMask() <code>[virtualprotected]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qwidget.html#b8a07f">QWidget.</a>
<h3 class="fn">const<a href="qvalidator.html">QValidator</a>*<a name="998bac"></a>QComboBox::validator()const</h3>
<p>Returns the validator which constrains editing for this combo
box if there is any, or else 0.
<p>See also <a href="#b77831">setValidator</a>(), <a href="#ea4710">clearValidator</a>() and <a href="qvalidator.html">QValidator</a>.
<hr><p>
Search the documentation, FAQ, qt-interest archive and more (uses
<a href="http://www.trolltech.com">www.trolltech.com</a>):<br>
<form method=post action="http://www.trolltech.com/search.cgi">
<input type=hidden name="version" value="2.3.2"><nobr>
<input size="50" name="search"><input type=submit value="Search">
</nobr></form><hr><p>
This file is part of the <a href="index.html">Qt toolkit</a>,
copyright © 1995-2001
<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 2001 Trolltech<td><a href="http://www.trolltech.com/trademarks.html">Trademarks</a>
<td align="right"><div align="right">Qt version 2.3.2</div>
</table></div></address></body></html>
|