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
|
<!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>TQComboBox Class</title>
<style type="text/css"><!--
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>TQComboBox Class Reference</h1>
<p>The TQComboBox widget is a combined button and popup list.
<a href="#details">More...</a>
<p><tt>#include <<a href="tqcombobox-h.html">tqcombobox.h</a>></tt>
<p>Inherits <a href="tqwidget.html">TQWidget</a>.
<p><a href="tqcombobox-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li class=fn><a href="#TQComboBox"><b>TQComboBox</b></a> ( TQWidget * parent = 0, const char * name = 0 )</li>
<li class=fn><a href="#TQComboBox-2"><b>TQComboBox</b></a> ( bool rw, TQWidget * parent = 0, const char * name = 0 )</li>
<li class=fn><a href="#~TQComboBox"><b>~TQComboBox</b></a> ()</li>
<li class=fn>int <a href="#count"><b>count</b></a> () const</li>
<li class=fn>void <a href="#insertStringList"><b>insertStringList</b></a> ( const TQStringList & list, int index = -1 )</li>
<li class=fn>void <a href="#insertStrList-2"><b>insertStrList</b></a> ( const TQStrList & list, int index = -1 )</li>
<li class=fn>void <a href="#insertStrList-3"><b>insertStrList</b></a> ( const TQStrList * list, int index = -1 )</li>
<li class=fn>void <a href="#insertStrList"><b>insertStrList</b></a> ( const char ** strings, int numStrings = -1, int index = -1 )</li>
<li class=fn>void <a href="#insertItem"><b>insertItem</b></a> ( const TQString & t, int index = -1 )</li>
<li class=fn>void <a href="#insertItem-2"><b>insertItem</b></a> ( const TQPixmap & pixmap, int index = -1 )</li>
<li class=fn>void <a href="#insertItem-3"><b>insertItem</b></a> ( const TQPixmap & pixmap, const TQString & text, int index = -1 )</li>
<li class=fn>void <a href="#removeItem"><b>removeItem</b></a> ( int index )</li>
<li class=fn>int <a href="#currentItem"><b>currentItem</b></a> () const</li>
<li class=fn>virtual void <a href="#setCurrentItem"><b>setCurrentItem</b></a> ( int index )</li>
<li class=fn>TQString <a href="#currentText"><b>currentText</b></a> () const</li>
<li class=fn>virtual void <a href="#setCurrentText"><b>setCurrentText</b></a> ( const TQString & )</li>
<li class=fn>TQString <a href="#text"><b>text</b></a> ( int index ) const</li>
<li class=fn>const TQPixmap * <a href="#pixmap"><b>pixmap</b></a> ( int index ) const</li>
<li class=fn>void <a href="#changeItem"><b>changeItem</b></a> ( const TQString & t, int index )</li>
<li class=fn>void <a href="#changeItem-2"><b>changeItem</b></a> ( const TQPixmap & im, int index )</li>
<li class=fn>void <a href="#changeItem-3"><b>changeItem</b></a> ( const TQPixmap & im, const TQString & t, int index )</li>
<li class=fn>bool autoResize () const <em>(obsolete)</em></li>
<li class=fn>virtual void setAutoResize ( bool ) <em>(obsolete)</em></li>
<li class=fn>virtual void <a href="#setPalette"><b>setPalette</b></a> ( const TQPalette & palette )</li>
<li class=fn>virtual void <a href="#setFont"><b>setFont</b></a> ( const TQFont & font )</li>
<li class=fn>virtual void <a href="#setSizeLimit"><b>setSizeLimit</b></a> ( int )</li>
<li class=fn>int <a href="#sizeLimit"><b>sizeLimit</b></a> () const</li>
<li class=fn>virtual void <a href="#setMaxCount"><b>setMaxCount</b></a> ( int )</li>
<li class=fn>int <a href="#maxCount"><b>maxCount</b></a> () const</li>
<li class=fn>enum <a href="#Policy-enum"><b>Policy</b></a> { NoInsertion, AtTop, AtCurrent, AtBottom, AfterCurrent, BeforeCurrent }</li>
<li class=fn>virtual void <a href="#setInsertionPolicy"><b>setInsertionPolicy</b></a> ( Policy policy )</li>
<li class=fn>Policy <a href="#insertionPolicy"><b>insertionPolicy</b></a> () const</li>
<li class=fn>virtual void <a href="#setValidator"><b>setValidator</b></a> ( const TQValidator * v )</li>
<li class=fn>const TQValidator * <a href="#validator"><b>validator</b></a> () const</li>
<li class=fn>virtual void <a href="#setListBox"><b>setListBox</b></a> ( TQListBox * newListBox )</li>
<li class=fn>TQListBox * <a href="#listBox"><b>listBox</b></a> () const</li>
<li class=fn>virtual void <a href="#setLineEdit"><b>setLineEdit</b></a> ( TQLineEdit * edit )</li>
<li class=fn>TQLineEdit * <a href="#lineEdit"><b>lineEdit</b></a> () const</li>
<li class=fn>virtual void <a href="#setAutoCompletion"><b>setAutoCompletion</b></a> ( bool )</li>
<li class=fn>bool <a href="#autoCompletion"><b>autoCompletion</b></a> () const</li>
<li class=fn>void <a href="#setDuplicatesEnabled"><b>setDuplicatesEnabled</b></a> ( bool enable )</li>
<li class=fn>bool <a href="#duplicatesEnabled"><b>duplicatesEnabled</b></a> () const</li>
<li class=fn>bool <a href="#editable"><b>editable</b></a> () const</li>
<li class=fn>void <a href="#setEditable"><b>setEditable</b></a> ( bool )</li>
<li class=fn>virtual void <a href="#popup"><b>popup</b></a> ()</li>
</ul>
<h2>Public Slots</h2>
<ul>
<li class=fn>void <a href="#clear"><b>clear</b></a> ()</li>
<li class=fn>void <a href="#clearValidator"><b>clearValidator</b></a> ()</li>
<li class=fn>void <a href="#clearEdit"><b>clearEdit</b></a> ()</li>
<li class=fn>virtual void <a href="#setEditText"><b>setEditText</b></a> ( const TQString & newText )</li>
</ul>
<h2>Signals</h2>
<ul>
<li class=fn>void <a href="#activated"><b>activated</b></a> ( int index )</li>
<li class=fn>void <a href="#highlighted"><b>highlighted</b></a> ( int index )</li>
<li class=fn>void <a href="#activated-2"><b>activated</b></a> ( const TQString & string )</li>
<li class=fn>void <a href="#highlighted-2"><b>highlighted</b></a> ( const TQString & string )</li>
<li class=fn>void <a href="#textChanged"><b>textChanged</b></a> ( const TQString & string )</li>
</ul>
<h2>Properties</h2>
<ul>
<li class=fn>bool <a href="#autoCompletion-prop"><b>autoCompletion</b></a> - whether auto-completion is enabled</li>
<li class=fn>bool <a href="#autoMask-prop"><b>autoMask</b></a> - whether the combobox is automatically masked <em>(read only)</em></li>
<li class=fn>bool autoResize - whether auto resize is enabled <em>(obsolete)</em></li>
<li class=fn>int <a href="#count-prop"><b>count</b></a> - the number of items in the combobox <em>(read only)</em></li>
<li class=fn>int <a href="#currentItem-prop"><b>currentItem</b></a> - the index of the current item in the combobox</li>
<li class=fn>TQString <a href="#currentText-prop"><b>currentText</b></a> - the text of the combobox's current item</li>
<li class=fn>bool <a href="#duplicatesEnabled-prop"><b>duplicatesEnabled</b></a> - whether duplicates are allowed</li>
<li class=fn>bool <a href="#editable-prop"><b>editable</b></a> - whether the combobox is editable</li>
<li class=fn>Policy <a href="#insertionPolicy-prop"><b>insertionPolicy</b></a> - the position of the items inserted by the user</li>
<li class=fn>int <a href="#maxCount-prop"><b>maxCount</b></a> - the maximum number of items allowed in the combobox</li>
<li class=fn>int <a href="#sizeLimit-prop"><b>sizeLimit</b></a> - the maximum on-screen size of the combobox</li>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>
The TQComboBox widget is a combined button and popup list.
<p>
<p> 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.
<p> 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.
<p> TQComboBox 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. TQComboBox provides both.
<p> TQComboBox provides two different constructors. The simplest
constructor creates an "old-style" combobox in Motif (or Aqua)
style:
<pre>
TQComboBox *c = new TQComboBox( this, "read-only combobox" );
</pre>
<p> The other constructor creates a new-style combobox in Motif style,
and can create both read-only and editable comboboxes:
<pre>
TQComboBox *c1 = new TQComboBox( FALSE, this, "read-only combobox" );
TQComboBox *c2 = new TQComboBox( TRUE, this, "editable combobox" );
</pre>
<p> 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 <a href="#sizeLimit">sizeLimit</a>() and <a href="#setMaxCount">setMaxCount</a>()
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.
<p> The two constructors create identical-looking comboboxes in
Windows style.
<p> Comboboxes can contain pixmaps as well as strings; the
<a href="#insertItem">insertItem</a>() and <a href="#changeItem">changeItem</a>() functions are suitably overloaded.
For editable comboboxes, the function <a href="#clearEdit">clearEdit</a>() is provided,
to clear the displayed string without changing the combobox's
contents.
<p> A combobox emits two signals, <a href="#activated">activated</a>() and <a href="#highlighted">highlighted</a>(), when
a new item has been activated (selected) or highlighted (made
current). Both signals exist in two versions, one with a <a href="tqstring.html">TQString</a> argument and one with an <tt>int</tt> argument. If the user
highlights or activates a pixmap, only the <tt>int</tt> signals are
emitted. Whenever the text of an editable combobox is changed the
<a href="#textChanged">textChanged</a>() signal is emitted.
<p> 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 <a href="#Policy-enum">AtBottom</a> but you can change
this using <a href="#setInsertionPolicy">setInsertionPolicy</a>().
<p> It is possible to constrain the input to an editable combobox
using <a href="tqvalidator.html">TQValidator</a>; see <a href="#setValidator">setValidator</a>(). By default, any input is
accepted.
<p> If the combobox is not editable then it has a default
<a href="tqwidget.html#focusPolicy">focusPolicy</a>() of <a href="tqwidget.html#FocusPolicy-enum">TabFocus</a>, 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 <a href="tqwidget.html#FocusPolicy-enum">StrongFocus</a>,
i.e. it will grab focus if clicked.
<p> A combobox can be populated using the insert functions,
<a href="#insertStringList">insertStringList</a>() and <a href="#insertItem">insertItem</a>() for example. Items can be
changed with <a href="#changeItem">changeItem</a>(). An item can be removed with
<a href="#removeItem">removeItem</a>() and all items can be removed with <a href="#clear">clear</a>(). The text
of the current item is returned by <a href="#currentText">currentText</a>(), and the text of
a numbered item is returned with <a href="#text">text</a>(). The current item can be
set with <a href="#setCurrentItem">setCurrentItem</a>() or <a href="#setCurrentText">setCurrentText</a>(). The number of items
in the combobox is returned by <a href="#count">count</a>(); the maximum number of
items can be set with <a href="#setMaxCount">setMaxCount</a>(). You can allow editing using
<a href="#setEditable">setEditable</a>(). For editable comboboxes you can set auto-completion
using <a href="#setAutoCompletion">setAutoCompletion</a>() and whether or not the user can add
duplicates is set with <a href="#setDuplicatesEnabled">setDuplicatesEnabled</a>().
<p> <img src="tqcombo1-m.png">(Motif 1, read-only)<br clear=all>
<img src="tqcombo2-m.png">(Motif 2, editable)<br clear=all>
<img src="tqcombo3-m.png">(Motif 2, read-only)<br clear=all>
<img src="tqcombo1-w.png">(Windows style)
<p> Depending on the style, TQComboBox will use a <a href="tqlistbox.html">TQListBox</a> or a
<a href="tqpopupmenu.html">TQPopupMenu</a> to display the list of items. See <a href="#setListBox">setListBox</a>() for
more information.
<p> <p>See also <a href="tqlineedit.html">TQLineEdit</a>, <a href="tqlistbox.html">TQListBox</a>, <a href="tqspinbox.html">TQSpinBox</a>, <a href="tqradiobutton.html">TQRadioButton</a>, <a href="tqbuttongroup.html">TQButtonGroup</a>, <a href="guibooks.html#fowler">GUI Design Handbook: Combo Box</a>, <a href="guibooks.html#fowler">GUI Design Handbook: Drop-Down List Box</a>, and <a href="basic.html">Basic Widgets</a>.
<hr><h2>Member Type Documentation</h2>
<h3 class=fn><a name="Policy-enum"></a>TQComboBox::Policy</h3>
<p> This enum specifies what the TQComboBox should do when a new string
is entered by the user.
<ul>
<li><tt>TQComboBox::NoInsertion</tt> - the string will not be inserted into the
combobox.
<li><tt>TQComboBox::AtTop</tt> - insert the string as the first item in the combobox.
<li><tt>TQComboBox::AtCurrent</tt> - replace the previously selected item with the
string the user has entered.
<li><tt>TQComboBox::AtBottom</tt> - insert the string as the last item in the
combobox.
<li><tt>TQComboBox::AfterCurrent</tt> - insert the string after the previously
selected item.
<li><tt>TQComboBox::BeforeCurrent</tt> - insert the string before the previously
selected item.
</ul><p> <a href="#activated">activated</a>() is always emitted when the string is entered.
<p> 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.
<hr><h2>Member Function Documentation</h2>
<h3 class=fn><a name="TQComboBox"></a>TQComboBox::TQComboBox ( <a href="tqwidget.html">TQWidget</a> * parent = 0, const char * name = 0 )
</h3>
Constructs a combobox widget with parent <em>parent</em> called <em>name</em>.
<p> 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.
<p> Note: If you use this constructor to create your TQComboBox, then
the <a href="#pixmap">pixmap</a>() function will always return 0. To workaround this,
use the other constructor.
<p>
<h3 class=fn><a name="TQComboBox-2"></a>TQComboBox::TQComboBox ( bool rw, <a href="tqwidget.html">TQWidget</a> * parent = 0, const char * name = 0 )
</h3>
Constructs a combobox 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 combobox.
<p> The <em>parent</em> and <em>name</em> arguments are passed on to the <a href="tqwidget.html">TQWidget</a>
constructor.
<h3 class=fn><a name="~TQComboBox"></a>TQComboBox::~TQComboBox ()
</h3>
Destroys the combobox.
<h3 class=fn>void <a name="activated"></a>TQComboBox::activated ( int index )<tt> [signal]</tt>
</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
combobox.
<p> This signal is not emitted if the item is changed
programmatically, e.g. using <a href="#setCurrentItem">setCurrentItem</a>().
<p>Examples: <a href="fileiconview-example.html#x877">fileiconview/mainwindow.cpp</a>, <a href="helpviewer-example.html#x981">helpviewer/helpwindow.cpp</a>, <a href="lineedits-example.html#x170">lineedits/lineedits.cpp</a>, <a href="listboxcombo-example.html#x1398">listboxcombo/listboxcombo.cpp</a>, and <a href="qmag-example.html#x1772">qmag/qmag.cpp</a>.
<h3 class=fn>void <a name="activated-2"></a>TQComboBox::activated ( const <a href="tqstring.html">TQString</a> & string )<tt> [signal]</tt>
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> This signal is emitted when a new item has been activated
(selected). <em>string</em> is the selected string.
<p> You can also use the <a href="#activated">activated</a>(int) signal, but be aware that its
argument is meaningful only for selected strings, not for user
entered strings.
<h3 class=fn>bool <a name="autoCompletion"></a>TQComboBox::autoCompletion () const
</h3><p>Returns TRUE if auto-completion is enabled; otherwise returns FALSE.
See the <a href="tqcombobox.html#autoCompletion-prop">"autoCompletion"</a> property for details.
<h3 class=fn>bool <a name="autoResize"></a>TQComboBox::autoResize () const
</h3><p>Returns TRUE if auto resize is enabled; otherwise returns FALSE.
See the <a href="tqcombobox.html#autoResize-prop">"autoResize"</a> property for details.
<h3 class=fn>void <a name="changeItem"></a>TQComboBox::changeItem ( const <a href="tqstring.html">TQString</a> & t, int index )
</h3>
Replaces the item at position <em>index</em> with the text <em>t</em>.
<h3 class=fn>void <a name="changeItem-2"></a>TQComboBox::changeItem ( const <a href="tqpixmap.html">TQPixmap</a> & im, int index )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Replaces the item at position <em>index</em> with the pixmap <em>im</em>,
unless the combobox is editable.
<p> <p>See also <a href="#insertItem">insertItem</a>().
<h3 class=fn>void <a name="changeItem-3"></a>TQComboBox::changeItem ( const <a href="tqpixmap.html">TQPixmap</a> & im, const <a href="tqstring.html">TQString</a> & t, int index )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Replaces the item at position <em>index</em> with the pixmap <em>im</em> and
the text <em>t</em>.
<p> <p>See also <a href="#insertItem">insertItem</a>().
<h3 class=fn>void <a name="clear"></a>TQComboBox::clear ()<tt> [slot]</tt>
</h3>
Removes all combobox items.
<h3 class=fn>void <a name="clearEdit"></a>TQComboBox::clearEdit ()<tt> [slot]</tt>
</h3>
Clears the line edit without changing the combobox's contents.
Does nothing if the combobox isn't editable.
<p> This is particularly useful when using a combobox as a line edit
with history. For example you can connect the combobox's
<a href="#activated">activated</a>() signal to <a href="#clearEdit">clearEdit</a>() in order to present the user
with a new, empty line as soon as Enter is pressed.
<p> <p>See also <a href="#setEditText">setEditText</a>().
<h3 class=fn>void <a name="clearValidator"></a>TQComboBox::clearValidator ()<tt> [slot]</tt>
</h3>
This slot is equivalent to <a href="#setValidator">setValidator</a>( 0 ).
<h3 class=fn>int <a name="count"></a>TQComboBox::count () const
</h3><p>Returns the number of items in the combobox.
See the <a href="tqcombobox.html#count-prop">"count"</a> property for details.
<h3 class=fn>int <a name="currentItem"></a>TQComboBox::currentItem () const
</h3><p>Returns the index of the current item in the combobox.
See the <a href="tqcombobox.html#currentItem-prop">"currentItem"</a> property for details.
<h3 class=fn><a href="tqstring.html">TQString</a> <a name="currentText"></a>TQComboBox::currentText () const
</h3><p>Returns the text of the combobox's current item.
See the <a href="tqcombobox.html#currentText-prop">"currentText"</a> property for details.
<h3 class=fn>bool <a name="duplicatesEnabled"></a>TQComboBox::duplicatesEnabled () const
</h3><p>Returns TRUE if duplicates are allowed; otherwise returns FALSE.
See the <a href="tqcombobox.html#duplicatesEnabled-prop">"duplicatesEnabled"</a> property for details.
<h3 class=fn>bool <a name="editable"></a>TQComboBox::editable () const
</h3><p>Returns TRUE if the combobox is editable; otherwise returns FALSE.
See the <a href="tqcombobox.html#editable-prop">"editable"</a> property for details.
<h3 class=fn>void <a name="highlighted"></a>TQComboBox::highlighted ( int index )<tt> [signal]</tt>
</h3>
<p> This signal is emitted when a new item has been set to be the
current item. The <em>index</em> is the position of the item in the
combobox.
<p> This signal is not emitted if the item is changed
programmatically, e.g. using <a href="#setCurrentItem">setCurrentItem</a>().
<h3 class=fn>void <a name="highlighted-2"></a>TQComboBox::highlighted ( const <a href="tqstring.html">TQString</a> & string )<tt> [signal]</tt>
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> This signal is emitted when a new item has been set to be the
current item. <em>string</em> is the item's text.
<p> You can also use the <a href="#highlighted">highlighted</a>(int) signal.
<h3 class=fn>void <a name="insertItem"></a>TQComboBox::insertItem ( const <a href="tqstring.html">TQString</a> & t, int index = -1 )
</h3>
Inserts a text item with text <em>t</em>, at position <em>index</em>. The item
will be appended if <em>index</em> is negative.
<p>Examples: <a href="tutorial2-09.html#x2633">chart/optionsform.cpp</a>, <a href="fileiconview-example.html#x879">fileiconview/mainwindow.cpp</a>, <a href="helpviewer-example.html#x983">helpviewer/helpwindow.cpp</a>, <a href="lineedits-example.html#x171">lineedits/lineedits.cpp</a>, <a href="listboxcombo-example.html#x1399">listboxcombo/listboxcombo.cpp</a>, <a href="regexptester-example.html#x2479">regexptester/regexptester.cpp</a>, and <a href="tictac-example.html#x23">tictac/tictac.cpp</a>.
<h3 class=fn>void <a name="insertItem-2"></a>TQComboBox::insertItem ( const <a href="tqpixmap.html">TQPixmap</a> & pixmap, int index = -1 )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Inserts a <em>pixmap</em> item at position <em>index</em>. The item will be
appended if <em>index</em> is negative.
<h3 class=fn>void <a name="insertItem-3"></a>TQComboBox::insertItem ( const <a href="tqpixmap.html">TQPixmap</a> & pixmap, const <a href="tqstring.html">TQString</a> & text, int index = -1 )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Inserts a <em>pixmap</em> 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="insertStrList"></a>TQComboBox::insertStrList ( const char ** strings, int numStrings = -1, int index = -1 )
</h3>
Inserts the array of char * <em>strings</em> at position <em>index</em> in the
combobox.
<p> The <em>numStrings</em> argument is the number of strings. If <em>numStrings</em> is -1 (default), the <em>strings</em> array must be
terminated with 0.
<p> Example:
<pre>
static const char* items[] = { "red", "green", "blue", 0 };
combo->insertStrList( items );
</pre>
<p> <p>See also <a href="#insertStringList">insertStringList</a>().
<p>Example: <a href="qmag-example.html#x1773">qmag/qmag.cpp</a>.
<h3 class=fn>void <a name="insertStrList-2"></a>TQComboBox::insertStrList ( const <a href="tqstrlist.html">TQStrList</a> & list, int index = -1 )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Inserts the <em>list</em> of strings at position <em>index</em> in the
combobox.
<p> This is only for compatibility since it does not support Unicode
strings. See <a href="#insertStringList">insertStringList</a>().
<h3 class=fn>void <a name="insertStrList-3"></a>TQComboBox::insertStrList ( const <a href="tqstrlist.html">TQStrList</a> * list, int index = -1 )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Inserts the <em>list</em> of strings at position <em>index</em> in the
combobox.
<p> This is only for compatibility since it does not support Unicode
strings. See <a href="#insertStringList">insertStringList</a>().
<h3 class=fn>void <a name="insertStringList"></a>TQComboBox::insertStringList ( const <a href="tqstringlist.html">TQStringList</a> & list, int index = -1 )
</h3>
Inserts the <em>list</em> of strings at position <em>index</em> in the
combobox.
<h3 class=fn><a href="tqcombobox.html#Policy-enum">Policy</a> <a name="insertionPolicy"></a>TQComboBox::insertionPolicy () const
</h3><p>Returns the position of the items inserted by the user.
See the <a href="tqcombobox.html#insertionPolicy-prop">"insertionPolicy"</a> property for details.
<h3 class=fn><a href="tqlineedit.html">TQLineEdit</a> * <a name="lineEdit"></a>TQComboBox::lineEdit () const
</h3>
Returns the line edit, or 0 if there is no line edit.
<p> Only editable listboxes have a line editor.
<h3 class=fn><a href="tqlistbox.html">TQListBox</a> * <a name="listBox"></a>TQComboBox::listBox () const
</h3>
Returns the current list box, or 0 if there is no list box.
(TQComboBox can use <a href="tqpopupmenu.html">TQPopupMenu</a> instead of <a href="tqlistbox.html">TQListBox</a>.) Provided to
match <a href="#setListBox">setListBox</a>().
<p> <p>See also <a href="#setListBox">setListBox</a>().
<p>Example: <a href="listboxcombo-example.html#x1400">listboxcombo/listboxcombo.cpp</a>.
<h3 class=fn>int <a name="maxCount"></a>TQComboBox::maxCount () const
</h3><p>Returns the maximum number of items allowed in the combobox.
See the <a href="tqcombobox.html#maxCount-prop">"maxCount"</a> property for details.
<h3 class=fn>const <a href="tqpixmap.html">TQPixmap</a> * <a name="pixmap"></a>TQComboBox::pixmap ( int index ) const
</h3>
Returns the pixmap item at position <em>index</em>, or 0 if the item is
not a pixmap.
<h3 class=fn>void <a name="popup"></a>TQComboBox::popup ()<tt> [virtual]</tt>
</h3>
Pops up the combobox popup list.
<p> If the list is empty, no items appear.
<h3 class=fn>void <a name="removeItem"></a>TQComboBox::removeItem ( int index )
</h3>
Removes the item at position <em>index</em>.
<h3 class=fn>void <a name="setAutoCompletion"></a>TQComboBox::setAutoCompletion ( bool )<tt> [virtual]</tt>
</h3><p>Sets whether auto-completion is enabled.
See the <a href="tqcombobox.html#autoCompletion-prop">"autoCompletion"</a> property for details.
<h3 class=fn>void <a name="setAutoResize"></a>TQComboBox::setAutoResize ( bool )<tt> [virtual]</tt>
</h3><p>Sets whether auto resize is enabled.
See the <a href="tqcombobox.html#autoResize-prop">"autoResize"</a> property for details.
<h3 class=fn>void <a name="setCurrentItem"></a>TQComboBox::setCurrentItem ( int index )<tt> [virtual]</tt>
</h3><p>Sets the index of the current item in the combobox to <em>index</em>.
See the <a href="tqcombobox.html#currentItem-prop">"currentItem"</a> property for details.
<h3 class=fn>void <a name="setCurrentText"></a>TQComboBox::setCurrentText ( const <a href="tqstring.html">TQString</a> & )<tt> [virtual]</tt>
</h3><p>Sets the text of the combobox's current item.
See the <a href="tqcombobox.html#currentText-prop">"currentText"</a> property for details.
<h3 class=fn>void <a name="setDuplicatesEnabled"></a>TQComboBox::setDuplicatesEnabled ( bool enable )
</h3><p>Sets whether duplicates are allowed to <em>enable</em>.
See the <a href="tqcombobox.html#duplicatesEnabled-prop">"duplicatesEnabled"</a> property for details.
<h3 class=fn>void <a name="setEditText"></a>TQComboBox::setEditText ( const <a href="tqstring.html">TQString</a> & newText )<tt> [virtual slot]</tt>
</h3>
Sets the text in the line edit to <em>newText</em> without changing the
combobox's contents. Does nothing if the combobox 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 combobox only when
the user presses Enter.
<p> <p>See also <a href="#clearEdit">clearEdit</a>() and <a href="#insertItem">insertItem</a>().
<h3 class=fn>void <a name="setEditable"></a>TQComboBox::setEditable ( bool )
</h3><p>Sets whether the combobox is editable.
See the <a href="tqcombobox.html#editable-prop">"editable"</a> property for details.
<h3 class=fn>void <a name="setFont"></a>TQComboBox::setFont ( const <a href="tqfont.html">TQFont</a> & font )<tt> [virtual]</tt>
</h3>
Sets the font for both the combobox button and the combobox popup
list to <em>font</em>.
<p>Reimplemented from <a href="tqwidget.html#setFont">TQWidget</a>.
<h3 class=fn>void <a name="setInsertionPolicy"></a>TQComboBox::setInsertionPolicy ( <a href="tqcombobox.html#Policy-enum">Policy</a> policy )<tt> [virtual]</tt>
</h3><p>Sets the position of the items inserted by the user to <em>policy</em>.
See the <a href="tqcombobox.html#insertionPolicy-prop">"insertionPolicy"</a> property for details.
<h3 class=fn>void <a name="setLineEdit"></a>TQComboBox::setLineEdit ( <a href="tqlineedit.html">TQLineEdit</a> * edit )<tt> [virtual]</tt>
</h3>
Sets the line edit to use <em>edit</em> instead of the current line edit.
<h3 class=fn>void <a name="setListBox"></a>TQComboBox::setListBox ( <a href="tqlistbox.html">TQListBox</a> * newListBox )<tt> [virtual]</tt>
</h3>
Sets the combobox to use <em>newListBox</em> instead of the current list
box or popup. As a side effect, it clears the combobox of its
current contents.
<p> <b>Warning:</b> TQComboBox assumes that newListBox->text(n) returns
non-null for 0 <= n < newListbox->count(). This assumption is
necessary because of the line edit in TQComboBox.
<h3 class=fn>void <a name="setMaxCount"></a>TQComboBox::setMaxCount ( int )<tt> [virtual]</tt>
</h3><p>Sets the maximum number of items allowed in the combobox.
See the <a href="tqcombobox.html#maxCount-prop">"maxCount"</a> property for details.
<h3 class=fn>void <a name="setPalette"></a>TQComboBox::setPalette ( const <a href="tqpalette.html">TQPalette</a> & palette )<tt> [virtual]</tt>
</h3>
Sets the palette for both the combobox button and the combobox
popup list to <em>palette</em>.
<p>Reimplemented from <a href="tqwidget.html#setPalette">TQWidget</a>.
<h3 class=fn>void <a name="setSizeLimit"></a>TQComboBox::setSizeLimit ( int )<tt> [virtual]</tt>
</h3><p>Sets the maximum on-screen size of the combobox.
See the <a href="tqcombobox.html#sizeLimit-prop">"sizeLimit"</a> property for details.
<h3 class=fn>void <a name="setValidator"></a>TQComboBox::setValidator ( const <a href="tqvalidator.html">TQValidator</a> * v )<tt> [virtual]</tt>
</h3>
Applies the validator <em>v</em> to the combobox so that only text which
is valid according to <em>v</em> is accepted.
<p> This function does nothing if the combobox is not editable.
<p> <p>See also <a href="#validator">validator</a>(), <a href="#clearValidator">clearValidator</a>(), and <a href="tqvalidator.html">TQValidator</a>.
<h3 class=fn>int <a name="sizeLimit"></a>TQComboBox::sizeLimit () const
</h3><p>Returns the maximum on-screen size of the combobox.
See the <a href="tqcombobox.html#sizeLimit-prop">"sizeLimit"</a> property for details.
<h3 class=fn><a href="tqstring.html">TQString</a> <a name="text"></a>TQComboBox::text ( int index ) const
</h3>
Returns the text item at position <em>index</em>, or <a href="tqstring.html#TQString-null">TQString::null</a> if
the item is not a string.
<p> <p>See also <a href="#currentText-prop">currentText</a>.
<p>Examples: <a href="fileiconview-example.html#x882">fileiconview/mainwindow.cpp</a> and <a href="helpviewer-example.html#x985">helpviewer/helpwindow.cpp</a>.
<h3 class=fn>void <a name="textChanged"></a>TQComboBox::textChanged ( const <a href="tqstring.html">TQString</a> & string )<tt> [signal]</tt>
</h3>
<p> This signal is used for editable comboboxes. It is emitted
whenever the contents of the text entry field changes. <em>string</em>
contains the new text.
<h3 class=fn>const <a href="tqvalidator.html">TQValidator</a> * <a name="validator"></a>TQComboBox::validator () const
</h3>
Returns the validator which constrains editing for this combobox
if there is one; otherwise returns 0.
<p> <p>See also <a href="#setValidator">setValidator</a>(), <a href="#clearValidator">clearValidator</a>(), and <a href="tqvalidator.html">TQValidator</a>.
<hr><h2>Property Documentation</h2>
<h3 class=fn>bool <a name="autoCompletion-prop"></a>autoCompletion</h3>
<p>This property holds whether auto-completion is enabled.
<p>This property can only be set for editable comboboxes, for
non-editable comboboxes it has no effect. It is FALSE by default.
<p>Set this property's value with <a href="#setAutoCompletion">setAutoCompletion</a>() and get this property's value with <a href="#autoCompletion">autoCompletion</a>().
<h3 class=fn>bool <a name="autoMask-prop"></a>autoMask</h3>
<p>This property holds whether the combobox is automatically masked.
<p><p><p>See also <a href="tqwidget.html#autoMask-prop">TQWidget::autoMask</a>.
<h3 class=fn>bool <a name="autoResize-prop"></a>autoResize</h3> <p>This property holds whether auto resize is enabled.
<p><b>This property is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
<p> If this property is set to TRUE then the combobox will resize itself
whenever its contents change. The default is FALSE.
<p>Set this property's value with <a href="#setAutoResize">setAutoResize</a>() and get this property's value with <a href="#autoResize">autoResize</a>().
<h3 class=fn>int <a name="count-prop"></a>count</h3>
<p>This property holds the number of items in the combobox.
<p>
<p>Get this property's value with <a href="#count">count</a>().
<h3 class=fn>int <a name="currentItem-prop"></a>currentItem</h3>
<p>This property holds the index of the current item in the combobox.
<p>Note that the <a href="#activated">activated</a>() and <a href="#highlighted">highlighted</a>() signals are only
emitted when the user changes the current item, not when it is
changed programmatically.
<p>Set this property's value with <a href="#setCurrentItem">setCurrentItem</a>() and get this property's value with <a href="#currentItem">currentItem</a>().
<h3 class=fn><a href="tqstring.html">TQString</a> <a name="currentText-prop"></a>currentText</h3>
<p>This property holds the text of the combobox's current item.
<p>
<p>Set this property's value with <a href="#setCurrentText">setCurrentText</a>() and get this property's value with <a href="#currentText">currentText</a>().
<h3 class=fn>bool <a name="duplicatesEnabled-prop"></a>duplicatesEnabled</h3>
<p>This property holds whether duplicates are allowed.
<p>If the combobox is editable and the user enters some text in the
combobox's lineedit and presses Enter (and the <a href="#insertionPolicy">insertionPolicy</a>()
is not <a href="#Policy-enum">NoInsertion</a>), then what happens is this:
<ul>
<li> If the text is not already in the list, the text is inserted.
<li> If the text is in the list and this property is TRUE (the
default), the text is inserted.
<li> If the text is in the list and this property is FALSE, the text
is <em>not</em> inserted; instead the item which has matching text becomes
the current item.
</ul>
<p> This property only affects user-interaction. You can use
<a href="#insertItem">insertItem</a>() to insert duplicates if you wish regardless of this
setting.
<p>Set this property's value with <a href="#setDuplicatesEnabled">setDuplicatesEnabled</a>() and get this property's value with <a href="#duplicatesEnabled">duplicatesEnabled</a>().
<h3 class=fn>bool <a name="editable-prop"></a>editable</h3>
<p>This property holds whether the combobox is editable.
<p>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 <a href="#setEditable">setEditable</a>() 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.
<p>Set this property's value with <a href="#setEditable">setEditable</a>() and get this property's value with <a href="#editable">editable</a>().
<h3 class=fn><a href="tqcombobox.html#Policy-enum">Policy</a> <a name="insertionPolicy-prop"></a>insertionPolicy</h3>
<p>This property holds the position of the items inserted by the user.
<p>The default insertion policy is <a href="#Policy-enum">AtBottom</a>. See <a href="#Policy-enum">Policy</a>.
<p>Set this property's value with <a href="#setInsertionPolicy">setInsertionPolicy</a>() and get this property's value with <a href="#insertionPolicy">insertionPolicy</a>().
<h3 class=fn>int <a name="maxCount-prop"></a>maxCount</h3>
<p>This property holds the maximum number of items allowed in the combobox.
<p>
<p>Set this property's value with <a href="#setMaxCount">setMaxCount</a>() and get this property's value with <a href="#maxCount">maxCount</a>().
<h3 class=fn>int <a name="sizeLimit-prop"></a>sizeLimit</h3>
<p>This property holds the maximum on-screen size of the combobox.
<p>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.
<p>Set this property's value with <a href="#setSizeLimit">setSizeLimit</a>() and get this property's value with <a href="#sizeLimit">sizeLimit</a>().
<!-- eof -->
<hr><p>
This file is part of the <a href="index.html">TQt toolkit</a>.
Copyright © 1995-2007
<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 © 2007
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
<td align=right><div align=right>TQt 3.3.8</div>
</table></div></address></body>
</html>
|