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 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- /home/harald/tmp/qt-3.3.7-harald-4508/qt-x11-free-3.3.7/src/widgets/qlistbox.cpp:804 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>QListBox 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>QListBox Class Reference</h1>
<p>The QListBox widget provides a list of selectable, read-only items.
<a href="#details">More...</a>
<p><tt>#include <<a href="qlistbox-h.html">qlistbox.h</a>></tt>
<p>Inherits <a href="qscrollview.html">QScrollView</a>.
<p><a href="qlistbox-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li class=fn><a href="#QListBox"><b>QListBox</b></a> ( QWidget * parent = 0, const char * name = 0, WFlags f = 0 )</li>
<li class=fn><a href="#~QListBox"><b>~QListBox</b></a> ()</li>
<li class=fn>uint <a href="#count"><b>count</b></a> () const</li>
<li class=fn>void <a href="#insertStringList"><b>insertStringList</b></a> ( const QStringList & list, int index = -1 )</li>
<li class=fn>void <a href="#insertStrList"><b>insertStrList</b></a> ( const QStrList * list, int index = -1 )</li>
<li class=fn>void <a href="#insertStrList-2"><b>insertStrList</b></a> ( const QStrList & list, int index = -1 )</li>
<li class=fn>void <a href="#insertStrList-3"><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 QListBoxItem * lbi, int index = -1 )</li>
<li class=fn>void <a href="#insertItem-2"><b>insertItem</b></a> ( const QListBoxItem * lbi, const QListBoxItem * after )</li>
<li class=fn>void <a href="#insertItem-3"><b>insertItem</b></a> ( const QString & text, int index = -1 )</li>
<li class=fn>void <a href="#insertItem-4"><b>insertItem</b></a> ( const QPixmap & pixmap, int index = -1 )</li>
<li class=fn>void <a href="#insertItem-5"><b>insertItem</b></a> ( const QPixmap & pixmap, const QString & text, int index = -1 )</li>
<li class=fn>void <a href="#removeItem"><b>removeItem</b></a> ( int index )</li>
<li class=fn>QString <a href="#text"><b>text</b></a> ( int index ) const</li>
<li class=fn>const QPixmap * <a href="#pixmap"><b>pixmap</b></a> ( int index ) const</li>
<li class=fn>void <a href="#changeItem"><b>changeItem</b></a> ( const QListBoxItem * lbi, int index )</li>
<li class=fn>void <a href="#changeItem-2"><b>changeItem</b></a> ( const QString & text, int index )</li>
<li class=fn>void <a href="#changeItem-3"><b>changeItem</b></a> ( const QPixmap & pixmap, int index )</li>
<li class=fn>void <a href="#changeItem-4"><b>changeItem</b></a> ( const QPixmap & pixmap, const QString & text, int index )</li>
<li class=fn>void <a href="#takeItem"><b>takeItem</b></a> ( const QListBoxItem * item )</li>
<li class=fn>int <a href="#numItemsVisible"><b>numItemsVisible</b></a> () const</li>
<li class=fn>int <a href="#currentItem"><b>currentItem</b></a> () const</li>
<li class=fn>QString <a href="#currentText"><b>currentText</b></a> () const</li>
<li class=fn>virtual void <a href="#setCurrentItem"><b>setCurrentItem</b></a> ( int index )</li>
<li class=fn>virtual void <a href="#setCurrentItem-2"><b>setCurrentItem</b></a> ( QListBoxItem * i )</li>
<li class=fn>void centerCurrentItem () <em>(obsolete)</em></li>
<li class=fn>int <a href="#topItem"><b>topItem</b></a> () const</li>
<li class=fn>virtual void <a href="#setTopItem"><b>setTopItem</b></a> ( int index )</li>
<li class=fn>virtual void <a href="#setBottomItem"><b>setBottomItem</b></a> ( int index )</li>
<li class=fn>long <a href="#maxItemWidth"><b>maxItemWidth</b></a> () const</li>
<li class=fn>enum <a href="#SelectionMode-enum"><b>SelectionMode</b></a> { Single, Multi, Extended, NoSelection }</li>
<li class=fn>virtual void <a href="#setSelectionMode"><b>setSelectionMode</b></a> ( SelectionMode )</li>
<li class=fn>SelectionMode <a href="#selectionMode"><b>selectionMode</b></a> () const</li>
<li class=fn>void setMultiSelection ( bool multi ) <em>(obsolete)</em></li>
<li class=fn>bool isMultiSelection () const <em>(obsolete)</em></li>
<li class=fn>virtual void <a href="#setSelected"><b>setSelected</b></a> ( QListBoxItem * item, bool select )</li>
<li class=fn>void <a href="#setSelected-2"><b>setSelected</b></a> ( int index, bool select )</li>
<li class=fn>bool <a href="#isSelected"><b>isSelected</b></a> ( int i ) const</li>
<li class=fn>bool <a href="#isSelected-2"><b>isSelected</b></a> ( const QListBoxItem * i ) const</li>
<li class=fn>QListBoxItem * <a href="#selectedItem"><b>selectedItem</b></a> () const</li>
<li class=fn>QListBoxItem * <a href="#item"><b>item</b></a> ( int index ) const</li>
<li class=fn>int <a href="#index"><b>index</b></a> ( const QListBoxItem * lbi ) const</li>
<li class=fn>QListBoxItem * <a href="#findItem"><b>findItem</b></a> ( const QString & text, ComparisonFlags compare = BeginsWith ) const</li>
<li class=fn>void <a href="#triggerUpdate"><b>triggerUpdate</b></a> ( bool doLayout )</li>
<li class=fn>bool <a href="#itemVisible"><b>itemVisible</b></a> ( int index )</li>
<li class=fn>bool <a href="#itemVisible-2"><b>itemVisible</b></a> ( const QListBoxItem * item )</li>
<li class=fn>enum <a href="#LayoutMode-enum"><b>LayoutMode</b></a> { FixedNumber, FitToWidth, FitToHeight = FitToWidth, Variable }</li>
<li class=fn>virtual void <a href="#setColumnMode"><b>setColumnMode</b></a> ( LayoutMode )</li>
<li class=fn>virtual void <a href="#setColumnMode-2"><b>setColumnMode</b></a> ( int )</li>
<li class=fn>virtual void <a href="#setRowMode"><b>setRowMode</b></a> ( LayoutMode )</li>
<li class=fn>virtual void <a href="#setRowMode-2"><b>setRowMode</b></a> ( int )</li>
<li class=fn>LayoutMode <a href="#columnMode"><b>columnMode</b></a> () const</li>
<li class=fn>LayoutMode <a href="#rowMode"><b>rowMode</b></a> () const</li>
<li class=fn>int <a href="#numColumns"><b>numColumns</b></a> () const</li>
<li class=fn>int <a href="#numRows"><b>numRows</b></a> () const</li>
<li class=fn>bool <a href="#variableWidth"><b>variableWidth</b></a> () const</li>
<li class=fn>virtual void <a href="#setVariableWidth"><b>setVariableWidth</b></a> ( bool )</li>
<li class=fn>bool <a href="#variableHeight"><b>variableHeight</b></a> () const</li>
<li class=fn>virtual void <a href="#setVariableHeight"><b>setVariableHeight</b></a> ( bool )</li>
<li class=fn>bool autoScrollBar () const <em>(obsolete)</em></li>
<li class=fn>void setAutoScrollBar ( bool enable ) <em>(obsolete)</em></li>
<li class=fn>bool scrollBar () const <em>(obsolete)</em></li>
<li class=fn>void setScrollBar ( bool enable ) <em>(obsolete)</em></li>
<li class=fn>bool autoBottomScrollBar () const <em>(obsolete)</em></li>
<li class=fn>void setAutoBottomScrollBar ( bool enable ) <em>(obsolete)</em></li>
<li class=fn>bool bottomScrollBar () const <em>(obsolete)</em></li>
<li class=fn>void setBottomScrollBar ( bool enable ) <em>(obsolete)</em></li>
<li class=fn>int inSort ( const QListBoxItem * lbi ) <em>(obsolete)</em></li>
<li class=fn>int inSort ( const QString & text ) <em>(obsolete)</em></li>
<li class=fn>int cellHeight ( int i ) const <em>(obsolete)</em></li>
<li class=fn>int cellHeight () const <em>(obsolete)</em></li>
<li class=fn>int cellWidth () const <em>(obsolete)</em></li>
<li class=fn>int numCols () const <em>(obsolete)</em></li>
<li class=fn>int <a href="#itemHeight"><b>itemHeight</b></a> ( int index = 0 ) const</li>
<li class=fn>QListBoxItem * <a href="#itemAt"><b>itemAt</b></a> ( const QPoint & p ) const</li>
<li class=fn>QRect <a href="#itemRect"><b>itemRect</b></a> ( QListBoxItem * item ) const</li>
<li class=fn>QListBoxItem * <a href="#firstItem"><b>firstItem</b></a> () const</li>
<li class=fn>void <a href="#sort"><b>sort</b></a> ( bool ascending = TRUE )</li>
</ul>
<h2>Public Slots</h2>
<ul>
<li class=fn>void <a href="#clear"><b>clear</b></a> ()</li>
<li class=fn>virtual void <a href="#ensureCurrentVisible"><b>ensureCurrentVisible</b></a> ()</li>
<li class=fn>virtual void <a href="#clearSelection"><b>clearSelection</b></a> ()</li>
<li class=fn>virtual void <a href="#selectAll"><b>selectAll</b></a> ( bool select )</li>
<li class=fn>virtual void <a href="#invertSelection"><b>invertSelection</b></a> ()</li>
</ul>
<h2>Signals</h2>
<ul>
<li class=fn>void <a href="#highlighted"><b>highlighted</b></a> ( int index )</li>
<li class=fn>void <a href="#selected"><b>selected</b></a> ( int index )</li>
<li class=fn>void <a href="#highlighted-2"><b>highlighted</b></a> ( const QString & )</li>
<li class=fn>void <a href="#selected-2"><b>selected</b></a> ( const QString & )</li>
<li class=fn>void <a href="#highlighted-3"><b>highlighted</b></a> ( QListBoxItem * )</li>
<li class=fn>void <a href="#selected-3"><b>selected</b></a> ( QListBoxItem * )</li>
<li class=fn>void <a href="#selectionChanged"><b>selectionChanged</b></a> ()</li>
<li class=fn>void <a href="#selectionChanged-2"><b>selectionChanged</b></a> ( QListBoxItem * item )</li>
<li class=fn>void <a href="#currentChanged"><b>currentChanged</b></a> ( QListBoxItem * item )</li>
<li class=fn>void <a href="#clicked"><b>clicked</b></a> ( QListBoxItem * item )</li>
<li class=fn>void <a href="#clicked-2"><b>clicked</b></a> ( QListBoxItem * item, const QPoint & pnt )</li>
<li class=fn>void <a href="#pressed"><b>pressed</b></a> ( QListBoxItem * item )</li>
<li class=fn>void <a href="#pressed-2"><b>pressed</b></a> ( QListBoxItem * item, const QPoint & pnt )</li>
<li class=fn>void <a href="#doubleClicked"><b>doubleClicked</b></a> ( QListBoxItem * item )</li>
<li class=fn>void <a href="#returnPressed"><b>returnPressed</b></a> ( QListBoxItem * )</li>
<li class=fn>void <a href="#rightButtonClicked"><b>rightButtonClicked</b></a> ( QListBoxItem *, const QPoint & )</li>
<li class=fn>void <a href="#rightButtonPressed"><b>rightButtonPressed</b></a> ( QListBoxItem *, const QPoint & )</li>
<li class=fn>void <a href="#mouseButtonPressed"><b>mouseButtonPressed</b></a> ( int button, QListBoxItem * item, const QPoint & pos )</li>
<li class=fn>void <a href="#mouseButtonClicked"><b>mouseButtonClicked</b></a> ( int button, QListBoxItem * item, const QPoint & pos )</li>
<li class=fn>void <a href="#contextMenuRequested"><b>contextMenuRequested</b></a> ( QListBoxItem * item, const QPoint & pos )</li>
<li class=fn>void <a href="#onItem"><b>onItem</b></a> ( QListBoxItem * i )</li>
<li class=fn>void <a href="#onViewport"><b>onViewport</b></a> ()</li>
</ul>
<h2>Properties</h2>
<ul>
<li class=fn>LayoutMode <a href="#columnMode-prop"><b>columnMode</b></a> - the column layout mode for this list box</li>
<li class=fn>uint <a href="#count-prop"><b>count</b></a> - the number of items in the list box <em>(read only)</em></li>
<li class=fn>int <a href="#currentItem-prop"><b>currentItem</b></a> - the current highlighted item</li>
<li class=fn>QString <a href="#currentText-prop"><b>currentText</b></a> - the text of the current item <em>(read only)</em></li>
<li class=fn>bool multiSelection - whether or not the list box is in Multi selection mode <em>(obsolete)</em></li>
<li class=fn>int <a href="#numColumns-prop"><b>numColumns</b></a> - the number of columns in the list box <em>(read only)</em></li>
<li class=fn>int <a href="#numItemsVisible-prop"><b>numItemsVisible</b></a> - the number of visible items <em>(read only)</em></li>
<li class=fn>int <a href="#numRows-prop"><b>numRows</b></a> - the number of rows in the list box <em>(read only)</em></li>
<li class=fn>LayoutMode <a href="#rowMode-prop"><b>rowMode</b></a> - the row layout mode for this list box</li>
<li class=fn>SelectionMode <a href="#selectionMode-prop"><b>selectionMode</b></a> - the selection mode of the list box</li>
<li class=fn>int <a href="#topItem-prop"><b>topItem</b></a> - the index of an item at the top of the screen</li>
<li class=fn>bool <a href="#variableHeight-prop"><b>variableHeight</b></a> - whether this list box has variable-height rows</li>
<li class=fn>bool <a href="#variableWidth-prop"><b>variableWidth</b></a> - whether this list box has variable-width columns</li>
</ul>
<h2>Protected Members</h2>
<ul>
<li class=fn>void <a href="#updateItem"><b>updateItem</b></a> ( int index )</li>
<li class=fn>void <a href="#updateItem-2"><b>updateItem</b></a> ( QListBoxItem * i )</li>
<li class=fn>int totalWidth () const <em>(obsolete)</em></li>
<li class=fn>int totalHeight () const <em>(obsolete)</em></li>
<li class=fn>virtual void <a href="#paintCell"><b>paintCell</b></a> ( QPainter * p, int row, int col )</li>
<li class=fn>void <a href="#toggleCurrentItem"><b>toggleCurrentItem</b></a> ()</li>
<li class=fn>bool <a href="#isRubberSelecting"><b>isRubberSelecting</b></a> () const</li>
<li class=fn>void <a href="#doLayout"><b>doLayout</b></a> () const</li>
<li class=fn>bool itemYPos ( int index, int * yPos ) const <em>(obsolete)</em></li>
<li class=fn>int findItem ( int yPos ) const <em>(obsolete)</em></li>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>
The QListBox widget provides a list of selectable, read-only items.
<p>
<p> 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.
<p> QListBox will add scroll bars as necessary, but it isn't intended
for <em>really</em> 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
<a href="qlistview.html">QListView</a> and <a href="qtable.html">QTable</a> for possible alternatives.)
<p> There are a variety of selection modes described in the
QListBox::SelectionMode documentation. The default is <a href="#SelectionMode-enum">Single</a>
selection mode, but you can change it using <a href="#setSelectionMode">setSelectionMode</a>().
(<a href="#setMultiSelection">setMultiSelection</a>() is still provided for compatibility with Qt
1.x. We recommend using setSelectionMode() in all code.)
<p> Because QListBox offers multiple selection it must display
<a href="focus.html#keyboard-focus">keyboard focus</a> and selection state separately. Therefore there are
functions both to set the selection state of an item, i.e.
<a href="#setSelected">setSelected</a>(), and to set which item displays keyboard focus, i.e.
<a href="#setCurrentItem">setCurrentItem</a>().
<p> The list box normally arranges its items in a single column and
adds a vertical scroll bar if required. It is possible to have a
different fixed number of columns (<a href="#setColumnMode">setColumnMode</a>()), 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
(<a href="#setRowMode">setRowMode</a>()) 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.
<p> 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 <a href="#setVariableHeight">setVariableHeight</a>(FALSE). The same
applies to a column's width, see <a href="#setVariableWidth">setVariableWidth</a>().
<p> The QListBox's items are <a href="qlistboxitem.html">QListBoxItem</a> objects. QListBox provides
methods to insert new items as strings, as pixmaps, and as
QListBoxItem * (<a href="#insertItem">insertItem</a>() with various arguments), and to
replace an existing item with a new string, pixmap or QListBoxItem
(<a href="#changeItem">changeItem</a>() with various arguments). You can also remove items
singly with <a href="#removeItem">removeItem</a>() or <a href="#clear">clear</a>() the entire list box. Note that
if you create a QListBoxItem yourself and insert it, QListBox
takes ownership of the item.
<p> You can also create a QListBoxItem, such as <a href="qlistboxtext.html">QListBoxText</a> or
<a href="qlistboxpixmap.html">QListBoxPixmap</a>, 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.
<p> 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 <a href="qlistview.html">QListView</a> and <a href="qtable.html">QTable</a> do), or tree hierarchies (but
QListView does).
<p> The list box items can be accessed both as <a href="qlistboxitem.html">QListBoxItem</a> 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.
<p> Each item in a QListBox contains a QListBoxItem. One of the items
can be the current item. The <a href="#currentChanged">currentChanged</a>() signal and the
<a href="#highlighted">highlighted</a>() signal are emitted when a new item becomes current,
e.g. because the user clicks on it or <a href="#setCurrentItem">QListBox::setCurrentItem</a>()
is called. The <a href="#selected">selected</a>() signal is emitted when the user
double-clicks on an item or presses Enter on the current item.
<p> If the user does not select anything, no signals are emitted and
<a href="#currentItem">currentItem</a>() returns -1.
<p> A list box has <a href="qwidget.html#FocusPolicy-enum">WheelFocus</a> as a default <a href="qwidget.html#focusPolicy">focusPolicy</a>(), i.e. it
can get keyboard focus by tabbing, clicking and through the use of
the mouse wheel.
<p> New items can be inserted using <a href="#insertItem">insertItem</a>(), <a href="#insertStrList">insertStrList</a>() or
<a href="#insertStringList">insertStringList</a>(). <a href="#inSort">inSort</a>() is obsolete because this method is
quite inefficient. It's preferable to insert the items normally
and call <a href="#sort">sort</a>() afterwards, or to insert a sorted <a href="qstringlist.html">QStringList</a>().
<p> By default, vertical and horizontal scroll bars are added and
removed as necessary. <a href="qscrollview.html#setHScrollBarMode">setHScrollBarMode</a>() and <a href="qscrollview.html#setVScrollBarMode">setVScrollBarMode</a>()
can be used to change this policy.
<p> If you need to insert types other than strings and pixmaps, you
must define new classes which inherit <a href="qlistboxitem.html">QListBoxItem</a>.
<p> <b>Warning:</b> The list box assumes ownership of all list box items and
will delete them when it does not need them any more.
<p> <img src=qlistbox-m.png> <img src=qlistbox-w.png>
<p> <p>See also <a href="qlistview.html">QListView</a>, <a href="qcombobox.html">QComboBox</a>, <a href="qbuttongroup.html">QButtonGroup</a>, <a href="guibooks.html#fowler">GUI Design Handbook: List Box (two
sections)</a>, and <a href="advanced.html">Advanced Widgets</a>.
<hr><h2>Member Type Documentation</h2>
<h3 class=fn><a name="LayoutMode-enum"></a>QListBox::LayoutMode</h3>
<p> This enum type is used to specify how QListBox lays out its rows
and columns.
<ul>
<li><tt>QListBox::FixedNumber</tt> - There is a fixed number of rows (or columns).
<li><tt>QListBox::FitToWidth</tt> - There are as many columns as will fit
on-screen.
<li><tt>QListBox::FitToHeight</tt> - There are as many rows as will fit on-screen.
<li><tt>QListBox::Variable</tt> - There are as many rows as are required by the
column mode. (Or as many columns as required by the row mode.)
</ul><p> Example: When you call <a href="#setRowMode">setRowMode</a>( FitToHeight ), <a href="#columnMode">columnMode</a>()
automatically becomes <a href="#LayoutMode-enum">Variable</a> to accommodate the row mode
you've set.
<h3 class=fn><a name="SelectionMode-enum"></a>QListBox::SelectionMode</h3>
<p> This enumerated type is used by QListBox to indicate how it reacts
to selection by the user.
<ul>
<li><tt>QListBox::Single</tt> - 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 <a href="#clearSelection">QListBox::clearSelection</a>().
<li><tt>QListBox::Multi</tt> - 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.
<li><tt>QListBox::Extended</tt> - 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.
<li><tt>QListBox::NoSelection</tt> - Items cannot be selected.
</ul><p> In other words, <a href="#SelectionMode-enum">Single</a> is a real single-selection list box, <a href="#SelectionMode-enum">Multi</a> is a real multi-selection list box, <a href="#SelectionMode-enum">Extended</a> 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 <a href="#SelectionMode-enum">NoSelection</a> is for a list box where the user can look but not
touch.
<hr><h2>Member Function Documentation</h2>
<h3 class=fn><a name="QListBox"></a>QListBox::QListBox ( <a href="qwidget.html">QWidget</a> * parent = 0, const char * name = 0, WFlags f = 0 )
</h3>
Constructs a new empty list box called <em>name</em> and with parent <em>parent</em>.
<p> Performance is boosted by modifying the widget flags <em>f</em> so that
only part of the <a href="qlistboxitem.html">QListBoxItem</a> children is redrawn. This may be
unsuitable for custom QListBoxItem classes, in which case <a href="qt.html#WidgetFlags-enum">WStaticContents</a> and <a href="qt.html#WidgetFlags-enum">WNoAutoErase</a> should be cleared
immediately after construction.
<p> <p>See also <a href="qwidget.html#clearWFlags">QWidget::clearWFlags</a>() and <a href="qt.html#WidgetFlags-enum">Qt::WidgetFlags</a>.
<h3 class=fn><a name="~QListBox"></a>QListBox::~QListBox ()
</h3>
Destroys the list box. Deletes all list box items.
<h3 class=fn>bool <a name="autoBottomScrollBar"></a>QListBox::autoBottomScrollBar () const
</h3>
<p> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
<p> Returns TRUE if <a href="qscrollview.html#hScrollBarMode">hScrollBarMode</a>() is <a href="qscrollview.html#ScrollBarMode-enum">Auto</a>; otherwise returns
FALSE.
<h3 class=fn>bool <a name="autoScrollBar"></a>QListBox::autoScrollBar () const
</h3>
<p> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
<p> Returns TRUE if <a href="qscrollview.html#vScrollBarMode">vScrollBarMode</a>() is <a href="qscrollview.html#ScrollBarMode-enum">Auto</a>; otherwise returns
FALSE.
<h3 class=fn>bool <a name="bottomScrollBar"></a>QListBox::bottomScrollBar () const
</h3>
<p> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
<p> Returns FALSE if <a href="qscrollview.html#vScrollBarMode">vScrollBarMode</a>() is <a href="qscrollview.html#ScrollBarMode-enum">AlwaysOff</a>; otherwise
returns TRUE.
<h3 class=fn>int <a name="cellHeight"></a>QListBox::cellHeight ( int i ) const
</h3>
<b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
<p>
Returns the item height of item <em>i</em>.
<p>See also <a href="#itemHeight">itemHeight</a>().
<h3 class=fn>int <a name="cellHeight-2"></a>QListBox::cellHeight () const
</h3>
<b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Returns the item height of the first item, item 0.
<p>See also <a href="#itemHeight">itemHeight</a>().
<h3 class=fn>int <a name="cellWidth"></a>QListBox::cellWidth () const
</h3>
<b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
<p>
Returns the maximum item width.
<p>See also <a href="#maxItemWidth">maxItemWidth</a>().
<h3 class=fn>void <a name="centerCurrentItem"></a>QListBox::centerCurrentItem ()
</h3>
<b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
<p> This function does exactly the same as <a href="#ensureCurrentVisible">ensureCurrentVisible</a>()
<p> <p>See also <a href="#ensureCurrentVisible">QListBox::ensureCurrentVisible</a>().
<h3 class=fn>void <a name="changeItem"></a>QListBox::changeItem ( const <a href="qlistboxitem.html">QListBoxItem</a> * lbi, int index )
</h3>
Replaces the item at position <em>index</em> with <em>lbi</em>. If <em>index</em> is
negative or too large, <a href="#changeItem">changeItem</a>() does nothing.
<p> The item that has been changed will become selected.
<p> <p>See also <a href="#insertItem">insertItem</a>() and <a href="#removeItem">removeItem</a>().
<h3 class=fn>void <a name="changeItem-2"></a>QListBox::changeItem ( const <a href="qstring.html">QString</a> & text, 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 a new list box text
item with text <em>text</em>.
<p> The operation is ignored if <em>index</em> is out of range.
<p> <p>See also <a href="#insertItem">insertItem</a>() and <a href="#removeItem">removeItem</a>().
<h3 class=fn>void <a name="changeItem-3"></a>QListBox::changeItem ( const <a href="qpixmap.html">QPixmap</a> & pixmap, 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 a new list box pixmap
item with pixmap <em>pixmap</em>.
<p> The operation is ignored if <em>index</em> is out of range.
<p> <p>See also <a href="#insertItem">insertItem</a>() and <a href="#removeItem">removeItem</a>().
<h3 class=fn>void <a name="changeItem-4"></a>QListBox::changeItem ( const <a href="qpixmap.html">QPixmap</a> & pixmap, const <a href="qstring.html">QString</a> & text, 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 a new list box pixmap
item with pixmap <em>pixmap</em> and text <em>text</em>.
<p> The operation is ignored if <em>index</em> is out of range.
<p> <p>See also <a href="#insertItem">insertItem</a>() and <a href="#removeItem">removeItem</a>().
<h3 class=fn>void <a name="clear"></a>QListBox::clear ()<tt> [slot]</tt>
</h3>
Deletes all the items in the list.
<p> <p>See also <a href="#removeItem">removeItem</a>().
<h3 class=fn>void <a name="clearSelection"></a>QListBox::clearSelection ()<tt> [virtual slot]</tt>
</h3>
Deselects all items, if possible.
<p> Note that a <a href="#SelectionMode-enum">Single</a> selection list box will automatically select
an item if it has <a href="focus.html#keyboard-focus">keyboard focus</a>.
<p>Example: <a href="listbox-example.html#x1430">listbox/listbox.cpp</a>.
<h3 class=fn>void <a name="clicked"></a>QListBox::clicked ( <a href="qlistboxitem.html">QListBoxItem</a> * item )<tt> [signal]</tt>
</h3>
<p> This signal is emitted when the user clicks any mouse button. If
<em>item</em> is not 0, the cursor is on <em>item</em>. If <em>item</em> is 0, the
mouse cursor isn't on any item.
<p> Note that you must not delete any <a href="qlistboxitem.html">QListBoxItem</a> objects in slots
connected to this signal.
<h3 class=fn>void <a name="clicked-2"></a>QListBox::clicked ( <a href="qlistboxitem.html">QListBoxItem</a> * item, const <a href="qpoint.html">QPoint</a> & pnt )<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 the user clicks any mouse button. If
<em>item</em> is not 0, the cursor is on <em>item</em>. If <em>item</em> is 0, the
mouse cursor isn't on any item.
<p> <em>pnt</em> is the position of the mouse cursor in the global
coordinate system (<a href="qmouseevent.html#globalPos">QMouseEvent::globalPos</a>()). (If the click's
press and release differs by a pixel or two, <em>pnt</em> is the
position at release time.)
<p> Note that you must not delete any <a href="qlistboxitem.html">QListBoxItem</a> objects in slots
connected to this signal.
<h3 class=fn><a href="qlistbox.html#LayoutMode-enum">LayoutMode</a> <a name="columnMode"></a>QListBox::columnMode () const
</h3><p>Returns the column layout mode for this list box.
See the <a href="qlistbox.html#columnMode-prop">"columnMode"</a> property for details.
<h3 class=fn>void <a name="contextMenuRequested"></a>QListBox::contextMenuRequested ( <a href="qlistboxitem.html">QListBoxItem</a> * item, const <a href="qpoint.html">QPoint</a> & pos )<tt> [signal]</tt>
</h3>
<p> This signal is emitted when the user invokes a context menu with
the right mouse button or with special system keys, with <em>item</em>
being the item under the mouse cursor or the current item,
respectively.
<p> <em>pos</em> is the position for the context menu in the global
coordinate system.
<h3 class=fn>uint <a name="count"></a>QListBox::count () const
</h3><p>Returns the number of items in the list box.
See the <a href="qlistbox.html#count-prop">"count"</a> property for details.
<h3 class=fn>void <a name="currentChanged"></a>QListBox::currentChanged ( <a href="qlistboxitem.html">QListBoxItem</a> * item )<tt> [signal]</tt>
</h3>
<p> This signal is emitted when the user makes a new item the current
item. <em>item</em> is the new current list box item.
<p> <p>See also <a href="#currentItem-prop">currentItem</a> and <a href="#currentItem-prop">currentItem</a>.
<h3 class=fn>int <a name="currentItem"></a>QListBox::currentItem () const
</h3><p>Returns the current highlighted item.
See the <a href="qlistbox.html#currentItem-prop">"currentItem"</a> property for details.
<h3 class=fn><a href="qstring.html">QString</a> <a name="currentText"></a>QListBox::currentText () const
</h3><p>Returns the text of the current item.
See the <a href="qlistbox.html#currentText-prop">"currentText"</a> property for details.
<h3 class=fn>void <a name="doLayout"></a>QListBox::doLayout () const<tt> [protected]</tt>
</h3>
This function does the hard layout work. You should never need to
call it.
<h3 class=fn>void <a name="doubleClicked"></a>QListBox::doubleClicked ( <a href="qlistboxitem.html">QListBoxItem</a> * item )<tt> [signal]</tt>
</h3>
<p> This signal is emitted whenever an item is double-clicked. It's
emitted on the second button press, not the second button release.
If <em>item</em> is not 0, the cursor is on <em>item</em>. If <em>item</em> is 0,
the mouse cursor isn't on any item.
<h3 class=fn>void <a name="ensureCurrentVisible"></a>QListBox::ensureCurrentVisible ()<tt> [virtual slot]</tt>
</h3>
Ensures that the current item is visible.
<h3 class=fn><a href="qlistboxitem.html">QListBoxItem</a> * <a name="findItem"></a>QListBox::findItem ( const <a href="qstring.html">QString</a> & text, ComparisonFlags compare = BeginsWith ) const
</h3>
Finds the first list box item that has the text <em>text</em> 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 <tt>ComparisonFlags</tt> are specified in <em>compare</em> then these flags
are used, otherwise the default is a case-insensitive, "begins
with" search.
<p> <p>See also <a href="qt.html#StringComparisonMode-enum">Qt::StringComparisonMode</a>.
<h3 class=fn>int <a name="findItem-2"></a>QListBox::findItem ( int yPos ) const<tt> [protected]</tt>
</h3>
<b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
<p>
Returns the index of the item a point (0, <em>yPos</em>).
<p>See also <a href="#index">index</a>() and <a href="#itemAt">itemAt</a>().
<h3 class=fn><a href="qlistboxitem.html">QListBoxItem</a> * <a name="firstItem"></a>QListBox::firstItem () const
</h3>
Returns the first item in this list box. If the list box is empty,
returns 0.
<h3 class=fn>void <a name="highlighted"></a>QListBox::highlighted ( int index )<tt> [signal]</tt>
</h3>
<p> This signal is emitted when the user makes a new item the current
item. <em>index</em> is the index of the new current item.
<p> <p>See also <a href="#currentChanged">currentChanged</a>(), <a href="#selected">selected</a>(), <a href="#currentItem-prop">currentItem</a>, and <a href="#selectionChanged">selectionChanged</a>().
<h3 class=fn>void <a name="highlighted-2"></a>QListBox::highlighted ( const <a href="qstring.html">QString</a> & )<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 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.
<p> <p>See also <a href="#currentChanged">currentChanged</a>(), <a href="#selected">selected</a>(), <a href="#currentItem-prop">currentItem</a>, and <a href="#selectionChanged">selectionChanged</a>().
<h3 class=fn>void <a name="highlighted-3"></a>QListBox::highlighted ( <a href="qlistboxitem.html">QListBoxItem</a> * )<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 the user makes a new item the current
item. The argument is a pointer to the new current item.
<p> <p>See also <a href="#currentChanged">currentChanged</a>(), <a href="#selected">selected</a>(), <a href="#currentItem-prop">currentItem</a>, and <a href="#selectionChanged">selectionChanged</a>().
<h3 class=fn>int <a name="inSort"></a>QListBox::inSort ( const <a href="qlistboxitem.html">QListBoxItem</a> * lbi )
</h3>
<b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
<p> Using this method is quite inefficient. We suggest to use <a href="#insertItem">insertItem</a>()
for inserting and <a href="#sort">sort</a>() afterwards.
<p> Inserts <em>lbi</em> at its sorted position in the list box and returns the
position.
<p> All items must be inserted with <a href="#inSort">inSort</a>() to maintain the sorting
order. inSort() treats any pixmap (or user-defined type) as
lexicographically less than any string.
<p> <p>See also <a href="#insertItem">insertItem</a>() and <a href="#sort">sort</a>().
<h3 class=fn>int <a name="inSort-2"></a>QListBox::inSort ( const <a href="qstring.html">QString</a> & text )
</h3>
<b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Using this method is quite inefficient. We suggest to use <a href="#insertItem">insertItem</a>()
for inserting and <a href="#sort">sort</a>() afterwards.
<p> Inserts a new item of <em>text</em> at its sorted position in the list box and
returns the position.
<p> All items must be inserted with <a href="#inSort">inSort</a>() to maintain the sorting
order. inSort() treats any pixmap (or user-defined type) as
lexicographically less than any string.
<p> <p>See also <a href="#insertItem">insertItem</a>() and <a href="#sort">sort</a>().
<h3 class=fn>int <a name="index"></a>QListBox::index ( const <a href="qlistboxitem.html">QListBoxItem</a> * lbi ) const
</h3>
Returns the index of <em>lbi</em>, or -1 if the item is not in this list
box or <em>lbi</em> is 0.
<p> <p>See also <a href="#item">item</a>().
<h3 class=fn>void <a name="insertItem"></a>QListBox::insertItem ( const <a href="qlistboxitem.html">QListBoxItem</a> * lbi, int index = -1 )
</h3>
Inserts the item <em>lbi</em> into the list at position <em>index</em>.
<p> If <em>index</em> is negative or larger than the number of items in the
list box, <em>lbi</em> is inserted at the end of the list.
<p> <p>See also <a href="#insertStrList">insertStrList</a>().
<p>Examples: <a href="i18n-example.html#x1939">i18n/mywidget.cpp</a>, <a href="listbox-example.html#x1431">listbox/listbox.cpp</a>, <a href="listboxcombo-example.html#x1186">listboxcombo/listboxcombo.cpp</a>, and <a href="tabdialog-example.html#x36">tabdialog/tabdialog.cpp</a>.
<h3 class=fn>void <a name="insertItem-2"></a>QListBox::insertItem ( const <a href="qlistboxitem.html">QListBoxItem</a> * lbi, const <a href="qlistboxitem.html">QListBoxItem</a> * after )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Inserts the item <em>lbi</em> into the list after the item <em>after</em>, or
at the beginning if <em>after</em> is 0.
<p> <p>See also <a href="#insertStrList">insertStrList</a>().
<h3 class=fn>void <a name="insertItem-3"></a>QListBox::insertItem ( const <a href="qstring.html">QString</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 new list box text item with the text <em>text</em> into the
list at position <em>index</em>.
<p> If <em>index</em> is negative, <em>text</em> is inserted at the end of the
list.
<p> <p>See also <a href="#insertStrList">insertStrList</a>().
<h3 class=fn>void <a name="insertItem-4"></a>QListBox::insertItem ( const <a href="qpixmap.html">QPixmap</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 new list box pixmap item with the pixmap <em>pixmap</em> into
the list at position <em>index</em>.
<p> If <em>index</em> is negative, <em>pixmap</em> is inserted at the end of the
list.
<p> <p>See also <a href="#insertStrList">insertStrList</a>().
<h3 class=fn>void <a name="insertItem-5"></a>QListBox::insertItem ( const <a href="qpixmap.html">QPixmap</a> & pixmap, const <a href="qstring.html">QString</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 new list box pixmap item with the pixmap <em>pixmap</em> and
the text <em>text</em> into the list at position <em>index</em>.
<p> If <em>index</em> is negative, <em>pixmap</em> is inserted at the end of the
list.
<p> <p>See also <a href="#insertStrList">insertStrList</a>().
<h3 class=fn>void <a name="insertStrList"></a>QListBox::insertStrList ( const <a href="qstrlist.html">QStrList</a> * list, int index = -1 )
</h3>
Inserts the string list <em>list</em> into the list at position <em>index</em>.
<p> If <em>index</em> is negative, <em>list</em> is inserted at the end of the
list. If <em>index</em> is too large, the operation is ignored.
<p> <b>Warning:</b> This function uses <tt>const char *</tt> rather than <a href="qstring.html">QString</a>,
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 <a href="#insertStringList">insertStringList</a>() which uses real QStrings.
<p> <b>Warning:</b> This function is never significantly faster than a loop
around <a href="#insertItem">insertItem</a>().
<p> <p>See also <a href="#insertItem">insertItem</a>() and <a href="#insertStringList">insertStringList</a>().
<h3 class=fn>void <a name="insertStrList-2"></a>QListBox::insertStrList ( const <a href="qstrlist.html">QStrList</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 string list <em>list</em> into the list at position <em>index</em>.
<p> If <em>index</em> is negative, <em>list</em> is inserted at the end of the
list. If <em>index</em> is too large, the operation is ignored.
<p> <b>Warning:</b> This function uses <tt>const char *</tt> rather than <a href="qstring.html">QString</a>,
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 <a href="#insertStringList">insertStringList</a>() which uses real QStrings.
<p> <b>Warning:</b> This function is never significantly faster than a loop
around <a href="#insertItem">insertItem</a>().
<p> <p>See also <a href="#insertItem">insertItem</a>() and <a href="#insertStringList">insertStringList</a>().
<h3 class=fn>void <a name="insertStrList-3"></a>QListBox::insertStrList ( const char ** strings, int numStrings = -1, int index = -1 )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Inserts the <em>numStrings</em> strings of the array <em>strings</em> into the
list at position <em>index</em>.
<p> If <em>index</em> is negative, <a href="#insertStrList">insertStrList</a>() inserts <em>strings</em> at the
end of the list. If <em>index</em> is too large, the operation is
ignored.
<p> <b>Warning:</b> This function uses <tt>const char *</tt> rather than <a href="qstring.html">QString</a>,
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 <a href="#insertStringList">insertStringList</a>() which uses real QStrings.
<p> <b>Warning:</b> This function is never significantly faster than a loop
around <a href="#insertItem">insertItem</a>().
<p> <p>See also <a href="#insertItem">insertItem</a>() and <a href="#insertStringList">insertStringList</a>().
<h3 class=fn>void <a name="insertStringList"></a>QListBox::insertStringList ( const <a href="qstringlist.html">QStringList</a> & list, int index = -1 )
</h3>
Inserts the string list <em>list</em> into the list at position <em>index</em>.
<p> If <em>index</em> is negative, <em>list</em> is inserted at the end of the
list. If <em>index</em> is too large, the operation is ignored.
<p> <b>Warning:</b> This function is never significantly faster than a loop
around <a href="#insertItem">insertItem</a>().
<p> <p>See also <a href="#insertItem">insertItem</a>() and <a href="#insertStrList">insertStrList</a>().
<h3 class=fn>void <a name="invertSelection"></a>QListBox::invertSelection ()<tt> [virtual slot]</tt>
</h3>
Inverts the selection. Only works in <a href="#SelectionMode-enum">Multi</a> and <a href="#SelectionMode-enum">Extended</a>
selection mode.
<h3 class=fn>bool <a name="isMultiSelection"></a>QListBox::isMultiSelection () const
</h3><p>Returns TRUE if or not the list box is in Multi selection mode; otherwise returns FALSE.
See the <a href="qlistbox.html#multiSelection-prop">"multiSelection"</a> property for details.
<h3 class=fn>bool <a name="isRubberSelecting"></a>QListBox::isRubberSelecting () const<tt> [protected]</tt>
</h3>
Returns TRUE if the user is selecting items using a rubber band
rectangle; otherwise returns FALSE.
<h3 class=fn>bool <a name="isSelected"></a>QListBox::isSelected ( int i ) const
</h3>
Returns TRUE if item <em>i</em> is selected; otherwise returns FALSE.
<h3 class=fn>bool <a name="isSelected-2"></a>QListBox::isSelected ( const <a href="qlistboxitem.html">QListBoxItem</a> * i ) const
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Returns TRUE if item <em>i</em> is selected; otherwise returns FALSE.
<h3 class=fn><a href="qlistboxitem.html">QListBoxItem</a> * <a name="item"></a>QListBox::item ( int index ) const
</h3>
Returns a pointer to the item at position <em>index</em>, or 0 if <em>index</em> is out of bounds.
<p> <p>See also <a href="#index">index</a>().
<p>Example: <a href="listboxcombo-example.html#x1187">listboxcombo/listboxcombo.cpp</a>.
<h3 class=fn><a href="qlistboxitem.html">QListBoxItem</a> * <a name="itemAt"></a>QListBox::itemAt ( const <a href="qpoint.html">QPoint</a> & p ) const
</h3>
Returns the item at point <em>p</em>, specified in viewport coordinates,
or a 0 if there is no item at <em>p</em>.
<p> Use <a href="qscrollview.html#contentsToViewport">contentsToViewport</a>() to convert between widget coordinates and
viewport coordinates.
<h3 class=fn>int <a name="itemHeight"></a>QListBox::itemHeight ( int index = 0 ) const
</h3>
Returns the height in pixels of the item with index <em>index</em>. <em>index</em> defaults to 0.
<p> If <em>index</em> is too large, this function returns 0.
<h3 class=fn><a href="qrect.html">QRect</a> <a name="itemRect"></a>QListBox::itemRect ( <a href="qlistboxitem.html">QListBoxItem</a> * item ) const
</h3>
Returns the rectangle on the screen that <em>item</em> occupies in
<a href="qscrollview.html#viewport">viewport</a>()'s coordinates, or an invalid rectangle if <em>item</em> is 0
or is not currently visible.
<h3 class=fn>bool <a name="itemVisible"></a>QListBox::itemVisible ( int index )
</h3>
Returns TRUE if the item at position <em>index</em> is at least partly
visible; otherwise returns FALSE.
<h3 class=fn>bool <a name="itemVisible-2"></a>QListBox::itemVisible ( const <a href="qlistboxitem.html">QListBoxItem</a> * item )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Returns TRUE if <em>item</em> is at least partly visible; otherwise
returns FALSE.
<h3 class=fn>bool <a name="itemYPos"></a>QListBox::itemYPos ( int index, int * yPos ) const<tt> [protected]</tt>
</h3>
<b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
<p> Returns the vertical pixel-coordinate in <em>*yPos</em>, of the list box
item at position <em>index</em> in the list. Returns FALSE if the item is
outside the visible area.
<h3 class=fn>long <a name="maxItemWidth"></a>QListBox::maxItemWidth () const
</h3>
Returns the width of the widest item in the list box.
<h3 class=fn>void <a name="mouseButtonClicked"></a>QListBox::mouseButtonClicked ( int button, <a href="qlistboxitem.html">QListBoxItem</a> * item, const <a href="qpoint.html">QPoint</a> & pos )<tt> [signal]</tt>
</h3>
<p> This signal is emitted when the user clicks mouse button <em>button</em>. If <em>item</em> is not 0, the cursor is on <em>item</em>. If <em>item</em>
is 0, the mouse cursor isn't on any item.
<p> <em>pos</em> is the position of the mouse cursor in the global
coordinate system (<a href="qmouseevent.html#globalPos">QMouseEvent::globalPos</a>()). (If the click's
press and release differs by a pixel or two, <em>pos</em> is the
position at release time.)
<p> Note that you must not delete any <a href="qlistboxitem.html">QListBoxItem</a> objects in slots
connected to this signal.
<h3 class=fn>void <a name="mouseButtonPressed"></a>QListBox::mouseButtonPressed ( int button, <a href="qlistboxitem.html">QListBoxItem</a> * item, const <a href="qpoint.html">QPoint</a> & pos )<tt> [signal]</tt>
</h3>
<p> This signal is emitted when the user presses mouse button <em>button</em>. If <em>item</em> is not 0, the cursor is on <em>item</em>. If <em>item</em>
is 0, the mouse cursor isn't on any item.
<p> <em>pos</em> is the position of the mouse cursor in the global
coordinate system (<a href="qmouseevent.html#globalPos">QMouseEvent::globalPos</a>()).
<p> Note that you must not delete any <a href="qlistboxitem.html">QListBoxItem</a> objects in slots
connected to this signal.
<h3 class=fn>int <a name="numCols"></a>QListBox::numCols () const
</h3>
<b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
<p>
Returns the number of columns.
<p>See also <a href="#numColumns-prop">numColumns</a>.
<h3 class=fn>int <a name="numColumns"></a>QListBox::numColumns () const
</h3><p>Returns the number of columns in the list box.
See the <a href="qlistbox.html#numColumns-prop">"numColumns"</a> property for details.
<h3 class=fn>int <a name="numItemsVisible"></a>QListBox::numItemsVisible () const
</h3><p>Returns the number of visible items.
See the <a href="qlistbox.html#numItemsVisible-prop">"numItemsVisible"</a> property for details.
<h3 class=fn>int <a name="numRows"></a>QListBox::numRows () const
</h3><p>Returns the number of rows in the list box.
See the <a href="qlistbox.html#numRows-prop">"numRows"</a> property for details.
<h3 class=fn>void <a name="onItem"></a>QListBox::onItem ( <a href="qlistboxitem.html">QListBoxItem</a> * i )<tt> [signal]</tt>
</h3>
<p> This signal is emitted when the user moves the mouse cursor onto
an item, similar to the <a href="qwidget.html#enterEvent">QWidget::enterEvent</a>() function. <em>i</em> is
the <a href="qlistboxitem.html">QListBoxItem</a> that the mouse has moved on.
<h3 class=fn>void <a name="onViewport"></a>QListBox::onViewport ()<tt> [signal]</tt>
</h3>
<p> This signal is emitted when the user moves the mouse cursor from
an item to an empty part of the list box.
<h3 class=fn>void <a name="paintCell"></a>QListBox::paintCell ( <a href="qpainter.html">QPainter</a> * p, int row, int col )<tt> [virtual protected]</tt>
</h3>
Provided for compatibility with the old QListBox. We recommend
using <a href="qlistboxitem.html#paint">QListBoxItem::paint</a>() instead.
<p> Repaints the cell at <em>row</em>, <em>col</em> using painter <em>p</em>.
<h3 class=fn>const <a href="qpixmap.html">QPixmap</a> * <a name="pixmap"></a>QListBox::pixmap ( int index ) const
</h3>
Returns a pointer to the pixmap at position <em>index</em>, or 0 if
there is no pixmap there.
<p> <p>See also <a href="#text">text</a>().
<h3 class=fn>void <a name="pressed"></a>QListBox::pressed ( <a href="qlistboxitem.html">QListBoxItem</a> * item )<tt> [signal]</tt>
</h3>
<p> This signal is emitted when the user presses any mouse button. If
<em>item</em> is not 0, the cursor is on <em>item</em>. If <em>item</em> is 0, the
mouse cursor isn't on any item.
<p> Note that you must not delete any <a href="qlistboxitem.html">QListBoxItem</a> objects in slots
connected to this signal.
<h3 class=fn>void <a name="pressed-2"></a>QListBox::pressed ( <a href="qlistboxitem.html">QListBoxItem</a> * item, const <a href="qpoint.html">QPoint</a> & pnt )<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 the user presses any mouse button. If
<em>item</em> is not 0, the cursor is on <em>item</em>. If <em>item</em> is 0, the
mouse cursor isn't on any item.
<p> <em>pnt</em> is the position of the mouse cursor in the global
coordinate system (<a href="qmouseevent.html#globalPos">QMouseEvent::globalPos</a>()).
<p> Note that you must not delete any <a href="qlistboxitem.html">QListBoxItem</a> objects in slots
connected to this signal.
<p> <p>See also <a href="#mouseButtonPressed">mouseButtonPressed</a>(), <a href="#rightButtonPressed">rightButtonPressed</a>(), and <a href="#clicked">clicked</a>().
<h3 class=fn>void <a name="removeItem"></a>QListBox::removeItem ( int index )
</h3>
Removes and deletes the item at position <em>index</em>. If <em>index</em> is
equal to <a href="#currentItem">currentItem</a>(), a new item becomes current and the
<a href="#currentChanged">currentChanged</a>() and <a href="#highlighted">highlighted</a>() signals are emitted.
<p> <p>See also <a href="#insertItem">insertItem</a>() and <a href="#clear">clear</a>().
<h3 class=fn>void <a name="returnPressed"></a>QListBox::returnPressed ( <a href="qlistboxitem.html">QListBoxItem</a> * )<tt> [signal]</tt>
</h3>
<p> This signal is emitted when Enter or Return is pressed. The
argument is <a href="#currentItem">currentItem</a>().
<h3 class=fn>void <a name="rightButtonClicked"></a>QListBox::rightButtonClicked ( <a href="qlistboxitem.html">QListBoxItem</a> *, const <a href="qpoint.html">QPoint</a> & )<tt> [signal]</tt>
</h3>
<p> 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 <a href="qlistboxitem.html">QListBoxItem</a> (may be 0) and the point
in global coordinates.
<h3 class=fn>void <a name="rightButtonPressed"></a>QListBox::rightButtonPressed ( <a href="qlistboxitem.html">QListBoxItem</a> *, const <a href="qpoint.html">QPoint</a> & )<tt> [signal]</tt>
</h3>
<p> This signal is emitted when the right button is pressed. The
arguments are the relevant <a href="qlistboxitem.html">QListBoxItem</a> (may be 0) and the point
in global coordinates.
<h3 class=fn><a href="qlistbox.html#LayoutMode-enum">LayoutMode</a> <a name="rowMode"></a>QListBox::rowMode () const
</h3><p>Returns the row layout mode for this list box.
See the <a href="qlistbox.html#rowMode-prop">"rowMode"</a> property for details.
<h3 class=fn>bool <a name="scrollBar"></a>QListBox::scrollBar () const
</h3>
<p> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
<p> Returns FALSE if <a href="qscrollview.html#vScrollBarMode">vScrollBarMode</a>() is <a href="qscrollview.html#ScrollBarMode-enum">AlwaysOff</a>; otherwise
returns TRUE.
<h3 class=fn>void <a name="selectAll"></a>QListBox::selectAll ( bool select )<tt> [virtual slot]</tt>
</h3>
In <a href="#SelectionMode-enum">Multi</a> and <a href="#SelectionMode-enum">Extended</a> modes, this function sets all items to
be selected if <em>select</em> is TRUE, and to be unselected if <em>select</em> is FALSE.
<p> In <a href="#SelectionMode-enum">Single</a> and <a href="#SelectionMode-enum">NoSelection</a> modes, this function only changes
the selection status of <a href="#currentItem">currentItem</a>().
<h3 class=fn>void <a name="selected"></a>QListBox::selected ( int index )<tt> [signal]</tt>
</h3>
<p> This signal is emitted when the user double-clicks on an item or
presses Enter on the current item. <em>index</em> is the index of the
selected item.
<p> <p>See also <a href="#currentChanged">currentChanged</a>(), <a href="#highlighted">highlighted</a>(), and <a href="#selectionChanged">selectionChanged</a>().
<h3 class=fn>void <a name="selected-2"></a>QListBox::selected ( const <a href="qstring.html">QString</a> & )<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 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.
<p> <p>See also <a href="#currentChanged">currentChanged</a>(), <a href="#highlighted">highlighted</a>(), and <a href="#selectionChanged">selectionChanged</a>().
<h3 class=fn>void <a name="selected-3"></a>QListBox::selected ( <a href="qlistboxitem.html">QListBoxItem</a> * )<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 the user double-clicks on an item or
presses Enter on the current item. The argument is a pointer to
the new selected item.
<p> <p>See also <a href="#currentChanged">currentChanged</a>(), <a href="#highlighted">highlighted</a>(), and <a href="#selectionChanged">selectionChanged</a>().
<h3 class=fn><a href="qlistboxitem.html">QListBoxItem</a> * <a name="selectedItem"></a>QListBox::selectedItem () const
</h3> Returns the selected item if the list box is in
single-selection mode and an item is selected.
<p> If no items are selected or the list box is in another selection mode
this function returns 0.
<p> <p>See also <a href="#setSelected">setSelected</a>() and <a href="#multiSelection-prop">multiSelection</a>.
<h3 class=fn>void <a name="selectionChanged"></a>QListBox::selectionChanged ()<tt> [signal]</tt>
</h3>
<p> 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 <a href="#selectionChanged">selectionChanged</a>() signal so the signal can be connected
to computationally expensive slots.
<p> <p>See also <a href="#selected">selected</a>() and <a href="#currentItem-prop">currentItem</a>.
<h3 class=fn>void <a name="selectionChanged-2"></a>QListBox::selectionChanged ( <a href="qlistboxitem.html">QListBoxItem</a> * item )<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 the selection in a <a href="#SelectionMode-enum">Single</a> selection
list box changes. <em>item</em> is the newly selected list box item.
<p> <p>See also <a href="#selected">selected</a>() and <a href="#currentItem-prop">currentItem</a>.
<h3 class=fn><a href="qlistbox.html#SelectionMode-enum">SelectionMode</a> <a name="selectionMode"></a>QListBox::selectionMode () const
</h3><p>Returns the selection mode of the list box.
See the <a href="qlistbox.html#selectionMode-prop">"selectionMode"</a> property for details.
<h3 class=fn>void <a name="setAutoBottomScrollBar"></a>QListBox::setAutoBottomScrollBar ( bool enable )
</h3>
<p> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
<p> If <em>enable</em> is TRUE sets <a href="qscrollview.html#setHScrollBarMode">setHScrollBarMode</a>() to <a href="qscrollview.html#ScrollBarMode-enum">AlwaysOn</a>;
otherwise sets setHScrollBarMode() to <a href="qscrollview.html#ScrollBarMode-enum">AlwaysOff</a>.
<h3 class=fn>void <a name="setAutoScrollBar"></a>QListBox::setAutoScrollBar ( bool enable )
</h3>
<p> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
<p> If <em>enable</em> is TRUE sets <a href="qscrollview.html#setVScrollBarMode">setVScrollBarMode</a>() to <a href="qscrollview.html#ScrollBarMode-enum">AlwaysOn</a>;
otherwise sets setVScrollBarMode() to <a href="qscrollview.html#ScrollBarMode-enum">AlwaysOff</a>.
<h3 class=fn>void <a name="setBottomItem"></a>QListBox::setBottomItem ( int index )<tt> [virtual]</tt>
</h3>
Scrolls the list box so the item at position <em>index</em> in the list
is displayed in the bottom row of the list box.
<p> <p>See also <a href="#topItem-prop">topItem</a>.
<h3 class=fn>void <a name="setBottomScrollBar"></a>QListBox::setBottomScrollBar ( bool enable )
</h3>
<p> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
<p> If <em>enable</em> is TRUE sets <a href="qscrollview.html#setHScrollBarMode">setHScrollBarMode</a>() to <a href="qscrollview.html#ScrollBarMode-enum">AlwaysOn</a>;
otherwise sets setHScrollBarMode() to <a href="qscrollview.html#ScrollBarMode-enum">AlwaysOff</a>.
<h3 class=fn>void <a name="setColumnMode"></a>QListBox::setColumnMode ( <a href="qlistbox.html#LayoutMode-enum">LayoutMode</a> )<tt> [virtual]</tt>
</h3><p>Sets the column layout mode for this list box.
See the <a href="qlistbox.html#columnMode-prop">"columnMode"</a> property for details.
<h3 class=fn>void <a name="setColumnMode-2"></a>QListBox::setColumnMode ( int )<tt> [virtual]</tt>
</h3><p>Sets the column layout mode for this list box.
See the <a href="qlistbox.html#columnMode-prop">"columnMode"</a> property for details.
<h3 class=fn>void <a name="setCurrentItem"></a>QListBox::setCurrentItem ( int index )<tt> [virtual]</tt>
</h3><p>Sets the current highlighted item to <em>index</em>.
See the <a href="qlistbox.html#currentItem-prop">"currentItem"</a> property for details.
<h3 class=fn>void <a name="setCurrentItem-2"></a>QListBox::setCurrentItem ( <a href="qlistboxitem.html">QListBoxItem</a> * i )<tt> [virtual]</tt>
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Sets the current item to the <a href="qlistboxitem.html">QListBoxItem</a> <em>i</em>.
<h3 class=fn>void <a name="setMultiSelection"></a>QListBox::setMultiSelection ( bool multi )
</h3><p>Sets whether or not the list box is in Multi selection mode to <em>multi</em>.
See the <a href="qlistbox.html#multiSelection-prop">"multiSelection"</a> property for details.
<h3 class=fn>void <a name="setRowMode"></a>QListBox::setRowMode ( <a href="qlistbox.html#LayoutMode-enum">LayoutMode</a> )<tt> [virtual]</tt>
</h3><p>Sets the row layout mode for this list box.
See the <a href="qlistbox.html#rowMode-prop">"rowMode"</a> property for details.
<h3 class=fn>void <a name="setRowMode-2"></a>QListBox::setRowMode ( int )<tt> [virtual]</tt>
</h3><p>Sets the row layout mode for this list box.
See the <a href="qlistbox.html#rowMode-prop">"rowMode"</a> property for details.
<h3 class=fn>void <a name="setScrollBar"></a>QListBox::setScrollBar ( bool enable )
</h3>
<p> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
<p> If <em>enable</em> is TRUE sets <a href="qscrollview.html#setVScrollBarMode">setVScrollBarMode</a>() to <a href="qscrollview.html#ScrollBarMode-enum">AlwaysOn</a>;
otherwise sets setVScrollBarMode() to <a href="qscrollview.html#ScrollBarMode-enum">AlwaysOff</a>.
<h3 class=fn>void <a name="setSelected"></a>QListBox::setSelected ( <a href="qlistboxitem.html">QListBoxItem</a> * item, bool select )<tt> [virtual]</tt>
</h3>
Selects <em>item</em> if <em>select</em> is TRUE or unselects it if <em>select</em>
is FALSE, and repaints the item appropriately.
<p> If the list box is a <a href="#SelectionMode-enum">Single</a> selection list box and <em>select</em> is
TRUE, <a href="#setSelected">setSelected</a>() calls <a href="#setCurrentItem">setCurrentItem</a>().
<p> If the list box is a <a href="#SelectionMode-enum">Single</a> selection list box, <em>select</em> is
FALSE, setSelected() calls <a href="#clearSelection">clearSelection</a>().
<p> <p>See also <a href="#multiSelection-prop">multiSelection</a>, <a href="#currentItem-prop">currentItem</a>, <a href="#clearSelection">clearSelection</a>(), and <a href="#currentItem-prop">currentItem</a>.
<h3 class=fn>void <a name="setSelected-2"></a>QListBox::setSelected ( int index, bool select )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> If <em>select</em> is TRUE the item at position <em>index</em> is selected;
otherwise the item is deselected.
<h3 class=fn>void <a name="setSelectionMode"></a>QListBox::setSelectionMode ( <a href="qlistbox.html#SelectionMode-enum">SelectionMode</a> )<tt> [virtual]</tt>
</h3><p>Sets the selection mode of the list box.
See the <a href="qlistbox.html#selectionMode-prop">"selectionMode"</a> property for details.
<h3 class=fn>void <a name="setTopItem"></a>QListBox::setTopItem ( int index )<tt> [virtual]</tt>
</h3><p>Sets the index of an item at the top of the screen to <em>index</em>.
See the <a href="qlistbox.html#topItem-prop">"topItem"</a> property for details.
<h3 class=fn>void <a name="setVariableHeight"></a>QListBox::setVariableHeight ( bool )<tt> [virtual]</tt>
</h3><p>Sets whether this list box has variable-height rows.
See the <a href="qlistbox.html#variableHeight-prop">"variableHeight"</a> property for details.
<h3 class=fn>void <a name="setVariableWidth"></a>QListBox::setVariableWidth ( bool )<tt> [virtual]</tt>
</h3><p>Sets whether this list box has variable-width columns.
See the <a href="qlistbox.html#variableWidth-prop">"variableWidth"</a> property for details.
<h3 class=fn>void <a name="sort"></a>QListBox::sort ( bool ascending = TRUE )
</h3>
If <em>ascending</em> is TRUE sorts the items in ascending order;
otherwise sorts in descending order.
<p> To compare the items, the text (<a href="qlistboxitem.html#text">QListBoxItem::text</a>()) of the items
is used.
<p>Example: <a href="listbox-example.html#x1437">listbox/listbox.cpp</a>.
<h3 class=fn>void <a name="takeItem"></a>QListBox::takeItem ( const <a href="qlistboxitem.html">QListBoxItem</a> * item )
</h3>
Removes <em>item</em> 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 <a href="qlistboxitem.html#~QListBoxItem">QListBoxItem::~QListBoxItem</a>()
calls it. The normal way to delete an item is with <tt>delete</tt>.
<p> <p>See also <a href="#insertItem">QListBox::insertItem</a>().
<h3 class=fn><a href="qstring.html">QString</a> <a name="text"></a>QListBox::text ( int index ) const
</h3>
Returns the text at position <em>index</em>, or <a href="qstring.html#QString-null">QString::null</a> if there
is no text at that position.
<p> <p>See also <a href="#pixmap">pixmap</a>().
<h3 class=fn>void <a name="toggleCurrentItem"></a>QListBox::toggleCurrentItem ()<tt> [protected]</tt>
</h3>
Toggles the selection status of <a href="#currentItem">currentItem</a>() and repaints if the
list box is a <a href="#SelectionMode-enum">Multi</a> selection list box.
<p> <p>See also <a href="#multiSelection-prop">multiSelection</a>.
<h3 class=fn>int <a name="topItem"></a>QListBox::topItem () const
</h3><p>Returns the index of an item at the top of the screen.
See the <a href="qlistbox.html#topItem-prop">"topItem"</a> property for details.
<h3 class=fn>int <a name="totalHeight"></a>QListBox::totalHeight () const<tt> [protected]</tt>
</h3>
<b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
<p>
Returns <a href="qscrollview.html#contentsHeight">contentsHeight</a>().
<h3 class=fn>int <a name="totalWidth"></a>QListBox::totalWidth () const<tt> [protected]</tt>
</h3>
<b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
<p>
Returns <a href="qscrollview.html#contentsWidth">contentsWidth</a>().
<h3 class=fn>void <a name="triggerUpdate"></a>QListBox::triggerUpdate ( bool doLayout )
</h3>
Ensures that a single paint event will occur at the end of the
current event loop iteration. If <em>doLayout</em> is TRUE, the layout
is also redone.
<h3 class=fn>void <a name="updateItem"></a>QListBox::updateItem ( int index )<tt> [protected]</tt>
</h3>
Repaints the item at position <em>index</em> in the list.
<h3 class=fn>void <a name="updateItem-2"></a>QListBox::updateItem ( <a href="qlistboxitem.html">QListBoxItem</a> * i )<tt> [protected]</tt>
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Repaints the <a href="qlistboxitem.html">QListBoxItem</a> <em>i</em>.
<h3 class=fn>bool <a name="variableHeight"></a>QListBox::variableHeight () const
</h3><p>Returns TRUE if this list box has variable-height rows; otherwise returns FALSE.
See the <a href="qlistbox.html#variableHeight-prop">"variableHeight"</a> property for details.
<h3 class=fn>bool <a name="variableWidth"></a>QListBox::variableWidth () const
</h3><p>Returns TRUE if this list box has variable-width columns; otherwise returns FALSE.
See the <a href="qlistbox.html#variableWidth-prop">"variableWidth"</a> property for details.
<hr><h2>Property Documentation</h2>
<h3 class=fn><a href="qlistbox.html#LayoutMode-enum">LayoutMode</a> <a name="columnMode-prop"></a>columnMode</h3>
<p>This property holds the column layout mode for this list box.
<p>setColumnMode() sets the layout mode and adjusts the number of
displayed columns. The row layout mode automatically becomes <a href="#LayoutMode-enum">Variable</a>, unless the column mode is <a href="#LayoutMode-enum">Variable</a>.
<p> <p>See also <a href="#rowMode-prop">rowMode</a>, <a href="#rowMode-prop">rowMode</a>, and <a href="#numColumns-prop">numColumns</a>.
<p>Set this property's value with <a href="#setColumnMode">setColumnMode</a>() and get this property's value with <a href="#columnMode">columnMode</a>().
<h3 class=fn>uint <a name="count-prop"></a>count</h3>
<p>This property holds the number of items in the list box.
<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 current highlighted item.
<p>When setting this property, the highlighting is moved to the item
and the list box scrolled as necessary.
<p> If no item is current, <a href="#currentItem">currentItem</a>() returns -1.
<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="qstring.html">QString</a> <a name="currentText-prop"></a>currentText</h3>
<p>This property holds the text of the current item.
<p>This is equivalent to <a href="#text">text</a>(currentItem()).
<p>Get this property's value with <a href="#currentText">currentText</a>().
<h3 class=fn>bool <a name="multiSelection-prop"></a>multiSelection</h3>
<b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
<p> <p>This property holds whether or not the list box is in Multi selection mode.
<p>Consider using the <a href="#selectionMode-prop">QListBox::selectionMode</a> property instead of
this property.
<p> When setting this property, Multi selection mode is used if set to TRUE and
to Single selection mode if set to FALSE.
<p> 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.
<p> <p>See also <a href="#selectionMode-prop">selectionMode</a>.
<p>Set this property's value with <a href="#setMultiSelection">setMultiSelection</a>() and get this property's value with <a href="#isMultiSelection">isMultiSelection</a>().
<h3 class=fn>int <a name="numColumns-prop"></a>numColumns</h3>
<p>This property holds the number of columns in the list box.
<p>This is normally 1, but can be different if <a href="#columnMode-prop">QListBox::columnMode</a> or <a href="#rowMode-prop">QListBox::rowMode</a> has been set.
<p> <p>See also <a href="#columnMode-prop">columnMode</a>, <a href="#rowMode-prop">rowMode</a>, and <a href="#numRows-prop">numRows</a>.
<p>Get this property's value with <a href="#numColumns">numColumns</a>().
<h3 class=fn>int <a name="numItemsVisible-prop"></a>numItemsVisible</h3>
<p>This property holds the number of visible items.
<p>Both partially and entirely visible items are counted.
<p>Get this property's value with <a href="#numItemsVisible">numItemsVisible</a>().
<h3 class=fn>int <a name="numRows-prop"></a>numRows</h3>
<p>This property holds the number of rows in the list box.
<p>This is equal to the number of items in the default single-column
layout, but can be different.
<p> <p>See also <a href="#columnMode-prop">columnMode</a>, <a href="#rowMode-prop">rowMode</a>, and <a href="#numColumns-prop">numColumns</a>.
<p>Get this property's value with <a href="#numRows">numRows</a>().
<h3 class=fn><a href="qlistbox.html#LayoutMode-enum">LayoutMode</a> <a name="rowMode-prop"></a>rowMode</h3>
<p>This property holds the row layout mode for this list box.
<p>This property is normally <a href="#LayoutMode-enum">Variable</a>.
<p> <a href="#setRowMode">setRowMode</a>() sets the layout mode and adjusts the number of
displayed rows. The column layout mode automatically becomes <a href="#LayoutMode-enum">Variable</a>, unless the row mode is <a href="#LayoutMode-enum">Variable</a>.
<p> <p>See also <a href="#columnMode-prop">columnMode</a>.
<p>Set this property's value with <a href="#setRowMode">setRowMode</a>() and get this property's value with <a href="#rowMode">rowMode</a>().
<h3 class=fn><a href="qlistbox.html#SelectionMode-enum">SelectionMode</a> <a name="selectionMode-prop"></a>selectionMode</h3>
<p>This property holds the selection mode of the list box.
<p>Sets the list box's selection mode, which may be one of <a href="#SelectionMode-enum">Single</a>
(the default), <a href="#SelectionMode-enum">Extended</a>, <a href="#SelectionMode-enum">Multi</a> or <a href="#SelectionMode-enum">NoSelection</a>.
<p> <p>See also <a href="#SelectionMode-enum">SelectionMode</a>.
<p>Set this property's value with <a href="#setSelectionMode">setSelectionMode</a>() and get this property's value with <a href="#selectionMode">selectionMode</a>().
<h3 class=fn>int <a name="topItem-prop"></a>topItem</h3>
<p>This property holds the index of an item at the top of the screen.
<p>When getting this property and the listbox has multiple columns,
an arbitrary item is selected and returned.
<p> When setting this property, the list box is scrolled so the item
at position <em>index</em> in the list is displayed in the top row of
the list box.
<p>Set this property's value with <a href="#setTopItem">setTopItem</a>() and get this property's value with <a href="#topItem">topItem</a>().
<h3 class=fn>bool <a name="variableHeight-prop"></a>variableHeight</h3>
<p>This property holds whether this list box has variable-height rows.
<p>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.
<p> <p>See also <a href="#variableWidth-prop">variableWidth</a>.
<p>Set this property's value with <a href="#setVariableHeight">setVariableHeight</a>() and get this property's value with <a href="#variableHeight">variableHeight</a>().
<h3 class=fn>bool <a name="variableWidth-prop"></a>variableWidth</h3>
<p>This property holds whether this list box has variable-width columns.
<p>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.
<p> <p>See also <a href="#variableHeight-prop">variableHeight</a>.
<p>Set this property's value with <a href="#setVariableWidth">setVariableWidth</a>() and get this property's value with <a href="#variableWidth">variableWidth</a>().
<!-- eof -->
<hr><p>
This file is part of the <a href="index.html">Qt toolkit</a>.
Copyright © 1995-2005
<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 © 2005
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
<td align=right><div align=right>Qt 3.3.7</div>
</table></div></address></body>
</html>
|