summaryrefslogtreecommitdiffstats
path: root/doc/man/man3/tqcombobox.3qt
blob: 76cf4bf928cb478f7146356eb0fe4ce69d85da09 (plain)
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
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
'\" t
.TH QComboBox 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*-
.\" Copyright 1992-2007 Trolltech ASA.  All rights reserved.  See the
.\" license file included in the distribution for a complete license
.\" statement.
.\"
.ad l
.nh
.SH NAME
QComboBox \- Combined button and popup list
.SH SYNOPSIS
\fC#include <ntqcombobox.h>\fR
.PP
Inherits QWidget.
.PP
.SS "Public Members"
.in +1c
.ti -1c
.BI "\fBQComboBox\fR ( QWidget * parent = 0, const char * name = 0 )"
.br
.ti -1c
.BI "\fBQComboBox\fR ( bool rw, QWidget * parent = 0, const char * name = 0 )"
.br
.ti -1c
.BI "\fB~QComboBox\fR ()"
.br
.ti -1c
.BI "int \fBcount\fR () const"
.br
.ti -1c
.BI "void \fBinsertStringList\fR ( const QStringList & list, int index = -1 )"
.br
.ti -1c
.BI "void \fBinsertStrList\fR ( const QStrList & list, int index = -1 )"
.br
.ti -1c
.BI "void \fBinsertStrList\fR ( const QStrList * list, int index = -1 )"
.br
.ti -1c
.BI "void \fBinsertStrList\fR ( const char ** strings, int numStrings = -1, int index = -1 )"
.br
.ti -1c
.BI "void \fBinsertItem\fR ( const QString & t, int index = -1 )"
.br
.ti -1c
.BI "void \fBinsertItem\fR ( const QPixmap & pixmap, int index = -1 )"
.br
.ti -1c
.BI "void \fBinsertItem\fR ( const QPixmap & pixmap, const QString & text, int index = -1 )"
.br
.ti -1c
.BI "void \fBremoveItem\fR ( int index )"
.br
.ti -1c
.BI "int \fBcurrentItem\fR () const"
.br
.ti -1c
.BI "virtual void \fBsetCurrentItem\fR ( int index )"
.br
.ti -1c
.BI "QString \fBcurrentText\fR () const"
.br
.ti -1c
.BI "virtual void \fBsetCurrentText\fR ( const QString & )"
.br
.ti -1c
.BI "QString \fBtext\fR ( int index ) const"
.br
.ti -1c
.BI "const QPixmap * \fBpixmap\fR ( int index ) const"
.br
.ti -1c
.BI "void \fBchangeItem\fR ( const QString & t, int index )"
.br
.ti -1c
.BI "void \fBchangeItem\fR ( const QPixmap & im, int index )"
.br
.ti -1c
.BI "void \fBchangeItem\fR ( const QPixmap & im, const QString & t, int index )"
.br
.ti -1c
.BI "bool autoResize () const  \fI(obsolete)\fR"
.br
.ti -1c
.BI "virtual void setAutoResize ( bool )  \fI(obsolete)\fR"
.br
.ti -1c
.BI "virtual void \fBsetPalette\fR ( const QPalette & palette )"
.br
.ti -1c
.BI "virtual void \fBsetFont\fR ( const QFont & font )"
.br
.ti -1c
.BI "virtual void \fBsetSizeLimit\fR ( int )"
.br
.ti -1c
.BI "int \fBsizeLimit\fR () const"
.br
.ti -1c
.BI "virtual void \fBsetMaxCount\fR ( int )"
.br
.ti -1c
.BI "int \fBmaxCount\fR () const"
.br
.ti -1c
.BI "enum \fBPolicy\fR { NoInsertion, AtTop, AtCurrent, AtBottom, AfterCurrent, BeforeCurrent }"
.br
.ti -1c
.BI "virtual void \fBsetInsertionPolicy\fR ( Policy policy )"
.br
.ti -1c
.BI "Policy \fBinsertionPolicy\fR () const"
.br
.ti -1c
.BI "virtual void \fBsetValidator\fR ( const QValidator * v )"
.br
.ti -1c
.BI "const QValidator * \fBvalidator\fR () const"
.br
.ti -1c
.BI "virtual void \fBsetListBox\fR ( QListBox * newListBox )"
.br
.ti -1c
.BI "QListBox * \fBlistBox\fR () const"
.br
.ti -1c
.BI "virtual void \fBsetLineEdit\fR ( QLineEdit * edit )"
.br
.ti -1c
.BI "QLineEdit * \fBlineEdit\fR () const"
.br
.ti -1c
.BI "virtual void \fBsetAutoCompletion\fR ( bool )"
.br
.ti -1c
.BI "bool \fBautoCompletion\fR () const"
.br
.ti -1c
.BI "void \fBsetDuplicatesEnabled\fR ( bool enable )"
.br
.ti -1c
.BI "bool \fBduplicatesEnabled\fR () const"
.br
.ti -1c
.BI "bool \fBeditable\fR () const"
.br
.ti -1c
.BI "void \fBsetEditable\fR ( bool )"
.br
.ti -1c
.BI "virtual void \fBpopup\fR ()"
.br
.in -1c
.SS "Public Slots"
.in +1c
.ti -1c
.BI "void \fBclear\fR ()"
.br
.ti -1c
.BI "void \fBclearValidator\fR ()"
.br
.ti -1c
.BI "void \fBclearEdit\fR ()"
.br
.ti -1c
.BI "virtual void \fBsetEditText\fR ( const QString & newText )"
.br
.in -1c
.SS "Signals"
.in +1c
.ti -1c
.BI "void \fBactivated\fR ( int index )"
.br
.ti -1c
.BI "void \fBhighlighted\fR ( int index )"
.br
.ti -1c
.BI "void \fBactivated\fR ( const QString & string )"
.br
.ti -1c
.BI "void \fBhighlighted\fR ( const QString & string )"
.br
.ti -1c
.BI "void \fBtextChanged\fR ( const QString & string )"
.br
.in -1c
.SS "Properties"
.in +1c
.ti -1c
.BI "bool \fBautoCompletion\fR - whether auto-completion is enabled"
.br
.ti -1c
.BI "bool \fBautoMask\fR - whether the combobox is automatically masked  \fI(read " "only" ")\fR"
.br
.ti -1c
.BI "bool autoResize - whether auto resize is enabled  \fI(obsolete)\fR"
.br
.ti -1c
.BI "int \fBcount\fR - the number of items in the combobox  \fI(read " "only" ")\fR"
.br
.ti -1c
.BI "int \fBcurrentItem\fR - the index of the current item in the combobox"
.br
.ti -1c
.BI "QString \fBcurrentText\fR - the text of the combobox's current item"
.br
.ti -1c
.BI "bool \fBduplicatesEnabled\fR - whether duplicates are allowed"
.br
.ti -1c
.BI "bool \fBeditable\fR - whether the combobox is editable"
.br
.ti -1c
.BI "Policy \fBinsertionPolicy\fR - the position of the items inserted by the user"
.br
.ti -1c
.BI "int \fBmaxCount\fR - the maximum number of items allowed in the combobox"
.br
.ti -1c
.BI "int \fBsizeLimit\fR - the maximum on-screen size of the combobox"
.br
.in -1c
.SH DESCRIPTION
The QComboBox widget is a combined button and popup list.
.PP
A combobox is a selection widget which displays the current item and can pop up a list of items. A combobox may be editable in which case the user can enter arbitrary strings.
.PP
Comboboxes provide a means of showing the user's current choice out of a list of options in a way that takes up the minimum amount of screen space.
.PP
QComboBox supports three different display styles: Aqua/Motif 1.x, Motif 2.0 and Windows. In Motif 1.x, a combobox was called XmOptionMenu. In Motif 2.0, OSF introduced an improved combobox and named that XmComboBox. QComboBox provides both.
.PP
QComboBox provides two different constructors. The simplest constructor creates an "old-style" combobox in Motif (or Aqua) style:
.PP
.nf
.br
        QComboBox *c = new QComboBox( this, "read-only combobox" );
