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
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Qt Toolkit - QListBox Class</title><style type="text/css"><!--
h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }body { background: white; color: black; }
--></style>
</head><body bgcolor="#ffffff">
<table width="100%">
<tr><td><a href="index.html">
<img width="100" height="100" src="qtlogo.png"
alt="Home" border="0"><img width="100"
height="100" src="face.png" alt="Home" border="0">
</a><td valign=top><div align=right><img src="dochead.png" width="472" height="27"><br>
<a href="classes.html"><b>Classes</b></a>
-<a href="annotated.html">Annotated</a>
- <a href="hierarchy.html">Tree</a>
-<a href="functions.html">Functions</a>
-<a href="index.html">Home</a>
-<a href="topicals.html"><b>Structure</b></a>
</div>
</table>
<h1 align=center>QListBox Class Reference</h1><br clear="all">
<p>
The QListBox widget provides a list of selectable, read-only items.
<a href="#details">More...</a>
<p>
<code>#include <<a href="qlistbox-h.html">qlistbox.h</a>></code>
<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><div class="fn"><a href="#c32990"><b>QListBox</b></a>(QWidget*parent=0, constchar*name=0, WFlagsf=0)</div>
<li><div class="fn"><a href="#9cca65"><b>~QListBox</b></a>()</div>
<li><div class="fn">uint<a href="#8cfea9"><b>count</b></a>()const</div>
<li><div class="fn">void<a href="#fb74ef"><b>insertStringList</b></a>(constQStringList&, intindex=-1)</div>
<li><div class="fn">void<a href="#016e24"><b>insertStrList</b></a>(constQStrList*, intindex=-1)</div>
<li><div class="fn">void<a href="#ee9742"><b>insertStrList</b></a>(constQStrList&, intindex=-1)</div>
<li><div class="fn">void<a href="#b6f3f6"><b>insertStrList</b></a>(constchar**, intnumStrings=-1, intindex=-1)</div>
<li><div class="fn">void<a href="#04a671"><b>insertItem</b></a>(constQListBoxItem*, intindex=-1)</div>
<li><div class="fn">void<a href="#de7b60"><b>insertItem</b></a>(constQListBoxItem*, constQListBoxItem*after)</div>
<li><div class="fn">void<a href="#ca96cf"><b>insertItem</b></a>(constQString&text, intindex=-1)</div>
<li><div class="fn">void<a href="#a01753"><b>insertItem</b></a>(constQPixmap&pixmap, intindex=-1)</div>
<li><div class="fn">void<a href="#ed30cb"><b>insertItem</b></a>(constQPixmap&pixmap, constQString&text, intindex=-1)</div>
<li><div class="fn">void<a href="#bc0ee5"><b>removeItem</b></a>(intindex)</div>
<li><div class="fn">void<a href="#fd65eb"><b>clear</b></a>()</div>
<li><div class="fn">QString<a href="#7635d3"><b>text</b></a>(intindex)const</div>
<li><div class="fn">constQPixmap*<a href="#03c43b"><b>pixmap</b></a>(intindex)const</div>
<li><div class="fn">void<a href="#201531"><b>changeItem</b></a>(constQListBoxItem*, intindex)</div>
<li><div class="fn">void<a href="#1ad6b0"><b>changeItem</b></a>(constQString&text, intindex)</div>
<li><div class="fn">void<a href="#cbe760"><b>changeItem</b></a>(constQPixmap&pixmap, intindex)</div>
<li><div class="fn">void<a href="#5da998"><b>changeItem</b></a>(constQPixmap&pixmap, constQString&text, intindex)</div>
<li><div class="fn">void<a href="#01a6f7"><b>takeItem</b></a>(constQListBoxItem*)</div>
<li><div class="fn">int<a href="#312b76"><b>numItemsVisible</b></a>()const</div>
<li><div class="fn">int<a href="#587403"><b>currentItem</b></a>()const</div>
<li><div class="fn">QString<a href="#7b54ba"><b>currentText</b></a>()const</div>
<li><div class="fn">virtualvoid<a href="#d512e5"><b>setCurrentItem</b></a>(intindex)</div>
<li><div class="fn">virtualvoid<a href="#ea0ee6"><b>setCurrentItem</b></a>(QListBoxItem*)</div>
<li><div class="fn">void<a href="#86437d"><b>centerCurrentItem</b></a>()</div>
<li><div class="fn">int<a href="#7206e2"><b>topItem</b></a>()const</div>
<li><div class="fn">virtualvoid<a href="#794012"><b>setTopItem</b></a>(intindex)</div>
<li><div class="fn">virtualvoid<a href="#1fde29"><b>setBottomItem</b></a>(intindex)</div>
<li><div class="fn">long<a href="#15518e"><b>maxItemWidth</b></a>()const</div>
<li><div class="fn">enum<a href="#SelectionMode"><b>SelectionMode</b></a>{Single, Multi, Extended, NoSelection}</div>
<li><div class="fn">virtualvoid<a href="#b85c6f"><b>setSelectionMode</b></a>(SelectionMode)</div>
<li><div class="fn">SelectionMode<a href="#e1733a"><b>selectionMode</b></a>()const</div>
<li><div class="fn">voidsetMultiSelection(boolmulti)<em>(obsolete)</em></div>
<li><div class="fn">boolisMultiSelection()const<em>(obsolete)</em></div>
<li><div class="fn">virtualvoid<a href="#f0a464"><b>setSelected</b></a>(QListBoxItem*, bool)</div>
<li><div class="fn">void<a href="#6866dd"><b>setSelected</b></a>(int, bool)</div>
<li><div class="fn">bool<a href="#3d9b58"><b>isSelected</b></a>(int)const</div>
<li><div class="fn">bool<a href="#b03380"><b>isSelected</b></a>(constQListBoxItem*)const</div>
<li><div class="fn">QListBoxItem*<a href="#39471d"><b>item</b></a>(intindex)const</div>
<li><div class="fn">int<a href="#7a2787"><b>index</b></a>(constQListBoxItem*)const</div>
<li><div class="fn">QListBoxItem*<a href="#8f6d23"><b>findItem</b></a>(constQString&text)const</div>
<li><div class="fn">void<a href="#fd9471"><b>triggerUpdate</b></a>(booldoLayout)</div>
<li><div class="fn">bool<a href="#77faf7"><b>itemVisible</b></a>(intindex)</div>
<li><div class="fn">bool<a href="#1e4835"><b>itemVisible</b></a>(constQListBoxItem*)</div>
<li><div class="fn">enum<a href="#LayoutMode"><b>LayoutMode</b></a>{FixedNumber, FitToWidth, FitToHeight=FitToWidth, Variable}</div>
<li><div class="fn">virtualvoid<a href="#61bd50"><b>setColumnMode</b></a>(LayoutMode)</div>
<li><div class="fn">virtualvoid<a href="#80cd79"><b>setColumnMode</b></a>(int)</div>
<li><div class="fn">virtualvoid<a href="#585a8f"><b>setRowMode</b></a>(LayoutMode)</div>
<li><div class="fn">virtualvoid<a href="#c7eb32"><b>setRowMode</b></a>(int)</div>
<li><div class="fn">LayoutMode<a href="#87b3ec"><b>columnMode</b></a>()const</div>
<li><div class="fn">LayoutMode<a href="#a0b2e2"><b>rowMode</b></a>()const</div>
<li><div class="fn">int<a href="#bfca10"><b>numColumns</b></a>()const</div>
<li><div class="fn">int<a href="#ece487"><b>numRows</b></a>()const</div>
<li><div class="fn">bool<a href="#ffc6fe"><b>variableWidth</b></a>()const</div>
<li><div class="fn">virtualvoid<a href="#b52a7d"><b>setVariableWidth</b></a>(bool)</div>
<li><div class="fn">bool<a href="#e915ee"><b>variableHeight</b></a>()const</div>
<li><div class="fn">virtualvoid<a href="#4e368d"><b>setVariableHeight</b></a>(bool)</div>
<li><div class="fn">int<a href="#7ad0db"><b>itemHeight</b></a>(intindex=0)const</div>
<li><div class="fn">QListBoxItem*<a href="#dccc4b"><b>itemAt</b></a>(QPoint)const</div>
<li><div class="fn">QRect<a href="#97bba3"><b>itemRect</b></a>(QListBoxItem*item)const</div>
<li><div class="fn">QListBoxItem*<a href="#8a6fa8"><b>firstItem</b></a>()const</div>
<li><div class="fn">void<a href="#562755"><b>sort</b></a>(boolascending=TRUE)</div>
</ul>
<h2>Public Slots</h2>
<ul>
<li><div class="fn">virtualvoid<a href="#ffbf4f"><b>ensureCurrentVisible</b></a>()</div>
<li><div class="fn">virtualvoid<a href="#0c5d7d"><b>clearSelection</b></a>()</div>
<li><div class="fn">void<a href="#820b7c"><b>selectAll</b></a>(boolselect)</div>
<li><div class="fn">void<a href="#2fd437"><b>invertSelection</b></a>()</div>
</ul>
<h2>Signals</h2>
<ul>
<li><div class="fn">void<a href="#b0b83f"><b>highlighted</b></a>(intindex)</div>
<li><div class="fn">void<a href="#f36628"><b>selected</b></a>(intindex)</div>
<li><div class="fn">void<a href="#d8bf0a"><b>highlighted</b></a>(constQString&)</div>
<li><div class="fn">void<a href="#5a948b"><b>selected</b></a>(constQString&)</div>
<li><div class="fn">void<a href="#cf2365"><b>highlighted</b></a>(QListBoxItem*)</div>
<li><div class="fn">void<a href="#9b0640"><b>selected</b></a>(QListBoxItem*)</div>
<li><div class="fn">void<a href="#2fece7"><b>selectionChanged</b></a>()</div>
<li><div class="fn">void<a href="#a61084"><b>selectionChanged</b></a>(QListBoxItem*)</div>
<li><div class="fn">void<a href="#1393e7"><b>currentChanged</b></a>(QListBoxItem*)</div>
<li><div class="fn">void<a href="#4194b5"><b>clicked</b></a>(QListBoxItem*)</div>
<li><div class="fn">void<a href="#16874d"><b>clicked</b></a>(QListBoxItem*, constQPoint&)</div>
<li><div class="fn">void<a href="#181638"><b>pressed</b></a>(QListBoxItem*)</div>
<li><div class="fn">void<a href="#6abeb9"><b>pressed</b></a>(QListBoxItem*, constQPoint&)</div>
<li><div class="fn">void<a href="#2045a0"><b>doubleClicked</b></a>(QListBoxItem*)</div>
<li><div class="fn">void<a href="#45c9fa"><b>returnPressed</b></a>(QListBoxItem*)</div>
<li><div class="fn">void<a href="#b7398a"><b>rightButtonClicked</b></a>(QListBoxItem*, constQPoint&)</div>
<li><div class="fn">void<a href="#406d00"><b>rightButtonPressed</b></a>(QListBoxItem*, constQPoint&)</div>
<li><div class="fn">void<a href="#df4528"><b>mouseButtonPressed</b></a>(int, QListBoxItem*, constQPoint&)</div>
<li><div class="fn">void<a href="#93cf92"><b>mouseButtonClicked</b></a>(int, QListBoxItem*, constQPoint&)</div>
<li><div class="fn">void<a href="#2d55d9"><b>onItem</b></a>(QListBoxItem*item)</div>
<li><div class="fn">void<a href="#16aace"><b>onViewport</b></a>()</div>
</ul>
<h2>Protected Members</h2>
<ul>
<li><div class="fn">void<a href="#b04c89"><b>updateItem</b></a>(intindex)</div>
<li><div class="fn">void<a href="#604614"><b>updateItem</b></a>(QListBoxItem*)</div>
<li><div class="fn">virtualvoid<a href="#06bf5a"><b>paintCell</b></a>(QPainter*, introw, intcol)</div>
<li><div class="fn">void<a href="#1c4ba9"><b>toggleCurrentItem</b></a>()</div>
<li><div class="fn">bool<a href="#22aa71"><b>isRubberSelecting</b></a>()const</div>
<li><div class="fn">void<a href="#9a542a"><b>doLayout</b></a>()const</div>
</ul>
<h2>Protected Slots</h2>
<ul>
<li><div class="fn">void<b>clearInputString</b>()(internal)</div>
</ul>
<h2>Properties</h2>
<table border=1 cellpadding=3 cellspacing=0>
<tr><th>Type<th>Name<th>READ<th>WRITE<th>Options
<tr><td>uint<td>count<td>count<td> <td>
<tr><td>int<td>numItemsVisible<td>numItemsVisible<td> <td>
<tr><td>int<td>currentItem<td>currentItem<td>setCurrentItem<td> DESIGNABLE false
<tr><td>QString<td>currentText<td>currentText<td> <td>
<tr><td>int<td>topItem<td>topItem<td>setTopItem<td> DESIGNABLE false
<tr><td>SelectionMode<td>selectionMode<td>selectionMode<td>setSelectionMode<td>
<tr><td>bool<td>multiSelection<td>isMultiSelection<td>setMultiSelection<td> DESIGNABLE false
<tr><td>LayoutMode<td>columnMode<td>columnMode<td>setColumnMode<td>
<tr><td>LayoutMode<td>rowMode<td>rowMode<td>setRowMode<td>
<tr><td>int<td>numColumns<td>numColumns<td> <td>
<tr><td>int<td>numRows<td>numRows<td> <td>
<tr><td>bool<td>variableWidth<td>variableWidth<td>setVariableWidth<td>
<tr><td>bool<td>variableHeight<td>variableHeight<td>setVariableHeight<td>
</table>
<hr><h2><a name="details"></a>Detailed Description</h2>
The QListBox widget provides a list of selectable, read-only items.
<p>
This is typically a single-column list where zero or one items
are selected at once, but can also be used in many other ways.
<p>QListBox will add scroll bars as necessary, but 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, chiefly because the
scroll bars won't provide very good navigation, but also because
QListBox may become slow at larger sizes.
<p>There is a variety of selection modes, described in the
<a href="#SelectionMode">QListBox::SelectionMode</a> documentation. The default is
single-selection, and you can change it using <a href="#b85c6f">setSelectionMode</a>().
For compatibility with previous Qt versions there is still the
<a href="#e16d4f">setMultiSelection</a>() methode. Calling setMultiSelection( TRUE )
is equivalent to setSelectionMode( Multi ), and setMultiSelection( FALSE )
is equivalent to setSelectionMode( Single ). It's suggested not to
use setMultiSelection() anymore, but to use setSelectionMode()
instead.
<p>Since QListBox offers multiple selection it has to display keyboard
focus and selection state separately. Therefore there are functions
both to set the selection state of an item, <a href="#6866dd">setSelected</a>(), and to
select which item displays keyboard focus, <a href="#ea0ee6">setCurrentItem</a>().
<p>The list box normally arranges its items in a single column with a
vertical scroll bar if necessary, but it is also possible to have a
different fixed number of columns (<a href="#61bd50">setColumnMode</a>()), or as many
columns as will fit in the list box' assigned screen space
(setColumnMode( FitToWidth )), or to have a fixed number of rows
(<a href="#585a8f">setRowMode</a>()), or as many rows as will fit in the list box'
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 is 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="#4e368d">setVariableHeight</a>( FALSE ). Of course there
is a similar <a href="#b52a7d">setVariableWidth</a>().
<p>The items discussed are <a href="qlistboxitem.html">QListBoxItem</a> objects. QListBox provides
methods to insert new items as a string, as pixmaps, and as
QListBoxItem * (<a href="#04a671">insertItem</a>() with various arguments), and to replace
an existing item with a new string, pixmap or QListBoxItem
(<a href="#1ad6b0">changeItem</a>() with various arguments). You can also remove items
(surprise: <a href="#bc0ee5">removeItem</a>()) and <a href="#fd65eb">clear</a>() the entire list box. Note that
if you create a QListBoxItem yourself and insert it, it becomes the
property of QListBox and you may not delete it. (QListBox will
delete it when appropriate.)
<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 listbox.
<p>The list of items can be arbitrarily big; if necessary, QListBox
adds scroll bars. It can be single-column (as most list boxes are)
or multi-column, and offers both single and multiple selection.
(QListBox does however not support multiple-column items; <a href="qlistview.html">QListView</a>
does that job.)
Also a listbox can display items arranged in a tree. But this is
quite limited, and if you really want to display and work with
a tree, you should use a QListView. The tree stuff in the QListBox
is only supported because its needed in comboboxes.
<p>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; most things can be done using the indexes too
but unfortunately not everything.
<p>Each item in a QListBox contains a QListBoxItem. One of the items
can be the current item. The <a href="#b0b83f">highlighted</a>() signal is emitted when
a new item gets highlighted, e.g. because the user clicks on it or
<a href="#ea0ee6">QListBox::setCurrentItem</a>() is called. The <a href="#5a948b">selected</a>() signal is emitted
when the user double-clicks on an item or presses return when an item is
highlighted.
<p>If the user does not select anything, no signals are emitted and
<a href="#587403">currentItem</a>() returns -1.
<p>A list box has <code>WheelFocus</code> as a default <a href="qwidget.html#3d478d">focusPolicy</a>(), i.e. it can
get keyboard focus both by tabbing, clicking and the mouse wheel.
<p>New items may be inserted using either insertItem(), <a href="#016e24">insertStrList</a>()
or <a href="#fb74ef">insertStringList</a>(). <a href="#238d6c">inSort</a>() is obsolete, as this method is quite
inefficient. It's preferable to insert the items normally and call
<a href="#562755">sort</a>() afterwards, or 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#aaf795">setHScrollBarMode</a>() and <a href="qscrollview.html#817b47">setVScrollBarMode</a>()
can be used to change this policy.
<p>If you need to insert other types than texts and pixmaps, you must
define new classes which inherit QListBoxItem.<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>See also <a href="qlistview.html">QListView</a>, <a href="qcombobox.html">QComboBox</a>, <a href="qbuttongroup.html">QButtonGroup</a> and <a href="guibooks.html#fowler">GUI Design Handbook: List Box (two sections)</a>
<hr><h2>Member Type Documentation</h2>
<h3 class="fn"><a name="LayoutMode">QListBox::LayoutMode</a></h3>
This enum type decides how QListBox lays out its rows and columns.
The two modes interact, of course.
<p>The possible values for each mode are: <ul>
<li> <code>FixedNumber</code> - there is a fixed number of rows (or columns).
<li> <code>FitToHeight</code> - there are as many rows as will fit on-screen.
(Ditto with <code>FitToWidth</code> and columns.)
<li> <code>Variable</code> - there are as many rows as are required by the
column mode. (Or as many columns as required by the row mode.)
<p></ul>
<p>Example: When you call <a href="#585a8f">setRowMode</a>( FitToHeight ), <a href="#87b3ec">columnMode</a>()
automatically becomes <code>Variable</code> to accomodate the row mode you've
set.
<h3 class="fn"><a name="SelectionMode">QListBox::SelectionMode</a></h3>
This enumerated type is used by QListBox to indicate how it reacts
to selection by the user. It has four values: <ul>
<li> <code>Single</code> - 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="#0c5d7d">QListBox::clearSelection</a>().
<li> <code>Multi</code> - When the user selects an item in the most ordinary
way, the selection status of that item is toggled and the other
items are left alone.
<li> <code>Extended</code> - When the user selects an item in the most
ordinary way, 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 stayes pressed.
<li> <code>NoSelection</code> - Items cannot be selected.
<p></ul>
<p>In other words, <code>Single</code> is a real single-selection list box, <code>Multi</code> a real multi-selection list box, and <code>Extended</code> list box
where users can select multiple items but usually want to select
either just one or a range of contiguous items, and <code>NoSelection</code>
is for a list box where the user can look but not touch.
<hr><h2>Member Function Documentation</h2>
<h3 class="fn"><a name="c32990"></a>QListBox::QListBox(<a href="qwidget.html">QWidget</a>*parent=0, constchar*name=0, WFlagsf=0)</h3>
<p>Constructs a new empty list box, with <em>parent</em> as a parent and <em>name</em>
as object name.
<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 <code>WNorthWestGravity</code> and
<code>WRepaintNoErase</code> should be cleared.
<p>See also <a href="qwidget.html#ef7827">QWidget::clearWFlags</a>() and <a href="qt.html#WidgetFlags">Qt::WidgetFlags</a>.
<h3 class="fn"><a name="9cca65"></a>QListBox::~QListBox()</h3>
<p>Destroys the list box. Deletes all list box items.
<h3 class="fn">void<a name="86437d"></a>QListBox::centerCurrentItem()</h3>
<p>If there is a current item, the listbox is scrolled,
so that this item is displayed centered.
<p>See also <a href="#ffbf4f">QListBox::ensureCurrentVisible</a>().
<h3 class="fn">void<a name="201531"></a>QListBox::changeItem(const<a href="qlistboxitem.html">QListBoxItem</a>*lbi, intindex)</h3>
<p>Replaces the item at position <em>index</em> with <em>lbi.</em> If <em>index</em> is negative or too large, <a href="#1ad6b0">changeItem</a>() does nothing.
<p>See also <a href="#04a671">insertItem</a>() and <a href="#bc0ee5">removeItem</a>().
<h3 class="fn">void<a name="5da998"></a>QListBox::changeItem(const<a href="qpixmap.html">QPixmap</a>&pixmap, const<a href="qstring.html">QString</a>&text, intindex)</h3>
<p>Replaces the item at position <em>index</em> with <em>pixmap</em> and <em>text.</em>
<p>The operation is ignored if <em>index</em> is out of range.
<p>See also <a href="#04a671">insertItem</a>() and <a href="#bc0ee5">removeItem</a>().
<h3 class="fn">void<a name="cbe760"></a>QListBox::changeItem(const<a href="qpixmap.html">QPixmap</a>&pixmap, intindex)</h3>
<p>Replaces the item at position <em>index</em> with <em>pixmap.</em>
<p>The operation is ignored if <em>index</em> is out of range.
<p>See also <a href="#04a671">insertItem</a>() and <a href="#bc0ee5">removeItem</a>().
<h3 class="fn">void<a name="1ad6b0"></a>QListBox::changeItem(const<a href="qstring.html">QString</a>&text, intindex)</h3>
<p>Replaces the item at position <em>index</em> with <em>text.</em>
<p>The operation is ignored if <em>index</em> is out of range.
<p>See also <a href="#04a671">insertItem</a>() and <a href="#bc0ee5">removeItem</a>().
<h3 class="fn">void<a name="fd65eb"></a>QListBox::clear()</h3>
<p>Deletes all items in the list.
<p>See also <a href="#bc0ee5">removeItem</a>().
<h3 class="fn">void<a name="0c5d7d"></a>QListBox::clearSelection() <code>[virtualslot]</code></h3>
<p>Deselects all items, if possible.
<p>Note that a single-selection listbox will automatically select an
item if it has keyboard focus.
<h3 class="fn">void<a name="4194b5"></a>QListBox::clicked(<a href="qlistboxitem.html">QListBoxItem</a>*item) <code>[signal]</code></h3>
<p>This signal is emitted whenever the user clicks (mouse pressed + mouse released)
into the listbox.
<em>item</em> is the pointer to the clicked listbox item or NULL, if the user didn't click on an item.
<p>Note that you may not delete any <a href="qlistboxitem.html">QListBoxItem</a> objects in slots
connected to this signal.
<h3 class="fn">void<a name="16874d"></a>QListBox::clicked(<a href="qlistboxitem.html">QListBoxItem</a>*item, const<a href="qpoint.html">QPoint</a>&pnt) <code>[signal]</code></h3>
<p>This signal is emitted whenever the user clicks (mouse pressed + mouse released)
into the listbox.
<em>item</em> is the pointer to the clicked listbox item or NULL, if the user didn't click on an item.
<em>pnt</em> is the position where the user has clicked.
<p>Note that you may not delete any <a href="qlistboxitem.html">QListBoxItem</a> objects in slots
connected to this signal.
<h3 class="fn">QListBox::LayoutMode<a name="87b3ec"></a>QListBox::columnMode()const</h3>
<p>Returns the column layout mode for this list box. This is
normally <code>FixedNumber,</code> but can be changed by calling <a href="#61bd50">setColumnMode</a>()
<p>See also <a href="#a0b2e2">rowMode</a>(), <a href="#61bd50">setColumnMode</a>() and <a href="#bfca10">numColumns</a>().
<h3 class="fn">uint<a name="8cfea9"></a>QListBox::count()const</h3>
<p>Returns the number of items in the list box.
<h3 class="fn">void<a name="1393e7"></a>QListBox::currentChanged(<a href="qlistboxitem.html">QListBoxItem</a>*item) <code>[signal]</code></h3>
<p>This signal is emitted when the user highlights a new current item.
The argument is the index of the new item, which is already current.
<p>See also <a href="#ea0ee6">setCurrentItem</a>() and <a href="#587403">currentItem</a>().
<h3 class="fn">int<a name="587403"></a>QListBox::currentItem()const</h3>
<p>Returns the index of the current (highlighted) item of the list box,
or -1 if no item has been selected.
<p>See also <a href="#7206e2">topItem</a>().
<h3 class="fn"><a href="qstring.html">QString</a><a name="7b54ba"></a>QListBox::currentText()const</h3>
<p>Returns the text of the current item.
<p>This is equivalent to <a href="#7635d3">text</a>(<a href="#587403">currentItem</a>()).
<h3 class="fn">void<a name="9a542a"></a>QListBox::doLayout()const <code>[protected]</code></h3>
<p>This function does the hard layout work. You should never need
to call it.
<h3 class="fn">void<a name="2045a0"></a>QListBox::doubleClicked(<a href="qlistboxitem.html">QListBoxItem</a>*item) <code>[signal]</code></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.
<em>item</em> is the listbox item onto which the user did the double click.
<h3 class="fn">void<a name="ffbf4f"></a>QListBox::ensureCurrentVisible() <code>[virtualslot]</code></h3>
<p>Ensures that the current item is visible.
<h3 class="fn"><a href="qlistboxitem.html">QListBoxItem</a>*<a name="8f6d23"></a>QListBox::findItem(const<a href="qstring.html">QString</a>&text)const</h3>
<p>Finds the first listbox item which starts with
<em>text</em> and returns it, or returns 0 of no
such item could be found.
The search is done case-insensitive.
<h3 class="fn"><a href="qlistboxitem.html">QListBoxItem</a>*<a name="8a6fa8"></a>QListBox::firstItem()const</h3>
<p>Returns the first item of this listbox.
<h3 class="fn">void<a name="71b09a"></a>QListBox::focusInEvent(<a href="qfocusevent.html">QFocusEvent</a>*e) <code>[virtualprotected]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qwidget.html#21a4b8">QWidget.</a>
<h3 class="fn">void<a name="1d784e"></a>QListBox::focusOutEvent(<a href="qfocusevent.html">QFocusEvent</a>*) <code>[virtualprotected]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qwidget.html#de664a">QWidget.</a>
<h3 class="fn">void<a name="cf2365"></a>QListBox::highlighted(<a href="qlistboxitem.html">QListBoxItem</a>*) <code>[signal]</code></h3>
<p>This signal is emitted when the user highlights a new current item.
The argument is a pointer to the new current item.
<p>See also <a href="#5a948b">selected</a>(), <a href="#587403">currentItem</a>() and <a href="#2fece7">selectionChanged</a>().
<h3 class="fn">void<a name="d8bf0a"></a>QListBox::highlighted(const<a href="qstring.html">QString</a>&) <code>[signal]</code></h3>
<p>This signal is emitted when the user highlights a new current item
and the new item is a string. The argument is the text of the
new current item.
<p>See also <a href="#5a948b">selected</a>(), <a href="#587403">currentItem</a>() and <a href="#2fece7">selectionChanged</a>().
<h3 class="fn">void<a name="b0b83f"></a>QListBox::highlighted(intindex) <code>[signal]</code></h3>
<p>This signal is emitted when the user highlights a new current item.
The argument is the index of the new item, which is already current.
<p>See also <a href="#5a948b">selected</a>(), <a href="#587403">currentItem</a>() and <a href="#2fece7">selectionChanged</a>().
<h3 class="fn">int<a name="7a2787"></a>QListBox::index(const<a href="qlistboxitem.html">QListBoxItem</a>*lbi)const</h3>
<p>Returns the index of <em>lbi,</em> or -1 if the item is not in this
list box or <em>lbi</em> is a NULL-Pointer.
<p>See also <a href="#39471d">item</a>().
<h3 class="fn">void<a name="de7b60"></a>QListBox::insertItem(const<a href="qlistboxitem.html">QListBoxItem</a>*lbi, const<a href="qlistboxitem.html">QListBoxItem</a>*after)</h3>
<p>Inserts the item <em>lbi</em> into the list after the item <em>after.</em>
<p>If <em>after</em> is NULL, <em>lbi</em> is inserted at the beginning.
<p>See also <a href="#016e24">insertStrList</a>().
<h3 class="fn">void<a name="04a671"></a>QListBox::insertItem(const<a href="qlistboxitem.html">QListBoxItem</a>*lbi, intindex=-1)</h3>
<p>Inserts the item <em>lbi</em> into the list at <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>See also <a href="#016e24">insertStrList</a>().
<h3 class="fn">void<a name="ed30cb"></a>QListBox::insertItem(const<a href="qpixmap.html">QPixmap</a>&pixmap, const<a href="qstring.html">QString</a>&text, intindex=-1)</h3>
<p>Inserts <em>pixmap</em> and <em>text</em> into the list at <em>index.</em>
<p>If <em>index</em> is negative, <em>pixmap</em> is inserted at the end of the list.
<p>See also <a href="#016e24">insertStrList</a>().
<h3 class="fn">void<a name="a01753"></a>QListBox::insertItem(const<a href="qpixmap.html">QPixmap</a>&pixmap, intindex=-1)</h3>
<p>Inserts <em>pixmap</em> into the list at <em>index.</em>
<p>If <em>index</em> is negative, <em>pixmap</em> is inserted at the end of the list.
<p>See also <a href="#016e24">insertStrList</a>().
<h3 class="fn">void<a name="ca96cf"></a>QListBox::insertItem(const<a href="qstring.html">QString</a>&text, intindex=-1)</h3>
<p>Inserts <em>text</em> into the list at <em>index.</em>
<p>If <em>index</em> is negative, <em>text</em> is inserted at the end of the list.
<p>See also <a href="#016e24">insertStrList</a>().
<h3 class="fn">void<a name="ee9742"></a>QListBox::insertStrList(const<a href="qstrlist.html">QStrList</a>&list, intindex=-1)</h3>
<p>Inserts the string list <em>list</em> into the list at item <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 <code>const char *</code> 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="#fb74ef">insertStringList</a>() - it uses real QStrings.<p><b>Warning:</b> This function is never significantly faster than a loop
around <a href="#04a671">insertItem</a>().
<p>See also <a href="#04a671">insertItem</a>() and <a href="#fb74ef">insertStringList</a>().
<h3 class="fn">void<a name="016e24"></a>QListBox::insertStrList(const<a href="qstrlist.html">QStrList</a>*list, intindex=-1)</h3>
<p>Inserts the string list <em>list</em> into the list at item <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 <code>const char *</code> 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="#fb74ef">insertStringList</a>() - it uses real QStrings.<p><b>Warning:</b> This function is never significantly faster than a loop
around <a href="#04a671">insertItem</a>().
<p>See also <a href="#04a671">insertItem</a>() and <a href="#fb74ef">insertStringList</a>().
<h3 class="fn">void<a name="b6f3f6"></a>QListBox::insertStrList(constchar**strings, intnumStrings=-1, intindex=-1)</h3>
<p>Inserts the <em>numStrings</em> strings of the array <em>strings</em> into the
list at item<em>index.</em>
<p>If <em>index</em> is negative, <a href="#016e24">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 <code>const char *</code> 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="#fb74ef">insertStringList</a>() - it uses real QStrings.<p><b>Warning:</b> This function is never significantly faster than a loop
around <a href="#04a671">insertItem</a>().
<p>See also <a href="#04a671">insertItem</a>() and <a href="#fb74ef">insertStringList</a>().
<h3 class="fn">void<a name="fb74ef"></a>QListBox::insertStringList(const<a href="qstringlist.html">QStringList</a>&list, intindex=-1)</h3>
<p>Inserts the string list <em>list</em> into the list at item <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="#04a671">insertItem</a>().
<p>See also <a href="#04a671">insertItem</a>() and <a href="#016e24">insertStrList</a>().
<h3 class="fn">void<a name="2fd437"></a>QListBox::invertSelection() <code>[slot]</code></h3>
<p>Inverts the selection. Works only in Multi and Extended selection mode.
<h3 class="fn">bool<a name="1c3445"></a>QListBox::isMultiSelection()const</h3>
<p><b>This function is obsolete.</b> It is provided to keep old source working, and will probably be removed in a future version of Qt. We strongly advise against using it in new code.<p>
Consider using <a href="#e1733a">selectionMode</a>() instead of this method.
<p>Returns TRUE if the listbox is in multi-selection mode or
extended selection mode, and FALSE if it is in single-selection mode
or no-selection more.
<p>See also <a href="#e1733a">selectionMode</a>() and <a href="#b85c6f">setSelectionMode</a>().
<h3 class="fn">bool<a name="22aa71"></a>QListBox::isRubberSelecting()const <code>[protected]</code></h3>
<p>Returns whether the user is selecting items using a rubber rectangle.
<h3 class="fn">bool<a name="b03380"></a>QListBox::isSelected(const<a href="qlistboxitem.html">QListBoxItem</a>*i)const</h3>
<p>Returns TRUE if item <em>i</em> is selected. Returns FALSE if it is not
selected or if there is an error.
<h3 class="fn">bool<a name="3d9b58"></a>QListBox::isSelected(inti)const</h3>
<p>Returns TRUE if item <em>i</em> is selected. Returns FALSE if it is not
selected or if there is an error.
<h3 class="fn"><a href="qlistboxitem.html">QListBoxItem</a>*<a name="39471d"></a>QListBox::item(intindex)const</h3>
<p>Returns a pointer to the item at position <em>index,</em> or 0 if <em>index</em> is out of bounds.
<p>See also <a href="#7a2787">index</a>().
<h3 class="fn"><a href="qlistboxitem.html">QListBoxItem</a>*<a name="dccc4b"></a>QListBox::itemAt(<a href="qpoint.html">QPoint</a>p)const</h3>
<p>Returns a pointer to the item at <em>p,</em> which is in on-screen
coordinates, or a null pointer if there is no item at <em>p.</em>
<h3 class="fn">int<a name="7ad0db"></a>QListBox::itemHeight(intindex=0)const</h3>
<p>Returns the height in pixels of the item with index <em>index. 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="97bba3"></a>QListBox::itemRect(<a href="qlistboxitem.html">QListBoxItem</a>*item)const</h3>
<p>Returns the rectangle on the screen <em>item</em> occupies in
<a href="qscrollview.html#26f2bf">viewport</a>()'s coordinates, or an invalid rectangle if <em>i</em> is a null
pointer or is not currently visible.
<h3 class="fn">bool<a name="1e4835"></a>QListBox::itemVisible(const<a href="qlistboxitem.html">QListBoxItem</a>*item)</h3>
<p>Returns TRUE if <em>item</em> is at least partly visible, or else FALSE.
<h3 class="fn">bool<a name="77faf7"></a>QListBox::itemVisible(intindex)</h3>
<p>Returns TRUE if the item at position <em>index</em> is at least partly
visible.
<h3 class="fn">void<a name="ade87c"></a>QListBox::keyPressEvent(<a href="qkeyevent.html">QKeyEvent</a>*e) <code>[virtualprotected]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qwidget.html#0a4482">QWidget.</a>
<h3 class="fn">long<a name="15518e"></a>QListBox::maxItemWidth()const</h3>
<p>Returns the width of the largest item in the listbox.
<h3 class="fn"><a href="qsize.html">QSize</a><a name="31647d"></a>QListBox::minimumSizeHint()const <code>[virtual]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qwidget.html#553e08">QWidget.</a>
<h3 class="fn">void<a name="93cf92"></a>QListBox::mouseButtonClicked(intbutton, <a href="qlistboxitem.html">QListBoxItem</a>*item, const<a href="qpoint.html">QPoint</a>&pos) <code>[signal]</code></h3>
<p>This signal is emitted whenever the user clicks (mouse pressed + mouse released)
into the listbox.
<em>button</em> is the mouse button, which the user pressed.
<em>item</em> is the pointer to the clicked listbox item or NULL, if the user didn't click on an item.
<em>pos</em> is the position where the user has clicked.
<p>Note that you may not delete any <a href="qlistboxitem.html">QListBoxItem</a> objects in slots
connected to this signal.
<h3 class="fn">void<a name="df4528"></a>QListBox::mouseButtonPressed(intbutton, <a href="qlistboxitem.html">QListBoxItem</a>*item, const<a href="qpoint.html">QPoint</a>&pos) <code>[signal]</code></h3>
<p>This signal is emitted whenever the user presses the mouse button
on a listbox.
<em>button</em> is the mouse button, which the user pressed.
<em>item</em> is the pointer to the listbox item onto which the user pressed the
mouse button or NULL, if the user didn't press the mouse on an item.
<em>pos</em> is the position of the mouse cursor where the mouse cursor was
when the user pressed the mouse button.
<p>Note that you may not delete any <a href="qlistboxitem.html">QListBoxItem</a> objects in slots
connected to this signal.
<h3 class="fn">void<a name="27ecc4"></a>QListBox::mouseDoubleClickEvent(<a href="qmouseevent.html">QMouseEvent</a>*e) <code>[virtualprotected]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qwidget.html#e36586">QWidget.</a>
<h3 class="fn">void<a name="f8ff96"></a>QListBox::mouseMoveEvent(<a href="qmouseevent.html">QMouseEvent</a>*e) <code>[virtualprotected]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qwidget.html#a51d92">QWidget.</a>
<h3 class="fn">void<a name="93fa52"></a>QListBox::mousePressEvent(<a href="qmouseevent.html">QMouseEvent</a>*e) <code>[virtualprotected]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qwidget.html#2ecc04">QWidget.</a>
<h3 class="fn">void<a name="5653aa"></a>QListBox::mouseReleaseEvent(<a href="qmouseevent.html">QMouseEvent</a>*e) <code>[virtualprotected]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qwidget.html#9aa77f">QWidget.</a>
<h3 class="fn">int<a name="bfca10"></a>QListBox::numColumns()const</h3>
<p>Returns the number of columns in the list box. This is normally
1, but can be different if <a href="#61bd50">setColumnMode</a>() or <a href="#585a8f">setRowMode</a>() has been
called.
<p>See also <a href="#61bd50">setColumnMode</a>(), <a href="#585a8f">setRowMode</a>() and <a href="#ece487">numRows</a>().
<h3 class="fn">int<a name="312b76"></a>QListBox::numItemsVisible()const</h3>
<p>Returns the number of visible items. Both partially and entirely
visible items are counted.
<h3 class="fn">int<a name="ece487"></a>QListBox::numRows()const</h3>
<p>Returns the number of rows in the list box. This is equal to the
number of items in the default single-column layout, but can be
different.
<p>See also <a href="#585a8f">setRowMode</a>() and <a href="#bfca10">numColumns</a>().
<h3 class="fn">void<a name="2d55d9"></a>QListBox::onItem(<a href="qlistboxitem.html">QListBoxItem</a>*i) <code>[signal]</code></h3>
<p>This signal is emitted, when the user moves the mouse cursor onto an item.
Its only emitted once per item.
<h3 class="fn">void<a name="16aace"></a>QListBox::onViewport() <code>[signal]</code></h3>
<p>This signal is emitted, when the user moves the mouse cursor, which was
on an item away from the item onto the viewport.
<h3 class="fn">void<a name="06bf5a"></a>QListBox::paintCell(<a href="qpainter.html">QPainter</a>*p, introw, intcol) <code>[virtualprotected]</code></h3>
<p>Provided for compatibility with the old QListBox. We recommend
using <a href="qlistboxitem.html#4a55dc">QListBoxItem::paint</a>().
<h3 class="fn">const<a href="qpixmap.html">QPixmap</a>*<a name="03c43b"></a>QListBox::pixmap(intindex)const</h3>
<p>Returns a pointer to the pixmap at position <em>index,</em> or 0 if there is no
pixmap there.
<p>See also <a href="#7635d3">text</a>().
<h3 class="fn">void<a name="181638"></a>QListBox::pressed(<a href="qlistboxitem.html">QListBoxItem</a>*item) <code>[signal]</code></h3>
<p>This signal is emitted whenever the user presses the mouse button
on a listbox.
<em>item</em> is the pointer to the listbox item onto which the user pressed the
mouse button or NULL, if the user didn't press the mouse on an item.
<p>Note that you may not delete any <a href="qlistboxitem.html">QListBoxItem</a> objects in slots
connected to this signal.
<h3 class="fn">void<a name="6abeb9"></a>QListBox::pressed(<a href="qlistboxitem.html">QListBoxItem</a>*item, const<a href="qpoint.html">QPoint</a>&pnt) <code>[signal]</code></h3>
<p>This signal is emitted whenever the user presses the mouse button
on a listbox.
<em>item</em> is the pointer to the listbox item onto which the user pressed the
mouse button or NULL, if the user didn't press the mouse on an item.
<em>pnt</em> is the position of the mouse cursor where the mouse cursor was
when the user pressed the mouse button.
<p>Note that you may not delete any <a href="qlistboxitem.html">QListBoxItem</a> objects in slots
connected to this signal.
<h3 class="fn">void<a name="bc0ee5"></a>QListBox::removeItem(intindex)</h3>
<p>Removes and deletes the item at position <em>index.</em> If <em>index</em> is equal
to <a href="#587403">currentItem</a>(), a new item gets highlighted and the <a href="#b0b83f">highlighted</a>() signal
is emitted.
<p>See also <a href="#04a671">insertItem</a>() and <a href="#fd65eb">clear</a>().
<h3 class="fn">void<a name="375cf7"></a>QListBox::resizeEvent(<a href="qresizeevent.html">QResizeEvent</a>*e) <code>[virtualprotected]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qwidget.html#7d375f">QWidget.</a>
<h3 class="fn">void<a name="45c9fa"></a>QListBox::returnPressed(<a href="qlistboxitem.html">QListBoxItem</a>*) <code>[signal]</code></h3>
<p>This signal is emitted when enter or return is pressed. The
argument is <a href="#587403">currentItem</a>().
<h3 class="fn">void<a name="b7398a"></a>QListBox::rightButtonClicked(<a href="qlistboxitem.html">QListBoxItem</a>*, const<a href="qpoint.html">QPoint</a>&) <code>[signal]</code></h3>
<p>This signal is emitted when the right button is clicked (ie. when
it's released). 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="406d00"></a>QListBox::rightButtonPressed(<a href="qlistboxitem.html">QListBoxItem</a>*, const<a href="qpoint.html">QPoint</a>&) <code>[signal]</code></h3>
<p>This signal is emitted when the right button is pressed. Then
arguments are the relevant <a href="qlistboxitem.html">QListBoxItem</a> (may be 0) and the point in
global coordinates.
<h3 class="fn">QListBox::LayoutMode<a name="a0b2e2"></a>QListBox::rowMode()const</h3>
<p>Returns the row layout mode for this list box. This is normally
<code>Variable,</code> but can be changed by calling <a href="#585a8f">setRowMode</a>().
<p>See also <a href="#87b3ec">columnMode</a>(), <a href="#585a8f">setRowMode</a>() and <a href="#ece487">numRows</a>().
<h3 class="fn">void<a name="820b7c"></a>QListBox::selectAll(boolselect) <code>[slot]</code></h3>
<p>If <em>select</em> is TRUE, all items get selected, else all get unselected.
This works only in the selection modes Multi and Extended. In
Single and NoSelection mode the selection of the current item is
just set to <em>select.</em>
<h3 class="fn">void<a name="9b0640"></a>QListBox::selected(<a href="qlistboxitem.html">QListBoxItem</a>*) <code>[signal]</code></h3>
<p>This signal is emitted when the user double-clicks on an item or
presses return when an item is highlighted. The argument is a
pointer to the new selected item.
<p>See also <a href="#b0b83f">highlighted</a>() and <a href="#2fece7">selectionChanged</a>().
<h3 class="fn">void<a name="5a948b"></a>QListBox::selected(const<a href="qstring.html">QString</a>&) <code>[signal]</code></h3>
<p>This signal is emitted when the user double-clicks on an item or
presses return while an item is highlighted, and the selected item
is (or has) a string. The argument is the text of the selected
item.
<p>See also <a href="#b0b83f">highlighted</a>() and <a href="#2fece7">selectionChanged</a>().
<h3 class="fn">void<a name="f36628"></a>QListBox::selected(intindex) <code>[signal]</code></h3>
<p>This signal is emitted when the user double-clicks on an item or
presses return when an item is highlighted. The argument is the
index of the selected item.
<p>See also <a href="#b0b83f">highlighted</a>() and <a href="#2fece7">selectionChanged</a>().
<h3 class="fn">void<a name="2fece7"></a>QListBox::selectionChanged() <code>[signal]</code></h3>
<p>This signal is emitted when the selection set of a
listbox 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.
<p>See also <a href="#5a948b">selected</a>() and <a href="#587403">currentItem</a>().
<h3 class="fn">void<a name="a61084"></a>QListBox::selectionChanged(<a href="qlistboxitem.html">QListBoxItem</a>*item) <code>[signal]</code></h3>
<p>This signal is emitted when the selection in a single-selection
listbox changes. <em>item</em> is the new selected listbox item.
<p>See also <a href="#5a948b">selected</a>() and <a href="#587403">currentItem</a>().
<h3 class="fn">QListBox::SelectionMode<a name="e1733a"></a>QListBox::selectionMode()const</h3>
<p>Returns the selection mode of the list box. The initial mode is <code>Single.</code>
<p>See also <a href="#b85c6f">setSelectionMode</a>().
<h3 class="fn">void<a name="1fde29"></a>QListBox::setBottomItem(intindex) <code>[virtual]</code></h3>
<p>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>See also <a href="#794012">setTopItem</a>().
<h3 class="fn">void<a name="61bd50"></a>QListBox::setColumnMode(<a href="qlistbox.html#LayoutMode">LayoutMode</a>mode)</h3>
<p>Sets the column layout mode to <em>mode,</em> and the number of displayed
columns accordingly.
<p>The row layout mode implicitly becomes <code>Variable.</code>
<p>If <em>mode</em> is <code>Variable,</code> this function returns without doing anything.
<p>See also <a href="#585a8f">setRowMode</a>() and <a href="#87b3ec">columnMode</a>().
<h3 class="fn">void<a name="80cd79"></a>QListBox::setColumnMode(intcolumns) <code>[virtual]</code></h3>
<p>Sets the column layout mode for this list box to <code>FixedNumber,</code> and
sets the number of displayed columns accordingly.
<p>See also <a href="#585a8f">setRowMode</a>(), <a href="#87b3ec">columnMode</a>() and <a href="#bfca10">numColumns</a>().
<h3 class="fn">void<a name="ea0ee6"></a>QListBox::setCurrentItem(<a href="qlistboxitem.html">QListBoxItem</a>*i) <code>[virtual]</code></h3>
<p>Sets the highlighted item to the item <em>i.</em> The highlighting is moved and
the list box scrolled as necessary.
<p>See also <a href="#587403">currentItem</a>().
<h3 class="fn">void<a name="d512e5"></a>QListBox::setCurrentItem(intindex) <code>[virtual]</code></h3>
<p>This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
<p>This is a bit slower than the <a href="qlistboxitem.html">QListBoxItem</a> * version.
<h3 class="fn">void<a name="58492d"></a>QListBox::setFont(const<a href="qfont.html">QFont</a>&font) <code>[virtual]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<h3 class="fn">void<a name="e16d4f"></a>QListBox::setMultiSelection(boolenable)</h3>
<p><b>This function is obsolete.</b> It is provided to keep old source working, and will probably be removed in a future version of Qt. We strongly advise against using it in new code.<p>
Consider using <a href="#b85c6f">setSelectionMode</a>() instead of this method.
<p>Sets the list box to multi-selection mode if <em>enable</em> is TRUE, and
to single-selection mode if <em>enable</em> is FALSE. We recommend using
setSelectionMode() instead; that function also offers two other modes.
<p>See also <a href="#b85c6f">setSelectionMode</a>() and <a href="#e1733a">selectionMode</a>().
<h3 class="fn">void<a name="585a8f"></a>QListBox::setRowMode(<a href="qlistbox.html#LayoutMode">LayoutMode</a>mode)</h3>
<p>Sets the row layout mode to <em>mode,</em> and the number of displayed
rows accordingly.
<p>The column layout mode implicitly becomes <code>Variable.</code>
<p>If <em>mode</em> is <code>Variable,</code> this function returns without doing anything.
<p>See also <a href="#61bd50">setColumnMode</a>() and <a href="#a0b2e2">rowMode</a>().
<h3 class="fn">void<a name="c7eb32"></a>QListBox::setRowMode(introws) <code>[virtual]</code></h3>
<p>Sets the row layout mode for this list box to <code>FixedNumber</code> and sets the
number of displayed rows accordingly.
<p>See also <a href="#61bd50">setColumnMode</a>(), <a href="#a0b2e2">rowMode</a>() and <a href="#ece487">numRows</a>().
<h3 class="fn">void<a name="f0a464"></a>QListBox::setSelected(<a href="qlistboxitem.html">QListBoxItem</a>*item, boolselect) <code>[virtual]</code></h3>
<p>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 listbox is a single-selection listbox and and <em>select</em> is TRUE,
<a href="#ea0ee6">setCurrentItem</a>() is called.
<p>If the listbox is a single-selection listbox and and <em>select</em> is
FALSE, <a href="#0c5d7d">clearSelection</a>() is called if <em>index</em> is the currently
selected item.
<p>Note that for this function, no-selection means multi-selection.
The user cannot select items in a no-selection list box, but the
application programmer can.
<p>See also <a href="#e16d4f">setMultiSelection</a>(), <a href="#ea0ee6">setCurrentItem</a>(), <a href="#0c5d7d">clearSelection</a>() and <a href="#587403">currentItem</a>().
<h3 class="fn">void<a name="6866dd"></a>QListBox::setSelected(intindex, boolselect)</h3>
<p>Selects the item at position <em>index</em> if <em>select</em> is TRUE, or
unselects it if <em>select</em> is FALSE, and repaints the item
appropriately.
<p>If the listbox is a single-selection listbox and and <em>select</em> is TRUE,
<a href="#ea0ee6">setCurrentItem</a>() will be called.
<p>If the listbox is a single-selection listbox and and <em>select</em> is FALSE,
<a href="#0c5d7d">clearSelection</a>() will be called if <em>index</em> is the currently selected
item.
<p>See also <a href="#e16d4f">setMultiSelection</a>(), <a href="#ea0ee6">setCurrentItem</a>(), <a href="#0c5d7d">clearSelection</a>() and <a href="#587403">currentItem</a>().
<h3 class="fn">void<a name="b85c6f"></a>QListBox::setSelectionMode(<a href="qlistbox.html#SelectionMode">SelectionMode</a>mode)</h3>
<p>Sets the list box to selection mode <em>mode,</em> which may be one of
<code>Single</code> (the default), <code>Extended, Multi</code> or <code>NoSelection.</code>
<p>See also <a href="#e1733a">selectionMode</a>().
<h3 class="fn">void<a name="794012"></a>QListBox::setTopItem(intindex) <code>[virtual]</code></h3>
<p>Scrolls the list box so the item at position <em>index</em> in the list
is displayed in the top row of the list box.
<p>See also <a href="#7206e2">topItem</a>() and <a href="#ffbf4f">ensureCurrentVisible</a>().
<h3 class="fn">void<a name="4e368d"></a>QListBox::setVariableHeight(boolenable) <code>[virtual]</code></h3>
<p>Sets this list box to have variable-height rows if <em>enable</em> is
TRUE, and equal-height rows if <em>enable</em> is FALSE.
<p>When the list box has variable-height rows, 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>The default is TRUE.
<p>See also <a href="#b52a7d">setVariableWidth</a>() and <a href="#e915ee">variableHeight</a>().
<h3 class="fn">void<a name="b52a7d"></a>QListBox::setVariableWidth(boolenable) <code>[virtual]</code></h3>
<p>Sets this list box to have variable-width columns if <em>enable</em> is
TRUE, and equal-width columns if <em>enable</em> is FALSE.
<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,
all columns are as wide as the widest item in the list box.
<p>The default is FALSE.
<p>See also <a href="#4e368d">setVariableHeight</a>() and <a href="#ffc6fe">variableWidth</a>().
<h3 class="fn">void<a name="ec89a6"></a>QListBox::showEvent(<a href="qshowevent.html">QShowEvent</a>*) <code>[virtualprotected]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qwidget.html#542dc0">QWidget.</a>
<h3 class="fn"><a href="qsize.html">QSize</a><a name="5a33a9"></a>QListBox::sizeHint()const <code>[virtual]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qwidget.html#4511d1">QWidget.</a>
<h3 class="fn">void<a name="562755"></a>QListBox::sort(boolascending=TRUE)</h3>
<p>Sorts the item in ascending order, if <em>ascending</em> is TRUE, or
descending otherwise.
<p>To compare the items, the text (<a href="qlistboxitem.html#abfb21">QListBoxItem::text</a>()) of the items
is used. The sorting is done using the Quick-Sort Alogorithm.
<h3 class="fn">void<a name="01a6f7"></a>QListBox::takeItem(const<a href="qlistboxitem.html">QListBoxItem</a>*item)</h3>
<p>Removes <em>item</em> from the listbox and causes an update of the screen
display. The item is not deleted. You should normally not need to
call this function, as QListBoxItem::~<a href="qlistboxitem.html">QListBoxItem</a>() calls it. The
normal way to delete an item is <code>delete.</code>
<p>See also <a href="#04a671">QListBox::insertItem</a>().
<h3 class="fn"><a href="qstring.html">QString</a><a name="7635d3"></a>QListBox::text(intindex)const</h3>
<p>Returns the text at position <em>index,</em> or a
<a href="qstring.html#e21796">null string</a>
if there is no text at that position.
<p>See also <a href="#03c43b">pixmap</a>().
<h3 class="fn">void<a name="1c4ba9"></a>QListBox::toggleCurrentItem() <code>[protected]</code></h3>
<p>Toggles the selection status of <a href="#587403">currentItem</a>() and repaints, if
the listbox is a multi-selection listbox.
<p>See also <a href="#e16d4f">setMultiSelection</a>().
<h3 class="fn">int<a name="7206e2"></a>QListBox::topItem()const</h3>
<p>Returns the index of an item at the top of the screen. If there
are more than one of them, an arbitrary item is selected and returned.
<h3 class="fn">void<a name="fd9471"></a>QListBox::triggerUpdate(booldoLayout)</h3>
<p>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="604614"></a>QListBox::updateItem(<a href="qlistboxitem.html">QListBoxItem</a>*i) <code>[protected]</code></h3>
<p>Repaints <em>i.</em>
<h3 class="fn">void<a name="b04c89"></a>QListBox::updateItem(intindex) <code>[protected]</code></h3>
<p>Repaints the item at position <em>index</em> in the list.
<h3 class="fn">bool<a name="e915ee"></a>QListBox::variableHeight()const</h3>
<p>Returns TRUE if this list box has variable-height rows, and
FALSE if all the rows have the same height.
<p>See also <a href="#4e368d">setVariableHeight</a>() and <a href="#b52a7d">setVariableWidth</a>().
<h3 class="fn">bool<a name="ffc6fe"></a>QListBox::variableWidth()const</h3>
<p>Returns TRUE if this list box has variable-width columns, and
FALSE if all the columns have the same width.
<p>See also <a href="#4e368d">setVariableHeight</a>() and <a href="#b52a7d">setVariableWidth</a>().
<h3 class="fn">void<a name="06b4e9"></a>QListBox::viewportMouseDoubleClickEvent(<a href="qmouseevent.html">QMouseEvent</a>*e) <code>[virtualprotected]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qscrollview.html#391534">QScrollView.</a>
<h3 class="fn">void<a name="8b41ba"></a>QListBox::viewportMouseMoveEvent(<a href="qmouseevent.html">QMouseEvent</a>*e) <code>[virtualprotected]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qscrollview.html#d850f6">QScrollView.</a>
<h3 class="fn">void<a name="2e5e5e"></a>QListBox::viewportMousePressEvent(<a href="qmouseevent.html">QMouseEvent</a>*e) <code>[virtualprotected]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qscrollview.html#013843">QScrollView.</a>
<h3 class="fn">void<a name="78f328"></a>QListBox::viewportMouseReleaseEvent(<a href="qmouseevent.html">QMouseEvent</a>*e) <code>[virtualprotected]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qscrollview.html#ff7b46">QScrollView.</a>
<h3 class="fn">void<a name="0a90bd"></a>QListBox::viewportPaintEvent(<a href="qpaintevent.html">QPaintEvent</a>*e) <code>[virtual]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qscrollview.html#ca8463">QScrollView.</a>
<h3 class="fn">void<a name="a4d8c4"></a>QListBox::clearInputString() <code>[protectedslot]</code></h3>
<p>For internal use only.
<hr><p>
Search the documentation, FAQ, qt-interest archive and more (uses
<a href="http://www.trolltech.com">www.trolltech.com</a>):<br>
<form method=post action="http://www.trolltech.com/search.cgi">
<input type=hidden name="version" value="2.3.2"><nobr>
<input size="50" name="search"><input type=submit value="Search">
</nobr></form><hr><p>
This file is part of the <a href="index.html">Qt toolkit</a>,
copyright © 1995-2001
<a href="http://www.trolltech.com">Trolltech</a>, all rights reserved.<p><address><hr><div align="center">
<table width="100%" cellspacing="0" border="0"><tr>
<td>Copyright 2001 Trolltech<td><a href="http://www.trolltech.com/trademarks.html">Trademarks</a>
<td align="right"><div align="right">Qt version 2.3.2</div>
</table></div></address></body></html>
|