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
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
|
'\" t
.TH QListBox 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
QListBox \- List of selectable, read-only items
.SH SYNOPSIS
\fC#include <qlistbox.h>\fR
.PP
Inherits QScrollView.
.PP
.SS "Public Members"
.in +1c
.ti -1c
.BI "\fBQListBox\fR ( QWidget * parent = 0, const char * name = 0, WFlags f = 0 )"
.br
.ti -1c
.BI "\fB~QListBox\fR ()"
.br
.ti -1c
.BI "uint \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 QListBoxItem * lbi, int index = -1 )"
.br
.ti -1c
.BI "void \fBinsertItem\fR ( const QListBoxItem * lbi, const QListBoxItem * after )"
.br
.ti -1c
.BI "void \fBinsertItem\fR ( const QString & text, 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 "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 QListBoxItem * lbi, int index )"
.br
.ti -1c
.BI "void \fBchangeItem\fR ( const QString & text, int index )"
.br
.ti -1c
.BI "void \fBchangeItem\fR ( const QPixmap & pixmap, int index )"
.br
.ti -1c
.BI "void \fBchangeItem\fR ( const QPixmap & pixmap, const QString & text, int index )"
.br
.ti -1c
.BI "void \fBtakeItem\fR ( const QListBoxItem * item )"
.br
.ti -1c
.BI "int \fBnumItemsVisible\fR () const"
.br
.ti -1c
.BI "int \fBcurrentItem\fR () const"
.br
.ti -1c
.BI "QString \fBcurrentText\fR () const"
.br
.ti -1c
.BI "virtual void \fBsetCurrentItem\fR ( int index )"
.br
.ti -1c
.BI "virtual void \fBsetCurrentItem\fR ( QListBoxItem * i )"
.br
.ti -1c
.BI "void centerCurrentItem () \fI(obsolete)\fR"
.br
.ti -1c
.BI "int \fBtopItem\fR () const"
.br
.ti -1c
.BI "virtual void \fBsetTopItem\fR ( int index )"
.br
.ti -1c
.BI "virtual void \fBsetBottomItem\fR ( int index )"
.br
.ti -1c
.BI "long \fBmaxItemWidth\fR () const"
.br
.ti -1c
.BI "enum \fBSelectionMode\fR { Single, Multi, Extended, NoSelection }"
.br
.ti -1c
.BI "virtual void \fBsetSelectionMode\fR ( SelectionMode )"
.br
.ti -1c
.BI "SelectionMode \fBselectionMode\fR () const"
.br
.ti -1c
.BI "void setMultiSelection ( bool multi ) \fI(obsolete)\fR"
.br
.ti -1c
.BI "bool isMultiSelection () const \fI(obsolete)\fR"
.br
.ti -1c
.BI "virtual void \fBsetSelected\fR ( QListBoxItem * item, bool select )"
.br
.ti -1c
.BI "void \fBsetSelected\fR ( int index, bool select )"
.br
.ti -1c
.BI "bool \fBisSelected\fR ( int i ) const"
.br
.ti -1c
.BI "bool \fBisSelected\fR ( const QListBoxItem * i ) const"
.br
.ti -1c
.BI "QListBoxItem * \fBselectedItem\fR () const"
.br
.ti -1c
.BI "QListBoxItem * \fBitem\fR ( int index ) const"
.br
.ti -1c
.BI "int \fBindex\fR ( const QListBoxItem * lbi ) const"
.br
.ti -1c
.BI "QListBoxItem * \fBfindItem\fR ( const QString & text, ComparisonFlags compare = BeginsWith ) const"
.br
.ti -1c
.BI "void \fBtriggerUpdate\fR ( bool doLayout )"
.br
.ti -1c
.BI "bool \fBitemVisible\fR ( int index )"
.br
.ti -1c
.BI "bool \fBitemVisible\fR ( const QListBoxItem * item )"
.br
.ti -1c
.BI "enum \fBLayoutMode\fR { FixedNumber, FitToWidth, FitToHeight = FitToWidth, Variable }"
.br
.ti -1c
.BI "virtual void \fBsetColumnMode\fR ( LayoutMode )"
.br
.ti -1c
.BI "virtual void \fBsetColumnMode\fR ( int )"
.br
.ti -1c
.BI "virtual void \fBsetRowMode\fR ( LayoutMode )"
.br
.ti -1c
.BI "virtual void \fBsetRowMode\fR ( int )"
.br
.ti -1c
.BI "LayoutMode \fBcolumnMode\fR () const"
.br
.ti -1c
.BI "LayoutMode \fBrowMode\fR () const"
.br
.ti -1c
.BI "int \fBnumColumns\fR () const"
.br
.ti -1c
.BI "int \fBnumRows\fR () const"
.br
.ti -1c
.BI "bool \fBvariableWidth\fR () const"
.br
.ti -1c
.BI "virtual void \fBsetVariableWidth\fR ( bool )"
.br
.ti -1c
.BI "bool \fBvariableHeight\fR () const"
.br
.ti -1c
.BI "virtual void \fBsetVariableHeight\fR ( bool )"
.br
.ti -1c
.BI "bool autoScrollBar () const \fI(obsolete)\fR"
.br
.ti -1c
.BI "void setAutoScrollBar ( bool enable ) \fI(obsolete)\fR"
.br
.ti -1c
.BI "bool scrollBar () const \fI(obsolete)\fR"
.br
.ti -1c
.BI "void setScrollBar ( bool enable ) \fI(obsolete)\fR"
.br
.ti -1c
.BI "bool autoBottomScrollBar () const \fI(obsolete)\fR"
.br
.ti -1c
.BI "void setAutoBottomScrollBar ( bool enable ) \fI(obsolete)\fR"
.br
.ti -1c
.BI "bool bottomScrollBar () const \fI(obsolete)\fR"
.br
.ti -1c
.BI "void setBottomScrollBar ( bool enable ) \fI(obsolete)\fR"
.br
.ti -1c
.BI "int inSort ( const QListBoxItem * lbi ) \fI(obsolete)\fR"
.br
.ti -1c
.BI "int inSort ( const QString & text ) \fI(obsolete)\fR"
.br
.ti -1c
.BI "int cellHeight ( int i ) const \fI(obsolete)\fR"
.br
.ti -1c
.BI "int cellHeight () const \fI(obsolete)\fR"
.br
.ti -1c
.BI "int cellWidth () const \fI(obsolete)\fR"
.br
.ti -1c
.BI "int numCols () const \fI(obsolete)\fR"
.br
.ti -1c
.BI "int \fBitemHeight\fR ( int index = 0 ) const"
.br
.ti -1c
.BI "QListBoxItem * \fBitemAt\fR ( const QPoint & p ) const"
.br
.ti -1c
.BI "QRect \fBitemRect\fR ( QListBoxItem * item ) const"
.br
.ti -1c
.BI "QListBoxItem * \fBfirstItem\fR () const"
.br
.ti -1c
.BI "void \fBsort\fR ( bool ascending = TRUE )"
.br
.in -1c
.SS "Public Slots"
.in +1c
.ti -1c
.BI "void \fBclear\fR ()"
.br
.ti -1c
.BI "virtual void \fBensureCurrentVisible\fR ()"
.br
.ti -1c
.BI "virtual void \fBclearSelection\fR ()"
.br
.ti -1c
.BI "virtual void \fBselectAll\fR ( bool select )"
.br
.ti -1c
.BI "virtual void \fBinvertSelection\fR ()"
.br
.in -1c
.SS "Signals"
.in +1c
.ti -1c
.BI "void \fBhighlighted\fR ( int index )"
.br
.ti -1c
.BI "void \fBselected\fR ( int index )"
.br
.ti -1c
.BI "void \fBhighlighted\fR ( const QString & )"
.br
.ti -1c
.BI "void \fBselected\fR ( const QString & )"
.br
.ti -1c
.BI "void \fBhighlighted\fR ( QListBoxItem * )"
.br
.ti -1c
.BI "void \fBselected\fR ( QListBoxItem * )"
.br
.ti -1c
.BI "void \fBselectionChanged\fR ()"
.br
.ti -1c
.BI "void \fBselectionChanged\fR ( QListBoxItem * item )"
.br
.ti -1c
.BI "void \fBcurrentChanged\fR ( QListBoxItem * item )"
.br
.ti -1c
.BI "void \fBclicked\fR ( QListBoxItem * item )"
.br
.ti -1c
.BI "void \fBclicked\fR ( QListBoxItem * item, const QPoint & pnt )"
.br
.ti -1c
.BI "void \fBpressed\fR ( QListBoxItem * item )"
.br
.ti -1c
.BI "void \fBpressed\fR ( QListBoxItem * item, const QPoint & pnt )"
.br
.ti -1c
.BI "void \fBdoubleClicked\fR ( QListBoxItem * item )"
.br
.ti -1c
.BI "void \fBreturnPressed\fR ( QListBoxItem * )"
.br
.ti -1c
.BI "void \fBrightButtonClicked\fR ( QListBoxItem *, const QPoint & )"
.br
.ti -1c
.BI "void \fBrightButtonPressed\fR ( QListBoxItem *, const QPoint & )"
.br
.ti -1c
.BI "void \fBmouseButtonPressed\fR ( int button, QListBoxItem * item, const QPoint & pos )"
.br
.ti -1c
.BI "void \fBmouseButtonClicked\fR ( int button, QListBoxItem * item, const QPoint & pos )"
.br
.ti -1c
.BI "void \fBcontextMenuRequested\fR ( QListBoxItem * item, const QPoint & pos )"
.br
.ti -1c
.BI "void \fBonItem\fR ( QListBoxItem * i )"
.br
.ti -1c
.BI "void \fBonViewport\fR ()"
.br
.in -1c
.SS "Properties"
.in +1c
.ti -1c
.BI "LayoutMode \fBcolumnMode\fR - the column layout mode for this list box"
.br
.ti -1c
.BI "uint \fBcount\fR - the number of items in the list box \fI(read " "only" ")\fR"
.br
.ti -1c
.BI "int \fBcurrentItem\fR - the current highlighted item"
.br
.ti -1c
.BI "QString \fBcurrentText\fR - the text of the current item \fI(read " "only" ")\fR"
.br
.ti -1c
.BI "bool multiSelection - whether or not the list box is in Multi selection mode \fI(obsolete)\fR"
.br
.ti -1c
.BI "int \fBnumColumns\fR - the number of columns in the list box \fI(read " "only" ")\fR"
.br
.ti -1c
.BI "int \fBnumItemsVisible\fR - the number of visible items \fI(read " "only" ")\fR"
.br
.ti -1c
.BI "int \fBnumRows\fR - the number of rows in the list box \fI(read " "only" ")\fR"
.br
.ti -1c
.BI "LayoutMode \fBrowMode\fR - the row layout mode for this list box"
.br
.ti -1c
.BI "SelectionMode \fBselectionMode\fR - the selection mode of the list box"
.br
.ti -1c
.BI "int \fBtopItem\fR - the index of an item at the top of the screen"
.br
.ti -1c
.BI "bool \fBvariableHeight\fR - whether this list box has variable-height rows"
.br
.ti -1c
.BI "bool \fBvariableWidth\fR - whether this list box has variable-width columns"
.br
.in -1c
.SS "Protected Members"
.in +1c
.ti -1c
.BI "void \fBupdateItem\fR ( int index )"
.br
.ti -1c
.BI "void \fBupdateItem\fR ( QListBoxItem * i )"
.br
.ti -1c
.BI "int totalWidth () const \fI(obsolete)\fR"
.br
.ti -1c
.BI "int totalHeight () const \fI(obsolete)\fR"
.br
.ti -1c
.BI "virtual void \fBpaintCell\fR ( QPainter * p, int row, int col )"
.br
.ti -1c
.BI "void \fBtoggleCurrentItem\fR ()"
.br
.ti -1c
.BI "bool \fBisRubberSelecting\fR () const"
.br
.ti -1c
.BI "void \fBdoLayout\fR () const"
.br
.ti -1c
.BI "bool itemYPos ( int index, int * yPos ) const \fI(obsolete)\fR"
.br
.ti -1c
.BI "int findItem ( int yPos ) const \fI(obsolete)\fR"
.br
.in -1c
.SH DESCRIPTION
The QListBox widget provides a list of selectable, read-only items.
.PP
This is typically a single-column list in which either no item or one item is selected, but it can also be used in many other ways.
.PP
QListBox will add scroll bars as necessary, but it isn't intended for \fIreally\fR big lists. If you want more than a few thousand items, it's probably better to use a different widget mainly because the scroll bars won't provide very good navigation, but also because QListBox may become slow with huge lists. (See QListView and QTable for possible alternatives.)
.PP
There are a variety of selection modes described in the QListBox::SelectionMode documentation. The default is Single selection mode, but you can change it using setSelectionMode(). (setMultiSelection() is still provided for compatibility with Qt 1.x. We recommend using setSelectionMode() in all code.)
.PP
Because QListBox offers multiple selection it must display keyboard focus and selection state separately. Therefore there are functions both to set the selection state of an item, i.e. setSelected(), and to set which item displays keyboard focus, i.e. setCurrentItem().
.PP
The list box normally arranges its items in a single column and adds a vertical scroll bar if retquired. It is possible to have a different fixed number of columns (setColumnMode()), or as many columns as will fit in the list box's assigned screen space (setColumnMode(FitToWidth)), or to have a fixed number of rows (setRowMode()) or as many rows as will fit in the list box's assigned screen space (setRowMode(FitToHeight)). In all these cases QListBox will add scroll bars, as appropriate, in at least one direction.
.PP
If multiple rows are used, each row can be as high as necessary (the normal setting), or you can request that all items will have the same height by calling setVariableHeight(FALSE). The same applies to a column's width, see setVariableWidth().
.PP
The QListBox's items are QListBoxItem objects. QListBox provides methods to insert new items as strings, as pixmaps, and as QListBoxItem * (insertItem() with various arguments), and to replace an existing item with a new string, pixmap or QListBoxItem (changeItem() with various arguments). You can also remove items singly with removeItem() or clear() the entire list box. Note that if you create a QListBoxItem yourself and insert it, QListBox takes ownership of the item.
.PP
You can also create a QListBoxItem, such as QListBoxText or QListBoxPixmap, with the list box as first parameter. The item will then append itself. When you delete an item it is automatically removed from the list box.
.PP
The list of items can be arbitrarily large; QListBox will add scroll bars if necessary. QListBox can display a single-column (the common case) or multiple-columns, and offers both single and multiple selection. QListBox does not support multiple-column items (but QListView and QTable do), or tree hierarchies (but QListView does).
.PP
The list box items can be accessed both as QListBoxItem objects (recommended) and using integer indexes (the original QListBox implementation used an array of strings internally, and the API still supports this mode of operation). Everything can be done using the new objects, and most things can be done using indexes.
.PP
Each item in a QListBox contains a QListBoxItem. One of the items can be the current item. The currentChanged() signal and the highlighted() signal are emitted when a new item becomes current, e.g. because the user clicks on it or QListBox::setCurrentItem() is called. The selected() signal is emitted when the user double-clicks on an item or presses Enter on the current item.
.PP
If the user does not select anything, no signals are emitted and currentItem() returns -1.
.PP
A list box has WheelFocus as a default focusPolicy(), i.e. it can get keyboard focus by tabbing, clicking and through the use of the mouse wheel.
.PP
New items can be inserted using insertItem(), insertStrList() or insertStringList(). inSort() is obsolete because this method is tquite inefficient. It's preferable to insert the items normally and call sort() afterwards, or to insert a sorted QStringList().
.PP
By default, vertical and horizontal scroll bars are added and removed as necessary. setHScrollBarMode() and setVScrollBarMode() can be used to change this policy.
.PP
If you need to insert types other than strings and pixmaps, you must define new classes which inherit QListBoxItem.
.PP
\fBWarning:\fR The list box assumes ownership of all list box items and will delete them when it does not need them any more.
.PP
.ce 1
.B "[Image Omitted]"
.PP
.ce 1
.B "[Image Omitted]"
.PP
See also QListView, QComboBox, QButtonGroup, GUI Design Handbook: List Box (two sections), and Advanced Widgets.
.SS "Member Type Documentation"
.SH "QListBox::LayoutMode"
This enum type is used to specify how QListBox lays out its rows and columns.
.TP
\fCQListBox::FixedNumber\fR - There is a fixed number of rows (or columns).
.TP
\fCQListBox::FitToWidth\fR - There are as many columns as will fit on-screen.
.TP
\fCQListBox::FitToHeight\fR - There are as many rows as will fit on-screen.
.TP
\fCQListBox::Variable\fR - There are as many rows as are retquired by the column mode. (Or as many columns as retquired by the row mode.)
.PP
Example: When you call setRowMode( FitToHeight ), columnMode() automatically becomes Variable to accommodate the row mode you've set.
.SH "QListBox::SelectionMode"
This enumerated type is used by QListBox to indicate how it reacts to selection by the user.
.TP
\fCQListBox::Single\fR - When the user selects an item, any already-selected item becomes unselected and the user cannot unselect the selected item. This means that the user can never clear the selection, even though the selection may be cleared by the application programmer using QListBox::clearSelection().
.TP
\fCQListBox::Multi\fR - When the user selects an item the selection status of that item is toggled and the other items are left alone. Also, multiple items can be selected by dragging the mouse while the left mouse button is kept pressed.
.TP
\fCQListBox::Extended\fR - When the user selects an item the selection is cleared and the new item selected. However, if the user presses the Ctrl key when clicking on an item, the clicked item gets toggled and all other items are left untouched. And if the user presses the Shift key while clicking on an item, all items between the current item and the clicked item get selected or unselected, depending on the state of the clicked item. Also, multiple items can be selected by dragging the mouse while the left mouse button is kept pressed.
.TP
\fCQListBox::NoSelection\fR - Items cannot be selected.
.PP
In other words, Single is a real single-selection list box, Multi is a real multi-selection list box, Extended is a list box in which users can select multiple items but usually want to select either just one or a range of contiguous items, and NoSelection is for a list box where the user can look but not touch.
.SH MEMBER FUNCTION DOCUMENTATION
.SH "QListBox::QListBox ( QWidget * parent = 0, const char * name = 0, WFlags f = 0 )"
Constructs a new empty list box called \fIname\fR and with parent \fIparent\fR.
.PP
Performance is boosted by modifying the widget flags \fIf\fR so that only part of the QListBoxItem children is redrawn. This may be unsuitable for custom QListBoxItem classes, in which case WStaticContents and WNoAutoErase should be cleared immediately after construction.
.PP
See also QWidget::clearWFlags() and Qt::WidgetFlags.
.SH "QListBox::~QListBox ()"
Destroys the list box. Deletes all list box items.
.SH "bool QListBox::autoBottomScrollBar () const"
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
.PP
Returns TRUE if hScrollBarMode() is Auto; otherwise returns FALSE.
.SH "bool QListBox::autoScrollBar () const"
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
.PP
Returns TRUE if vScrollBarMode() is Auto; otherwise returns FALSE.
.SH "bool QListBox::bottomScrollBar () const"
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
.PP
Returns FALSE if vScrollBarMode() is AlwaysOff; otherwise returns TRUE.
.SH "int QListBox::cellHeight ( int i ) const"
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
.PP
Returns the item height of item \fIi\fR.
.PP
See also itemHeight().
.SH "int QListBox::cellHeight () const"
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
.PP
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Returns the item height of the first item, item 0.
.PP
See also itemHeight().
.SH "int QListBox::cellWidth () const"
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
.PP
Returns the maximum item width.
.PP
See also maxItemWidth().
.SH "void QListBox::centerCurrentItem ()"
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
.PP
This function does exactly the same as ensureCurrentVisible()
.PP
See also QListBox::ensureCurrentVisible().
.SH "void QListBox::changeItem ( const QListBoxItem * lbi, int index )"
Replaces the item at position \fIindex\fR with \fIlbi\fR. If \fIindex\fR is negative or too large, changeItem() does nothing.
.PP
The item that has been changed will become selected.
.PP
See also insertItem() and removeItem().
.SH "void QListBox::changeItem ( const QString & text, 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 a new list box text item with text \fItext\fR.
.PP
The operation is ignored if \fIindex\fR is out of range.
.PP
See also insertItem() and removeItem().
.SH "void QListBox::changeItem ( const QPixmap & pixmap, 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 a new list box pixmap item with pixmap \fIpixmap\fR.
.PP
The operation is ignored if \fIindex\fR is out of range.
.PP
See also insertItem() and removeItem().
.SH "void QListBox::changeItem ( const QPixmap & pixmap, const QString & text, 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 a new list box pixmap item with pixmap \fIpixmap\fR and text \fItext\fR.
.PP
The operation is ignored if \fIindex\fR is out of range.
.PP
See also insertItem() and removeItem().
.SH "void QListBox::clear ()\fC [slot]\fR"
Deletes all the items in the list.
.PP
See also removeItem().
.SH "void QListBox::clearSelection ()\fC [virtual slot]\fR"
Deselects all items, if possible.
.PP
Note that a Single selection list box will automatically select an item if it has keyboard focus.
.PP
Example: listbox/listbox.cpp.
.SH "void QListBox::clicked ( QListBoxItem * item )\fC [signal]\fR"
This signal is emitted when the user clicks any mouse button. If \fIitem\fR is not 0, the cursor is on \fIitem\fR. If \fIitem\fR is 0, the mouse cursor isn't on any item.
.PP
Note that you must not delete any QListBoxItem objects in slots connected to this signal.
.SH "void QListBox::clicked ( QListBoxItem * item, const QPoint & pnt )\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 the user clicks any mouse button. If \fIitem\fR is not 0, the cursor is on \fIitem\fR. If \fIitem\fR is 0, the mouse cursor isn't on any item.
.PP
\fIpnt\fR is the position of the mouse cursor in the global coordinate system (QMouseEvent::globalPos()). (If the click's press and release differs by a pixel or two, \fIpnt\fR is the position at release time.)
.PP
Note that you must not delete any QListBoxItem objects in slots connected to this signal.
.SH "LayoutMode QListBox::columnMode () const"
Returns the column layout mode for this list box. See the "columnMode" property for details.
.SH "void QListBox::contextMenuRequested ( QListBoxItem * item, const QPoint & pos )\fC [signal]\fR"
This signal is emitted when the user invokes a context menu with the right mouse button or with special system keys, with \fIitem\fR being the item under the mouse cursor or the current item, respectively.
.PP
\fIpos\fR is the position for the context menu in the global coordinate system.
.SH "uint QListBox::count () const"
Returns the number of items in the list box. See the "count" property for details.
.SH "void QListBox::currentChanged ( QListBoxItem * item )\fC [signal]\fR"
This signal is emitted when the user makes a new item the current item. \fIitem\fR is the new current list box item.
.PP
See also currentItem and currentItem.
.SH "int QListBox::currentItem () const"
Returns the current highlighted item. See the "currentItem" property for details.
.SH "QString QListBox::currentText () const"
Returns the text of the current item. See the "currentText" property for details.
.SH "void QListBox::doLayout () const\fC [protected]\fR"
This function does the hard layout work. You should never need to call it.
.SH "void QListBox::doubleClicked ( QListBoxItem * item )\fC [signal]\fR"
This signal is emitted whenever an item is double-clicked. It's emitted on the second button press, not the second button release. If \fIitem\fR is not 0, the cursor is on \fIitem\fR. If \fIitem\fR is 0, the mouse cursor isn't on any item.
.SH "void QListBox::ensureCurrentVisible ()\fC [virtual slot]\fR"
Ensures that the current item is visible.
.SH "QListBoxItem * QListBox::findItem ( const QString & text, ComparisonFlags compare = BeginsWith ) const"
Finds the first list box item that has the text \fItext\fR and returns it, or returns 0 of no such item could be found. The search starts from the current item if the current item exists, otherwise it starts from the first list box item. If \fCComparisonFlags\fR are specified in \fIcompare\fR then these flags are used, otherwise the default is a case-insensitive, "begins with" search.
.PP
See also Qt::StringComparisonMode.
.SH "int QListBox::findItem ( int yPos ) const\fC [protected]\fR"
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
.PP
Returns the index of the item a point (0, \fIyPos\fR).
.PP
See also index() and itemAt().
.SH "QListBoxItem * QListBox::firstItem () const"
Returns the first item in this list box. If the list box is empty, returns 0.
.SH "void QListBox::highlighted ( int index )\fC [signal]\fR"
This signal is emitted when the user makes a new item the current item. \fIindex\fR is the index of the new current item.
.PP
See also currentChanged(), selected(), currentItem, and selectionChanged().
.SH "void QListBox::highlighted ( const QString & )\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 the user makes a new item the current item and the item is (or has) a string. The argument is the text of the new current item.
.PP
See also currentChanged(), selected(), currentItem, and selectionChanged().
.SH "void QListBox::highlighted ( QListBoxItem * )\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 the user makes a new item the current item. The argument is a pointer to the new current item.
.PP
See also currentChanged(), selected(), currentItem, and selectionChanged().
.SH "int QListBox::inSort ( const QListBoxItem * lbi )"
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
.PP
Using this method is tquite inefficient. We suggest to use insertItem() for inserting and sort() afterwards.
.PP
Inserts \fIlbi\fR at its sorted position in the list box and returns the position.
.PP
All items must be inserted with inSort() to maintain the sorting order. inSort() treats any pixmap (or user-defined type) as lexicographically less than any string.
.PP
See also insertItem() and sort().
.SH "int QListBox::inSort ( const QString & text )"
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
.PP
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Using this method is tquite inefficient. We suggest to use insertItem() for inserting and sort() afterwards.
.PP
Inserts a new item of \fItext\fR at its sorted position in the list box and returns the position.
.PP
All items must be inserted with inSort() to maintain the sorting order. inSort() treats any pixmap (or user-defined type) as lexicographically less than any string.
.PP
See also insertItem() and sort().
.SH "int QListBox::index ( const QListBoxItem * lbi ) const"
Returns the index of \fIlbi\fR, or -1 if the item is not in this list box or \fIlbi\fR is 0.
.PP
See also item().
.SH "void QListBox::insertItem ( const QListBoxItem * lbi, int index = -1 )"
Inserts the item \fIlbi\fR into the list at position \fIindex\fR.
.PP
If \fIindex\fR is negative or larger than the number of items in the list box, \fIlbi\fR is inserted at the end of the list.
.PP
See also insertStrList().
.PP
Examples:
.)l i18n/mywidget.cpp, listbox/listbox.cpp, listboxcombo/listboxcombo.cpp, and tabdialog/tabdialog.cpp.
.SH "void QListBox::insertItem ( const QListBoxItem * lbi, const QListBoxItem * after )"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Inserts the item \fIlbi\fR into the list after the item \fIafter\fR, or at the beginning if \fIafter\fR is 0.
.PP
See also insertStrList().
.SH "void QListBox::insertItem ( 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 new list box text item with the text \fItext\fR into the list at position \fIindex\fR.
.PP
If \fIindex\fR is negative, \fItext\fR is inserted at the end of the list.
.PP
See also insertStrList().
.SH "void QListBox::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 new list box pixmap item with the pixmap \fIpixmap\fR into the list at position \fIindex\fR.
.PP
If \fIindex\fR is negative, \fIpixmap\fR is inserted at the end of the list.
.PP
See also insertStrList().
.SH "void QListBox::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 new list box pixmap item with the pixmap \fIpixmap\fR and the text \fItext\fR into the list at position \fIindex\fR.
.PP
If \fIindex\fR is negative, \fIpixmap\fR is inserted at the end of the list.
.PP
See also insertStrList().
.SH "void QListBox::insertStrList ( const QStrList * list, int index = -1 )"
Inserts the string list \fIlist\fR into the list at position \fIindex\fR.
.PP
If \fIindex\fR is negative, \fIlist\fR is inserted at the end of the list. If \fIindex\fR is too large, the operation is ignored.
.PP
\fBWarning:\fR This function uses \fCconst char *\fR rather than QString, so we recommend against using it. It is provided so that legacy code will continue to work, and so that programs that certainly will not need to handle code outside a single 8-bit locale can use it. See insertStringList() which uses real QStrings.
.PP
\fBWarning:\fR This function is never significantly faster than a loop around insertItem().
.PP
See also insertItem() and insertStringList().
.SH "void QListBox::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 string list \fIlist\fR into the list at position \fIindex\fR.
.PP
If \fIindex\fR is negative, \fIlist\fR is inserted at the end of the list. If \fIindex\fR is too large, the operation is ignored.
.PP
\fBWarning:\fR This function uses \fCconst char *\fR rather than QString, so we recommend against using it. It is provided so that legacy code will continue to work, and so that programs that certainly will not need to handle code outside a single 8-bit locale can use it. See insertStringList() which uses real QStrings.
.PP
\fBWarning:\fR This function is never significantly faster than a loop around insertItem().
.PP
See also insertItem() and insertStringList().
.SH "void QListBox::insertStrList ( const char ** strings, int numStrings = -1, int index = -1 )"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Inserts the \fInumStrings\fR strings of the array \fIstrings\fR into the list at position \fIindex\fR.
.PP
If \fIindex\fR is negative, insertStrList() inserts \fIstrings\fR at the end of the list. If \fIindex\fR is too large, the operation is ignored.
.PP
\fBWarning:\fR This function uses \fCconst char *\fR rather than QString, so we recommend against using it. It is provided so that legacy code will continue to work, and so that programs that certainly will not need to handle code outside a single 8-bit locale can use it. See insertStringList() which uses real QStrings.
.PP
\fBWarning:\fR This function is never significantly faster than a loop around insertItem().
.PP
See also insertItem() and insertStringList().
.SH "void QListBox::insertStringList ( const QStringList & list, int index = -1 )"
Inserts the string list \fIlist\fR into the list at position \fIindex\fR.
.PP
If \fIindex\fR is negative, \fIlist\fR is inserted at the end of the list. If \fIindex\fR is too large, the operation is ignored.
.PP
\fBWarning:\fR This function is never significantly faster than a loop around insertItem().
.PP
See also insertItem() and insertStrList().
.SH "void QListBox::invertSelection ()\fC [virtual slot]\fR"
Inverts the selection. Only works in Multi and Extended selection mode.
.SH "bool QListBox::isMultiSelection () const"
Returns TRUE if or not the list box is in Multi selection mode; otherwise returns FALSE. See the "multiSelection" property for details.
.SH "bool QListBox::isRubberSelecting () const\fC [protected]\fR"
Returns TRUE if the user is selecting items using a rubber band rectangle; otherwise returns FALSE.
.SH "bool QListBox::isSelected ( int i ) const"
Returns TRUE if item \fIi\fR is selected; otherwise returns FALSE.
.SH "bool QListBox::isSelected ( const QListBoxItem * i ) const"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Returns TRUE if item \fIi\fR is selected; otherwise returns FALSE.
.SH "QListBoxItem * QListBox::item ( int index ) const"
Returns a pointer to the item at position \fIindex\fR, or 0 if \fIindex\fR is out of bounds.
.PP
See also index().
.PP
Example: listboxcombo/listboxcombo.cpp.
.SH "QListBoxItem * QListBox::itemAt ( const QPoint & p ) const"
Returns the item at point \fIp\fR, specified in viewport coordinates, or a 0 if there is no item at \fIp\fR.
.PP
Use contentsToViewport() to convert between widget coordinates and viewport coordinates.
.SH "int QListBox::itemHeight ( int index = 0 ) const"
Returns the height in pixels of the item with index \fIindex\fR. \fIindex\fR defaults to 0.
.PP
If \fIindex\fR is too large, this function returns 0.
.SH "QRect QListBox::itemRect ( QListBoxItem * item ) const"
Returns the rectangle on the screen that \fIitem\fR occupies in viewport()'s coordinates, or an invalid rectangle if \fIitem\fR is 0 or is not currently visible.
.SH "bool QListBox::itemVisible ( int index )"
Returns TRUE if the item at position \fIindex\fR is at least partly visible; otherwise returns FALSE.
.SH "bool QListBox::itemVisible ( const QListBoxItem * item )"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Returns TRUE if \fIitem\fR is at least partly visible; otherwise returns FALSE.
.SH "bool QListBox::itemYPos ( int index, int * yPos ) const\fC [protected]\fR"
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
.PP
Returns the vertical pixel-coordinate in \fI*yPos\fR, of the list box item at position \fIindex\fR in the list. Returns FALSE if the item is outside the visible area.
.SH "long QListBox::maxItemWidth () const"
Returns the width of the widest item in the list box.
.SH "void QListBox::mouseButtonClicked ( int button, QListBoxItem * item, const QPoint & pos )\fC [signal]\fR"
This signal is emitted when the user clicks mouse button \fIbutton\fR. If \fIitem\fR is not 0, the cursor is on \fIitem\fR. If \fIitem\fR is 0, the mouse cursor isn't on any item.
.PP
\fIpos\fR is the position of the mouse cursor in the global coordinate system (QMouseEvent::globalPos()). (If the click's press and release differs by a pixel or two, \fIpos\fR is the position at release time.)
.PP
Note that you must not delete any QListBoxItem objects in slots connected to this signal.
.SH "void QListBox::mouseButtonPressed ( int button, QListBoxItem * item, const QPoint & pos )\fC [signal]\fR"
This signal is emitted when the user presses mouse button \fIbutton\fR. If \fIitem\fR is not 0, the cursor is on \fIitem\fR. If \fIitem\fR is 0, the mouse cursor isn't on any item.
.PP
\fIpos\fR is the position of the mouse cursor in the global coordinate system (QMouseEvent::globalPos()).
.PP
Note that you must not delete any QListBoxItem objects in slots connected to this signal.
.SH "int QListBox::numCols () const"
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
.PP
Returns the number of columns.
.PP
See also numColumns.
.SH "int QListBox::numColumns () const"
Returns the number of columns in the list box. See the "numColumns" property for details.
.SH "int QListBox::numItemsVisible () const"
Returns the number of visible items. See the "numItemsVisible" property for details.
.SH "int QListBox::numRows () const"
Returns the number of rows in the list box. See the "numRows" property for details.
.SH "void QListBox::onItem ( QListBoxItem * i )\fC [signal]\fR"
This signal is emitted when the user moves the mouse cursor onto an item, similar to the QWidget::enterEvent() function. \fIi\fR is the QListBoxItem that the mouse has moved on.
.SH "void QListBox::onViewport ()\fC [signal]\fR"
This signal is emitted when the user moves the mouse cursor from an item to an empty part of the list box.
.SH "void QListBox::paintCell ( QPainter * p, int row, int col )\fC [virtual protected]\fR"
Provided for compatibility with the old QListBox. We recommend using QListBoxItem::paint() instead.
.PP
Repaints the cell at \fIrow\fR, \fIcol\fR using painter \fIp\fR.
.SH "const QPixmap * QListBox::pixmap ( int index ) const"
Returns a pointer to the pixmap at position \fIindex\fR, or 0 if there is no pixmap there.
.PP
See also text().
.SH "void QListBox::pressed ( QListBoxItem * item )\fC [signal]\fR"
This signal is emitted when the user presses any mouse button. If \fIitem\fR is not 0, the cursor is on \fIitem\fR. If \fIitem\fR is 0, the mouse cursor isn't on any item.
.PP
Note that you must not delete any QListBoxItem objects in slots connected to this signal.
.SH "void QListBox::pressed ( QListBoxItem * item, const QPoint & pnt )\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 the user presses any mouse button. If \fIitem\fR is not 0, the cursor is on \fIitem\fR. If \fIitem\fR is 0, the mouse cursor isn't on any item.
.PP
\fIpnt\fR is the position of the mouse cursor in the global coordinate system (QMouseEvent::globalPos()).
.PP
Note that you must not delete any QListBoxItem objects in slots connected to this signal.
.PP
See also mouseButtonPressed(), rightButtonPressed(), and clicked().
.SH "void QListBox::removeItem ( int index )"
Removes and deletes the item at position \fIindex\fR. If \fIindex\fR is equal to currentItem(), a new item becomes current and the currentChanged() and highlighted() signals are emitted.
.PP
See also insertItem() and clear().
.SH "void QListBox::returnPressed ( QListBoxItem * )\fC [signal]\fR"
This signal is emitted when Enter or Return is pressed. The argument is currentItem().
.SH "void QListBox::rightButtonClicked ( QListBoxItem *, const QPoint & )\fC [signal]\fR"
This signal is emitted when the right button is clicked (i.e. when it's released at the same point where it was pressed). The arguments are the relevant QListBoxItem (may be 0) and the point in global coordinates.
.SH "void QListBox::rightButtonPressed ( QListBoxItem *, const QPoint & )\fC [signal]\fR"
This signal is emitted when the right button is pressed. The arguments are the relevant QListBoxItem (may be 0) and the point in global coordinates.
.SH "LayoutMode QListBox::rowMode () const"
Returns the row layout mode for this list box. See the "rowMode" property for details.
.SH "bool QListBox::scrollBar () const"
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
.PP
Returns FALSE if vScrollBarMode() is AlwaysOff; otherwise returns TRUE.
.SH "void QListBox::selectAll ( bool select )\fC [virtual slot]\fR"
In Multi and Extended modes, this function sets all items to be selected if \fIselect\fR is TRUE, and to be unselected if \fIselect\fR is FALSE.
.PP
In Single and NoSelection modes, this function only changes the selection status of currentItem().
.SH "void QListBox::selected ( int index )\fC [signal]\fR"
This signal is emitted when the user double-clicks on an item or presses Enter on the current item. \fIindex\fR is the index of the selected item.
.PP
See also currentChanged(), highlighted(), and selectionChanged().
.SH "void QListBox::selected ( const QString & )\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 the user double-clicks on an item or presses Enter on the current item, and the item is (or has) a string. The argument is the text of the selected item.
.PP
See also currentChanged(), highlighted(), and selectionChanged().
.SH "void QListBox::selected ( QListBoxItem * )\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 the user double-clicks on an item or presses Enter on the current item. The argument is a pointer to the new selected item.
.PP
See also currentChanged(), highlighted(), and selectionChanged().
.SH "QListBoxItem * QListBox::selectedItem () const"
Returns the selected item if the list box is in single-selection mode and an item is selected.
.PP
If no items are selected or the list box is in another selection mode this function returns 0.
.PP
See also setSelected() and multiSelection.
.SH "void QListBox::selectionChanged ()\fC [signal]\fR"
This signal is emitted when the selection set of a list box changes. This signal is emitted in each selection mode. If the user selects five items by drag-selecting, QListBox tries to emit just one selectionChanged() signal so the signal can be connected to computationally expensive slots.
.PP
See also selected() and currentItem.
.SH "void QListBox::selectionChanged ( QListBoxItem * item )\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 the selection in a Single selection list box changes. \fIitem\fR is the newly selected list box item.
.PP
See also selected() and currentItem.
.SH "SelectionMode QListBox::selectionMode () const"
Returns the selection mode of the list box. See the "selectionMode" property for details.
.SH "void QListBox::setAutoBottomScrollBar ( bool enable )"
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
.PP
If \fIenable\fR is TRUE sets setHScrollBarMode() to AlwaysOn; otherwise sets setHScrollBarMode() to AlwaysOff.
.SH "void QListBox::setAutoScrollBar ( bool enable )"
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
.PP
If \fIenable\fR is TRUE sets setVScrollBarMode() to AlwaysOn; otherwise sets setVScrollBarMode() to AlwaysOff.
.SH "void QListBox::setBottomItem ( int index )\fC [virtual]\fR"
Scrolls the list box so the item at position \fIindex\fR in the list is displayed in the bottom row of the list box.
.PP
See also topItem.
.SH "void QListBox::setBottomScrollBar ( bool enable )"
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
.PP
If \fIenable\fR is TRUE sets setHScrollBarMode() to AlwaysOn; otherwise sets setHScrollBarMode() to AlwaysOff.
.SH "void QListBox::setColumnMode ( LayoutMode )\fC [virtual]\fR"
Sets the column layout mode for this list box. See the "columnMode" property for details.
.SH "void QListBox::setColumnMode ( int )\fC [virtual]\fR"
Sets the column layout mode for this list box. See the "columnMode" property for details.
.SH "void QListBox::setCurrentItem ( int index )\fC [virtual]\fR"
Sets the current highlighted item to \fIindex\fR. See the "currentItem" property for details.
.SH "void QListBox::setCurrentItem ( QListBoxItem * i )\fC [virtual]\fR"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Sets the current item to the QListBoxItem \fIi\fR.
.SH "void QListBox::setMultiSelection ( bool multi )"
Sets whether or not the list box is in Multi selection mode to \fImulti\fR. See the "multiSelection" property for details.
.SH "void QListBox::setRowMode ( LayoutMode )\fC [virtual]\fR"
Sets the row layout mode for this list box. See the "rowMode" property for details.
.SH "void QListBox::setRowMode ( int )\fC [virtual]\fR"
Sets the row layout mode for this list box. See the "rowMode" property for details.
.SH "void QListBox::setScrollBar ( bool enable )"
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
.PP
If \fIenable\fR is TRUE sets setVScrollBarMode() to AlwaysOn; otherwise sets setVScrollBarMode() to AlwaysOff.
.SH "void QListBox::setSelected ( QListBoxItem * item, bool select )\fC [virtual]\fR"
Selects \fIitem\fR if \fIselect\fR is TRUE or unselects it if \fIselect\fR is FALSE, and repaints the item appropriately.
.PP
If the list box is a Single selection list box and \fIselect\fR is TRUE, setSelected() calls setCurrentItem().
.PP
If the list box is a Single selection list box, \fIselect\fR is FALSE, setSelected() calls clearSelection().
.PP
See also multiSelection, currentItem, clearSelection(), and currentItem.
.SH "void QListBox::setSelected ( int index, bool select )"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
If \fIselect\fR is TRUE the item at position \fIindex\fR is selected; otherwise the item is deselected.
.SH "void QListBox::setSelectionMode ( SelectionMode )\fC [virtual]\fR"
Sets the selection mode of the list box. See the "selectionMode" property for details.
.SH "void QListBox::setTopItem ( int index )\fC [virtual]\fR"
Sets the index of an item at the top of the screen to \fIindex\fR. See the "topItem" property for details.
.SH "void QListBox::setVariableHeight ( bool )\fC [virtual]\fR"
Sets whether this list box has variable-height rows. See the "variableHeight" property for details.
.SH "void QListBox::setVariableWidth ( bool )\fC [virtual]\fR"
Sets whether this list box has variable-width columns. See the "variableWidth" property for details.
.SH "void QListBox::sort ( bool ascending = TRUE )"
If \fIascending\fR is TRUE sorts the items in ascending order; otherwise sorts in descending order.
.PP
To compare the items, the text (QListBoxItem::text()) of the items is used.
.PP
Example: listbox/listbox.cpp.
.SH "void QListBox::takeItem ( const QListBoxItem * item )"
Removes \fIitem\fR from the list box and causes an update of the screen display. The item is not deleted. You should normally not need to call this function because QListBoxItem::~QListBoxItem() calls it. The normal way to delete an item is with \fCdelete\fR.
.PP
See also QListBox::insertItem().
.SH "QString QListBox::text ( int index ) const"
Returns the text at position \fIindex\fR, or QString::null if there is no text at that position.
.PP
See also pixmap().
.SH "void QListBox::toggleCurrentItem ()\fC [protected]\fR"
Toggles the selection status of currentItem() and repaints if the list box is a Multi selection list box.
.PP
See also multiSelection.
.SH "int QListBox::topItem () const"
Returns the index of an item at the top of the screen. See the "topItem" property for details.
.SH "int QListBox::totalHeight () const\fC [protected]\fR"
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
.PP
Returns contentsHeight().
.SH "int QListBox::totalWidth () const\fC [protected]\fR"
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
.PP
Returns contentsWidth().
.SH "void QListBox::triggerUpdate ( bool doLayout )"
Ensures that a single paint event will occur at the end of the current event loop iteration. If \fIdoLayout\fR is TRUE, the layout is also redone.
.SH "void QListBox::updateItem ( int index )\fC [protected]\fR"
Repaints the item at position \fIindex\fR in the list.
.SH "void QListBox::updateItem ( QListBoxItem * i )\fC [protected]\fR"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Repaints the QListBoxItem \fIi\fR.
.SH "bool QListBox::variableHeight () const"
Returns TRUE if this list box has variable-height rows; otherwise returns FALSE. See the "variableHeight" property for details.
.SH "bool QListBox::variableWidth () const"
Returns TRUE if this list box has variable-width columns; otherwise returns FALSE. See the "variableWidth" property for details.
.SS "Property Documentation"
.SH "LayoutMode columnMode"
This property holds the column layout mode for this list box.
.PP
setColumnMode() sets the layout mode and adjusts the number of displayed columns. The row layout mode automatically becomes Variable, unless the column mode is Variable.
.PP
See also rowMode, rowMode, and numColumns.
.PP
Set this property's value with setColumnMode() and get this property's value with columnMode().
.SH "uint count"
This property holds the number of items in the list box.
.PP
Get this property's value with count().
.SH "int currentItem"
This property holds the current highlighted item.
.PP
When setting this property, the highlighting is moved to the item and the list box scrolled as necessary.
.PP
If no item is current, currentItem() returns -1.
.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 current item.
.PP
This is equivalent to text(currentItem()).
.PP
Get this property's value with currentText().
.SH "bool multiSelection"
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
.PP
This property holds whether or not the list box is in Multi selection mode.
.PP
Consider using the QListBox::selectionMode property instead of this property.
.PP
When setting this property, Multi selection mode is used if set to TRUE and to Single selection mode if set to FALSE.
.PP
When getting this property, TRUE is returned if the list box is in Multi selection mode or Extended selection mode, and FALSE if it is in Single selection mode or NoSelection mode.
.PP
See also selectionMode.
.PP
Set this property's value with setMultiSelection() and get this property's value with isMultiSelection().
.SH "int numColumns"
This property holds the number of columns in the list box.
.PP
This is normally 1, but can be different if QListBox::columnMode or QListBox::rowMode has been set.
.PP
See also columnMode, rowMode, and numRows.
.PP
Get this property's value with numColumns().
.SH "int numItemsVisible"
This property holds the number of visible items.
.PP
Both partially and entirely visible items are counted.
.PP
Get this property's value with numItemsVisible().
.SH "int numRows"
This property holds the number of rows in the list box.
.PP
This is equal to the number of items in the default single-column layout, but can be different.
.PP
See also columnMode, rowMode, and numColumns.
.PP
Get this property's value with numRows().
.SH "LayoutMode rowMode"
This property holds the row layout mode for this list box.
.PP
This property is normally Variable.
.PP
setRowMode() sets the layout mode and adjusts the number of displayed rows. The column layout mode automatically becomes Variable, unless the row mode is Variable.
.PP
See also columnMode.
.PP
Set this property's value with setRowMode() and get this property's value with rowMode().
.SH "SelectionMode selectionMode"
This property holds the selection mode of the list box.
.PP
Sets the list box's selection mode, which may be one of Single (the default), Extended, Multi or NoSelection.
.PP
See also SelectionMode.
.PP
Set this property's value with setSelectionMode() and get this property's value with selectionMode().
.SH "int topItem"
This property holds the index of an item at the top of the screen.
.PP
When getting this property and the listbox has multiple columns, an arbitrary item is selected and returned.
.PP
When setting this property, the list box is scrolled so the item at position \fIindex\fR in the list is displayed in the top row of the list box.
.PP
Set this property's value with setTopItem() and get this property's value with topItem().
.SH "bool variableHeight"
This property holds whether this list box has variable-height rows.
.PP
When the list box has variable-height rows (the default), each row is as high as the highest item in that row. When it has same-sized rows, all rows are as high as the highest item in the list box.
.PP
See also variableWidth.
.PP
Set this property's value with setVariableHeight() and get this property's value with variableHeight().
.SH "bool variableWidth"
This property holds whether this list box has variable-width columns.
.PP
When the list box has variable-width columns, each column is as wide as the widest item in that column. When it has same-sized columns (the default), all columns are as wide as the widest item in the list box.
.PP
See also variableHeight.
.PP
Set this property's value with setVariableWidth() and get this property's value with variableWidth().
.SH "SEE ALSO"
.BR http://doc.trolltech.com/qlistbox.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 Qt documentation is provided in HTML format; it is
located at $QTDIR/doc/html and can be read using Qt 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 [email protected] .
Please include the name of the manual page (qlistbox.3qt) and the Qt
version (3.3.8).
|