.br
.fi
.PP
The other constructor creates a new-style combobox in Motif style, and can create both read-only and editable comboboxes:
.PP
.nf
.br
        QComboBox *c1 = new QComboBox( FALSE, this, "read-only combobox" );
.br
        QComboBox *c2 = new QComboBox( TRUE, this, "editable combobox" );
.br
.fi
.PP
New-style comboboxes 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 with sizeLimit() and setMaxCount() respectively. Old-style comboboxes use a popup in Aqua and Motif style, and that popup will happily grow larger than the desktop if you put enough data into it.
.PP
The two constructors create identical-looking comboboxes in Windows style.
.PP
Comboboxes can contain pixmaps as well as strings; the insertItem() and changeItem() functions are suitably overloaded. For editable comboboxes, the function clearEdit() is provided, to clear the displayed string without changing the combobox's contents.
.PP
A combobox emits two signals, activated() and highlighted(), when a new item has been activated (selected) or highlighted (made current). Both signals exist in two versions, one with a QString argument and one with an \fCint\fR argument. If the user highlights or activates a pixmap, only the \fCint\fR signals are emitted. Whenever the text of an editable combobox is changed the textChanged() signal is emitted.
.PP
When the user enters a new string in an editable combobox, the widget may or may not insert it, and it can insert it in several locations. The default policy is is AtBottom but you can change this using setInsertionPolicy().
.PP
It is possible to constrain the input to an editable combobox using QValidator; see setValidator(). By default, any input is accepted.
.PP
If the combobox is not editable then it has a default focusPolicy() of TabFocus, i.e. it will not grab focus if clicked. This differs from both Windows and Motif. If the combobox is editable then it has a default focusPolicy() of StrongFocus, i.e. it will grab focus if clicked.
.PP
A combobox can be populated using the insert functions, insertStringList() and insertItem() for example. Items can be changed with changeItem(). An item can be removed with removeItem() and all items can be removed with clear(). The text of the current item is returned by currentText(), and the text of a numbered item is returned with text(). The current item can be set with setCurrentItem() or setCurrentText(). The number of items in the combobox is returned by count(); the maximum number of items can be set with setMaxCount(). You can allow editing using setEditable(). For editable comboboxes you can set auto-completion using setAutoCompletion() and whether or not the user can add duplicates is set with setDuplicatesEnabled().
.PP
.ce 1
.B "[Image Omitted]"
.PP
(Motif 1, read-only)
.br
.ce 1
.B "[Image Omitted]"
.PP
(Motif 2, editable)
.br
.ce 1
.B "[Image Omitted]"
.PP
(Motif 2, read-only)
.br
.ce 1
.B "[Image Omitted]"
.PP
(Windows style)
.PP
Depending on the style, QComboBox will use a QListBox or a QPopupMenu to display the list of items. See setListBox() for more information.
.PP
See also QLineEdit, QListBox, QSpinBox, QRadioButton, QButtonGroup, GUI Design Handbook: Combo Box, GUI Design Handbook: Drop-Down List Box, and Basic Widgets.
.SS "Member Type Documentation"
.SH "QComboBox::Policy"
This enum specifies what the QComboBox should do when a new string is entered by the user.
.TP
\fCQComboBox::NoInsertion\fR - the string will not be inserted into the combobox.
.TP
\fCQComboBox::AtTop\fR - insert the string as the first item in the combobox.
.TP
\fCQComboBox::AtCurrent\fR - replace the previously selected item with the string the user has entered.
.TP
\fCQComboBox::AtBottom\fR - insert the string as the last item in the combobox.
.TP
\fCQComboBox::AfterCurrent\fR - insert the string after the previously selected item.
.TP
\fCQComboBox::BeforeCurrent\fR - insert the string before the previously selected item.
.PP
activated() is always emitted when the string is entered.
.PP
If inserting the new string would cause the combobox 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.
.SH MEMBER FUNCTION DOCUMENTATION
.SH "QComboBox::QComboBox ( QWidget * parent = 0, const char * name = 0 )"
Constructs a combobox widget with parent \fIparent\fR called \fIname\fR.
.PP
This constructor creates a popup list if the program uses Motif (or Aqua) look and feel; this is compatible with Motif 1.x and Aqua.
.PP
Note: If you use this constructor to create your QComboBox, then the pixmap() function will always return 0. To workaround this, use the other constructor.
.SH "QComboBox::QComboBox ( bool rw, QWidget * parent = 0, const char * name = 0 )"
Constructs a combobox with a maximum size and either Motif 2.0 or Windows look and feel.
.PP
The input field can be edited if \fIrw\fR is TRUE, otherwise the user may only choose one of the items in the combobox.
.PP
The \fIparent\fR and \fIname\fR arguments are passed on to the QWidget constructor.
.SH "QComboBox::~QComboBox ()"
Destroys the combobox.
.SH "void QComboBox::activated ( int index )\fC [signal]\fR"
This signal is emitted when a new item has been activated (selected). The \fIindex\fR is the position of the item in the combobox.
.PP
This signal is not emitted if the item is changed programmatically, e.g. using setCurrentItem().
.PP
Examples:
.)l fileiconview/mainwindow.cpp, helpviewer/helpwindow.cpp, lineedits/lineedits.cpp, listboxcombo/listboxcombo.cpp, and qmag/qmag.cpp.
.SH "void QComboBox::activated ( const QString & string )\fC [signal]\fR"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
This signal is emitted when a new item has been activated (selected). \fIstring\fR is the selected string.
.PP
You can also use the activated(int) signal, but be aware that its argument is meaningful only for selected strings, not for user entered strings.
.SH "bool QComboBox::autoCompletion () const"
Returns TRUE if auto-completion is enabled; otherwise returns FALSE. See the "autoCompletion" property for details.
.SH "bool QComboBox::autoResize () const"
Returns TRUE if auto resize is enabled; otherwise returns FALSE. See the "autoResize" property for details.
.SH "void QComboBox::changeItem ( const QString & t, int index )"
Replaces the item at position \fIindex\fR with the text \fIt\fR.
.SH "void QComboBox::changeItem ( const QPixmap & im, int index )"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Replaces the item at position \fIindex\fR with the pixmap \fIim\fR, unless the combobox is editable.
.PP
See also insertItem().
.SH "void QComboBox::changeItem ( const QPixmap & im, const QString & t, int index )"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Replaces the item at position \fIindex\fR with the pixmap \fIim\fR and the text \fIt\fR.
.PP
See also insertItem().
.SH "void QComboBox::clear ()\fC [slot]\fR"
Removes all combobox items.
.SH "void QComboBox::clearEdit ()\fC [slot]\fR"
Clears the line edit without changing the combobox's contents. Does nothing if the combobox isn't editable.
.PP
This is particularly useful when using a combobox as a line edit with history. For example you can connect the combobox's activated() signal to clearEdit() in order to present the user with a new, empty line as soon as Enter is pressed.
.PP
See also setEditText().
.SH "void QComboBox::clearValidator ()\fC [slot]\fR"
This slot is equivalent to setValidator( 0 ).
.SH "int QComboBox::count () const"
Returns the number of items in the combobox. See the "count" property for details.
.SH "int QComboBox::currentItem () const"
Returns the index of the current item in the combobox. See the "currentItem" property for details.
.SH "QString QComboBox::currentText () const"
Returns the text of the combobox's current item. See the "currentText" property for details.
.SH "bool QComboBox::duplicatesEnabled () const"
Returns TRUE if duplicates are allowed; otherwise returns FALSE. See the "duplicatesEnabled" property for details.
.SH "bool QComboBox::editable () const"
Returns TRUE if the combobox is editable; otherwise returns FALSE. See the "editable" property for details.
.SH "void QComboBox::highlighted ( int index )\fC [signal]\fR"
This signal is emitted when a new item has been set to be the current item. The \fIindex\fR is the position of the item in the combobox.
.PP
This signal is not emitted if the item is changed programmatically, e.g. using setCurrentItem().
.SH "void QComboBox::highlighted ( const QString & string )\fC [signal]\fR"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
This signal is emitted when a new item has been set to be the current item. \fIstring\fR is the item's text.
.PP
You can also use the highlighted(int) signal.
.SH "void QComboBox::insertItem ( const QString & t, int index = -1 )"
Inserts a text item with text \fIt\fR, at position \fIindex\fR. The item will be appended if \fIindex\fR is negative.
.PP
Examples:
.)l chart/optionsform.cpp, fileiconview/mainwindow.cpp, helpviewer/helpwindow.cpp, lineedits/lineedits.cpp, listboxcombo/listboxcombo.cpp, regexptester/regexptester.cpp, and tictac/tictac.cpp.
.SH "void QComboBox::insertItem ( const QPixmap & pixmap, int index = -1 )"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Inserts a \fIpixmap\fR item at position \fIindex\fR. The item will be appended if \fIindex\fR is negative.
.SH "void QComboBox::insertItem ( const QPixmap & pixmap, const QString & text, int index = -1 )"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Inserts a \fIpixmap\fR item with additional text \fItext\fR at position \fIindex\fR. The item will be appended if \fIindex\fR is negative.
.SH "void QComboBox::insertStrList ( const char ** strings, int numStrings = -1, int index = -1 )"
Inserts the array of char * \fIstrings\fR at position \fIindex\fR in the combobox.
.PP
The \fInumStrings\fR argument is the number of strings. If \fInumStrings\fR is -1 (default), the \fIstrings\fR array must be terminated with 0.
.PP
Example:
.PP
.nf
.br
        static const char* items[] = { "red", "green", "blue", 0 };
.br
        combo->insertStrList( items );
.br
.fi
.PP
See also insertStringList().
.PP
Example: qmag/qmag.cpp.
.SH "void QComboBox::insertStrList ( const QStrList & list, int index = -1 )"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Inserts the \fIlist\fR of strings at position \fIindex\fR in the combobox.
.PP
This is only for compatibility since it does not support Unicode strings. See insertStringList().
.SH "void QComboBox::insertStrList ( const QStrList * list, int index = -1 )"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Inserts the \fIlist\fR of strings at position \fIindex\fR in the combobox.
.PP
This is only for compatibility since it does not support Unicode strings. See insertStringList().
.SH "void QComboBox::insertStringList ( const QStringList & list, int index = -1 )"
Inserts the \fIlist\fR of strings at position \fIindex\fR in the combobox.
.SH "Policy QComboBox::insertionPolicy () const"
Returns the position of the items inserted by the user. See the "insertionPolicy" property for details.
.SH "QLineEdit * QComboBox::lineEdit () const"
Returns the line edit, or 0 if there is no line edit.
.PP
Only editable listboxes have a line editor.
.SH "QListBox * QComboBox::listBox () const"
Returns the current list box, or 0 if there is no list box. (QComboBox can use QPopupMenu instead of QListBox.) Provided to match setListBox().
.PP
See also setListBox().
.PP
Example: listboxcombo/listboxcombo.cpp.
.SH "int QComboBox::maxCount () const"
Returns the maximum number of items allowed in the combobox. See the "maxCount" property for details.
.SH "const QPixmap * QComboBox::pixmap ( int index ) const"
Returns the pixmap item at position \fIindex\fR, or 0 if the item is not a pixmap.
.SH "void QComboBox::popup ()\fC [virtual]\fR"
Pops up the combobox popup list.
.PP
If the list is empty, no items appear.
.SH "void QComboBox::removeItem ( int index )"
Removes the item at position \fIindex\fR.
.SH "void QComboBox::setAutoCompletion ( bool )\fC [virtual]\fR"
Sets whether auto-completion is enabled. See the "autoCompletion" property for details.
.SH "void QComboBox::setAutoResize ( bool )\fC [virtual]\fR"
Sets whether auto resize is enabled. See the "autoResize" property for details.
.SH "void QComboBox::setCurrentItem ( int index )\fC [virtual]\fR"
Sets the index of the current item in the combobox to \fIindex\fR. See the "currentItem" property for details.
.SH "void QComboBox::setCurrentText ( const QString & )\fC [virtual]\fR"
Sets the text of the combobox's current item. See the "currentText" property for details.
.SH "void QComboBox::setDuplicatesEnabled ( bool enable )"
Sets whether duplicates are allowed to \fIenable\fR. See the "duplicatesEnabled" property for details.
.SH "void QComboBox::setEditText ( const QString & newText )\fC [virtual slot]\fR"
Sets the text in the line edit to \fInewText\fR without changing the combobox's contents. Does nothing if the combobox isn't editable.
.PP
This is useful e.g. for providing a good starting point for the user's editing and entering the change in the combobox only when the user presses Enter.
.PP
See also clearEdit() and insertItem().
.SH "void QComboBox::setEditable ( bool )"
Sets whether the combobox is editable. See the "editable" property for details.
.SH "void QComboBox::setFont ( const QFont & font )\fC [virtual]\fR"
Sets the font for both the combobox button and the combobox popup list to \fIfont\fR.
.PP
Reimplemented from QWidget.
.SH "void QComboBox::setInsertionPolicy ( Policy policy )\fC [virtual]\fR"
Sets the position of the items inserted by the user to \fIpolicy\fR. See the "insertionPolicy" property for details.
.SH "void QComboBox::setLineEdit ( QLineEdit * edit )\fC [virtual]\fR"
Sets the line edit to use \fIedit\fR instead of the current line edit.
.SH "void QComboBox::setListBox ( QListBox * newListBox )\fC [virtual]\fR"
Sets the combobox to use \fInewListBox\fR instead of the current list box or popup. As a side effect, it clears the combobox of its current contents.
.PP
\fBWarning:\fR QComboBox assumes that newListBox->text(n) returns non-null for 0 <= n < newListbox->count(). This assumption is necessary because of the line edit in QComboBox.
.SH "void QComboBox::setMaxCount ( int )\fC [virtual]\fR"
Sets the maximum number of items allowed in the combobox. See the "maxCount" property for details.
.SH "void QComboBox::setPalette ( const QPalette & palette )\fC [virtual]\fR"
Sets the palette for both the combobox button and the combobox popup list to \fIpalette\fR.
.PP
Reimplemented from QWidget.
.SH "void QComboBox::setSizeLimit ( int )\fC [virtual]\fR"
Sets the maximum on-screen size of the combobox. See the "sizeLimit" property for details.
.SH "void QComboBox::setValidator ( const QValidator * v )\fC [virtual]\fR"
Applies the validator \fIv\fR to the combobox so that only text which is valid according to \fIv\fR is accepted.
.PP
This function does nothing if the combobox is not editable.
.PP
See also validator(), clearValidator(), and QValidator.
.SH "int QComboBox::sizeLimit () const"
Returns the maximum on-screen size of the combobox. See the "sizeLimit" property for details.
.SH "QString QComboBox::text ( int index ) const"
Returns the text item at position \fIindex\fR, or QString::null if the item is not a string.
.PP
See also currentText.
.PP
Examples:
.)l fileiconview/mainwindow.cpp and helpviewer/helpwindow.cpp.
.SH "void QComboBox::textChanged ( const QString & string )\fC [signal]\fR"
This signal is used for editable comboboxes. It is emitted whenever the contents of the text entry field changes. \fIstring\fR contains the new text.
.SH "const QValidator * QComboBox::validator () const"
Returns the validator which constrains editing for this combobox if there is one; otherwise returns 0.
.PP
See also setValidator(), clearValidator(), and QValidator.
.SS "Property Documentation"
.SH "bool autoCompletion"
This property holds whether auto-completion is enabled.
.PP
This property can only be set for editable comboboxes, for non-editable comboboxes it has no effect. It is FALSE by default.
.PP
Set this property's value with setAutoCompletion() and get this property's value with autoCompletion().
.SH "bool autoMask"
This property holds whether the combobox is automatically masked.
.PP
See also QWidget::autoMask.
.SH "bool autoResize"
This property holds whether auto resize is enabled.
.PP
\fBThis property is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
.PP
If this property is set to TRUE then the combobox will resize itself whenever its contents change. The default is FALSE.
.PP
Set this property's value with setAutoResize() and get this property's value with autoResize().
.SH "int count"
This property holds the number of items in the combobox.
.PP
Get this property's value with count().
.SH "int currentItem"
This property holds the index of the current item in the combobox.
.PP
Note that the activated() and highlighted() signals are only emitted when the user changes the current item, not when it is changed programmatically.
.PP
Set this property's value with setCurrentItem() and get this property's value with currentItem().
.SH "QString currentText"
This property holds the text of the combobox's current item.
.PP
Set this property's value with setCurrentText() and get this property's value with currentText().
.SH "bool duplicatesEnabled"
This property holds whether duplicates are allowed.
.PP
If the combobox is editable and the user enters some text in the combobox's lineedit and presses Enter (and the insertionPolicy() is not NoInsertion), then what happens is this:
.TP
If the text is not already in the list, the text is inserted.
.TP
If the text is in the list and this property is TRUE (the default), the text is inserted.
.TP
If the text is in the list and this property is FALSE, the text is \fInot\fR inserted; instead the item which has matching text becomes the current item.
.PP
This property only affects user-interaction. You can use insertItem() to insert duplicates if you wish regardless of this setting.
.PP
Set this property's value with setDuplicatesEnabled() and get this property's value with duplicatesEnabled().
.SH "bool editable"
This property holds whether the combobox is editable.
.PP
This property's default is FALSE. Note that the combobox will be cleared if this property is set to TRUE for a 1.x Motif style combobox. To avoid this, use setEditable() before inserting any items. Also note that the 1.x version of Motif didn't have any editable comboboxes, so the combobox will change it's appearance to a 2.0 style Motif combobox is it is set to be editable.
.PP
Set this property's value with setEditable() and get this property's value with editable().
.SH "Policy insertionPolicy"
This property holds the position of the items inserted by the user.
.PP
The default insertion policy is AtBottom. See Policy.
.PP
Set this property's value with setInsertionPolicy() and get this property's value with insertionPolicy().
.SH "int maxCount"
This property holds the maximum number of items allowed in the combobox.
.PP
Set this property's value with setMaxCount() and get this property's value with maxCount().
.SH "int sizeLimit"
This property holds the maximum on-screen size of the combobox.
.PP
This property is ignored for both Motif 1.x style and non-editable comboboxes in Mac style. The default limit is ten lines. If the number of items in the combobox is or grows larger than lines, a scrollbar is added.
.PP
Set this property's value with setSizeLimit() and get this property's value with sizeLimit().

.SH "SEE ALSO"
.BR http://doc.trolltech.com/ntqcombobox.html
.BR http://www.trolltech.com/faq/tech.html
.SH COPYRIGHT
Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com.  See the
license file included in the distribution for a complete license
statement.
.SH AUTHOR
Generated automatically from the source code.
.SH BUGS
If you find a bug in Qt, please report it as described in
.BR http://doc.trolltech.com/bughowto.html .
Good bug reports help us to help you. Thank you.
.P
The definitive TQt documentation is provided in HTML format; it is
located at $QTDIR/doc/html and can be read using TQt Assistant or with
a web browser. This man page is provided as a convenience for those
users who prefer man pages, although this format is not officially
supported by Trolltech. 
.P
If you find errors in this manual page, please report them to
.BR qt-bugs@trolltech.com .
Please include the name of the manual page (tqcombobox.3qt) and the Qt
version (3.3.8).