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
|
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en_US" lang="en_US">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qlistwidget.cpp -->
<title>Qt 4.8: QListWidget Class Reference</title>
<link rel="stylesheet" type="text/css" href="style/offline.css" />
</head>
<body>
<div class="header" id="qtdocheader">
<div class="content">
<a href="index.html" class="qtref"><span>Qt Reference Documentation</span></a>
</div>
<div class="breadcrumb toolblock">
<ul>
<li class="first"><a href="index.html">Home</a></li>
<!-- Breadcrumbs go here -->
<li><a href="modules.html">Modules</a></li>
<li><a href="qtgui.html">QtGui</a></li>
<li>QListWidget</li>
</ul>
</div>
</div>
<div class="content mainContent">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#properties">Properties</a></li>
<li class="level1"><a href="#public-functions">Public Functions</a></li>
<li class="level1"><a href="#public-slots">Public Slots</a></li>
<li class="level1"><a href="#signals">Signals</a></li>
<li class="level1"><a href="#protected-functions">Protected Functions</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
</ul>
</div>
<h1 class="title">QListWidget Class Reference</h1>
<!-- $$$QListWidget-brief -->
<p>The QListWidget class provides an item-based list widget. <a href="#details">More...</a></p>
<!-- @@@QListWidget -->
<pre class="cpp"> <span class="preprocessor">#include <QListWidget></span></pre><p><b>Inherits: </b><a href="qlistview.html">QListView</a>.</p>
<ul>
<li><a href="qlistwidget-members.html">List of all members, including inherited members</a></li>
<li><a href="qlistwidget-obsolete.html">Obsolete members</a></li>
</ul>
<a name="properties"></a>
<h2>Properties</h2>
<ul>
<li class="fn"><b><a href="qlistwidget.html#count-prop">count</a></b> : const int</li>
<li class="fn"><b><a href="qlistwidget.html#currentRow-prop">currentRow</a></b> : int</li>
<li class="fn"><b><a href="qlistwidget.html#sortingEnabled-prop">sortingEnabled</a></b> : bool</li>
</ul>
<ul>
<li class="fn">13 properties inherited from <a href="qlistview.html#properties">QListView</a></li>
<li class="fn">16 properties inherited from <a href="qabstractitemview.html#properties">QAbstractItemView</a></li>
<li class="fn">2 properties inherited from <a href="qabstractscrollarea.html#properties">QAbstractScrollArea</a></li>
<li class="fn">6 properties inherited from <a href="qframe.html#properties">QFrame</a></li>
<li class="fn">58 properties inherited from <a href="qwidget.html#properties">QWidget</a></li>
<li class="fn">1 property inherited from <a href="qobject.html#properties">QObject</a></li>
</ul>
<a name="public-functions"></a>
<h2>Public Functions</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qlistwidget.html#QListWidget">QListWidget</a></b> ( QWidget * <i>parent</i> = 0 )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qlistwidget.html#dtor.QListWidget">~QListWidget</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qlistwidget.html#addItem">addItem</a></b> ( const QString & <i>label</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qlistwidget.html#addItem-2">addItem</a></b> ( QListWidgetItem * <i>item</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qlistwidget.html#addItems">addItems</a></b> ( const QStringList & <i>labels</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qlistwidget.html#closePersistentEditor">closePersistentEditor</a></b> ( QListWidgetItem * <i>item</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qlistwidget.html#count-prop">count</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QListWidgetItem * </td><td class="memItemRight bottomAlign"><b><a href="qlistwidget.html#currentItem">currentItem</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qlistwidget.html#currentRow-prop">currentRow</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qlistwidget.html#editItem">editItem</a></b> ( QListWidgetItem * <i>item</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QList<QListWidgetItem *> </td><td class="memItemRight bottomAlign"><b><a href="qlistwidget.html#findItems">findItems</a></b> ( const QString & <i>text</i>, Qt::MatchFlags <i>flags</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qlistwidget.html#insertItem">insertItem</a></b> ( int <i>row</i>, QListWidgetItem * <i>item</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qlistwidget.html#insertItem-2">insertItem</a></b> ( int <i>row</i>, const QString & <i>label</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qlistwidget.html#insertItems">insertItems</a></b> ( int <i>row</i>, const QStringList & <i>labels</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qlistwidget.html#sortingEnabled-prop">isSortingEnabled</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QListWidgetItem * </td><td class="memItemRight bottomAlign"><b><a href="qlistwidget.html#item">item</a></b> ( int <i>row</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QListWidgetItem * </td><td class="memItemRight bottomAlign"><b><a href="qlistwidget.html#itemAt">itemAt</a></b> ( const QPoint & <i>p</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QListWidgetItem * </td><td class="memItemRight bottomAlign"><b><a href="qlistwidget.html#itemAt-2">itemAt</a></b> ( int <i>x</i>, int <i>y</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QWidget * </td><td class="memItemRight bottomAlign"><b><a href="qlistwidget.html#itemWidget">itemWidget</a></b> ( QListWidgetItem * <i>item</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qlistwidget.html#openPersistentEditor">openPersistentEditor</a></b> ( QListWidgetItem * <i>item</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qlistwidget.html#removeItemWidget">removeItemWidget</a></b> ( QListWidgetItem * <i>item</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qlistwidget.html#row">row</a></b> ( const QListWidgetItem * <i>item</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QList<QListWidgetItem *> </td><td class="memItemRight bottomAlign"><b><a href="qlistwidget.html#selectedItems">selectedItems</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qlistwidget.html#setCurrentItem">setCurrentItem</a></b> ( QListWidgetItem * <i>item</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qlistwidget.html#setCurrentItem-2">setCurrentItem</a></b> ( QListWidgetItem * <i>item</i>, QItemSelectionModel::SelectionFlags <i>command</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qlistwidget.html#currentRow-prop">setCurrentRow</a></b> ( int <i>row</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qlistwidget.html#currentRow-prop">setCurrentRow</a></b> ( int <i>row</i>, QItemSelectionModel::SelectionFlags <i>command</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qlistwidget.html#setItemWidget">setItemWidget</a></b> ( QListWidgetItem * <i>item</i>, QWidget * <i>widget</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qlistwidget.html#sortingEnabled-prop">setSortingEnabled</a></b> ( bool <i>enable</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qlistwidget.html#sortItems">sortItems</a></b> ( Qt::SortOrder <i>order</i> = Qt::AscendingOrder )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QListWidgetItem * </td><td class="memItemRight bottomAlign"><b><a href="qlistwidget.html#takeItem">takeItem</a></b> ( int <i>row</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QRect </td><td class="memItemRight bottomAlign"><b><a href="qlistwidget.html#visualItemRect">visualItemRect</a></b> ( const QListWidgetItem * <i>item</i> ) const</td></tr>
</table>
<a name="reimplemented-public-functions"></a>
<h2>Reimplemented Public Functions</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qlistwidget.html#dropEvent">dropEvent</a></b> ( QDropEvent * <i>event</i> )</td></tr>
</table>
<ul>
<li class="fn">32 public functions inherited from <a href="qlistview.html#public-functions">QListView</a></li>
<li class="fn">57 public functions inherited from <a href="qabstractitemview.html#public-functions">QAbstractItemView</a></li>
<li class="fn">17 public functions inherited from <a href="qabstractscrollarea.html#public-functions">QAbstractScrollArea</a></li>
<li class="fn">14 public functions inherited from <a href="qframe.html#public-functions">QFrame</a></li>
<li class="fn">221 public functions inherited from <a href="qwidget.html#public-functions">QWidget</a></li>
<li class="fn">29 public functions inherited from <a href="qobject.html#public-functions">QObject</a></li>
<li class="fn">13 public functions inherited from <a href="qpaintdevice.html#public-functions">QPaintDevice</a></li>
</ul>
<a name="public-slots"></a>
<h2>Public Slots</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qlistwidget.html#clear">clear</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qlistwidget.html#scrollToItem">scrollToItem</a></b> ( const QListWidgetItem * <i>item</i>, QAbstractItemView::ScrollHint <i>hint</i> = EnsureVisible )</td></tr>
</table>
<ul>
<li class="fn">9 public slots inherited from <a href="qabstractitemview.html#public-slots">QAbstractItemView</a></li>
<li class="fn">19 public slots inherited from <a href="qwidget.html#public-slots">QWidget</a></li>
<li class="fn">1 public slot inherited from <a href="qobject.html#public-slots">QObject</a></li>
</ul>
<a name="signals"></a>
<h2>Signals</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qlistwidget.html#currentItemChanged">currentItemChanged</a></b> ( QListWidgetItem * <i>current</i>, QListWidgetItem * <i>previous</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qlistwidget.html#currentRowChanged">currentRowChanged</a></b> ( int <i>currentRow</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qlistwidget.html#currentTextChanged">currentTextChanged</a></b> ( const QString & <i>currentText</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qlistwidget.html#itemActivated">itemActivated</a></b> ( QListWidgetItem * <i>item</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qlistwidget.html#itemChanged">itemChanged</a></b> ( QListWidgetItem * <i>item</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qlistwidget.html#itemClicked">itemClicked</a></b> ( QListWidgetItem * <i>item</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qlistwidget.html#itemDoubleClicked">itemDoubleClicked</a></b> ( QListWidgetItem * <i>item</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qlistwidget.html#itemEntered">itemEntered</a></b> ( QListWidgetItem * <i>item</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qlistwidget.html#itemPressed">itemPressed</a></b> ( QListWidgetItem * <i>item</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qlistwidget.html#itemSelectionChanged">itemSelectionChanged</a></b> ()</td></tr>
</table>
<ul>
<li class="fn">1 signal inherited from <a href="qlistview.html#signals">QListView</a></li>
<li class="fn">6 signals inherited from <a href="qabstractitemview.html#signals">QAbstractItemView</a></li>
<li class="fn">1 signal inherited from <a href="qwidget.html#signals">QWidget</a></li>
<li class="fn">1 signal inherited from <a href="qobject.html#signals">QObject</a></li>
</ul>
<a name="protected-functions"></a>
<h2>Protected Functions</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qlistwidget.html#dropMimeData">dropMimeData</a></b> ( int <i>index</i>, const QMimeData * <i>data</i>, Qt::DropAction <i>action</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QModelIndex </td><td class="memItemRight bottomAlign"><b><a href="qlistwidget.html#indexFromItem">indexFromItem</a></b> ( QListWidgetItem * <i>item</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QListWidgetItem * </td><td class="memItemRight bottomAlign"><b><a href="qlistwidget.html#itemFromIndex">itemFromIndex</a></b> ( const QModelIndex & <i>index</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QList<QListWidgetItem *> </td><td class="memItemRight bottomAlign"><b><a href="qlistwidget.html#items">items</a></b> ( const QMimeData * <i>data</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QMimeData * </td><td class="memItemRight bottomAlign"><b><a href="qlistwidget.html#mimeData">mimeData</a></b> ( const QList<QListWidgetItem *> <i>items</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QStringList </td><td class="memItemRight bottomAlign"><b><a href="qlistwidget.html#mimeTypes">mimeTypes</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual Qt::DropActions </td><td class="memItemRight bottomAlign"><b><a href="qlistwidget.html#supportedDropActions">supportedDropActions</a></b> () const</td></tr>
</table>
<a name="reimplemented-protected-functions"></a>
<h2>Reimplemented Protected Functions</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qlistwidget.html#event">event</a></b> ( QEvent * <i>e</i> )</td></tr>
</table>
<ul>
<li class="fn">26 protected functions inherited from <a href="qlistview.html#protected-functions">QListView</a></li>
<li class="fn">36 protected functions inherited from <a href="qabstractitemview.html#protected-functions">QAbstractItemView</a></li>
<li class="fn">18 protected functions inherited from <a href="qabstractscrollarea.html#protected-functions">QAbstractScrollArea</a></li>
<li class="fn">3 protected functions inherited from <a href="qframe.html#protected-functions">QFrame</a></li>
<li class="fn">37 protected functions inherited from <a href="qwidget.html#protected-functions">QWidget</a></li>
<li class="fn">8 protected functions inherited from <a href="qobject.html#protected-functions">QObject</a></li>
<li class="fn">1 protected function inherited from <a href="qpaintdevice.html#protected-functions">QPaintDevice</a></li>
</ul>
<h3>Additional Inherited Members</h3>
<ul>
<li class="fn">4 static public members inherited from <a href="qwidget.html#static-public-members">QWidget</a></li>
<li class="fn">7 static public members inherited from <a href="qobject.html#static-public-members">QObject</a></li>
<li class="fn">9 protected slots inherited from <a href="qabstractitemview.html#protected-slots">QAbstractItemView</a></li>
<li class="fn">1 protected slot inherited from <a href="qabstractscrollarea.html#protected-slots">QAbstractScrollArea</a></li>
<li class="fn">1 protected slot inherited from <a href="qwidget.html#protected-slots">QWidget</a></li>
</ul>
<a name="details"></a>
<!-- $$$QListWidget-description -->
<div class="descr">
<h2>Detailed Description</h2>
<p>The QListWidget class provides an item-based list widget.</p>
<p>QListWidget is a convenience class that provides a list view similar to the one supplied by <a href="qlistview.html">QListView</a>, but with a classic item-based interface for adding and removing items. QListWidget uses an internal model to manage each <a href="qlistwidgetitem.html">QListWidgetItem</a> in the list.</p>
<p>For a more flexible list view widget, use the <a href="qlistview.html">QListView</a> class with a standard model.</p>
<p>List widgets are constructed in the same way as other widgets:</p>
<pre class="cpp"> QListWidget *listWidget = new QListWidget(this);</pre>
<p>The <a href="qabstractitemview.html#selectionMode-prop">selectionMode</a>() of a list widget determines how many of the items in the list can be selected at the same time, and whether complex selections of items can be created. This can be set with the <a href="qabstractitemview.html#selectionMode-prop">setSelectionMode</a>() function.</p>
<p>There are two ways to add items to the list: they can be constructed with the list widget as their parent widget, or they can be constructed with no parent widget and added to the list later. If a list widget already exists when the items are constructed, the first method is easier to use:</p>
<pre class="cpp"> <span class="keyword">new</span> <span class="type"><a href="qlistwidgetitem.html">QListWidgetItem</a></span>(tr(<span class="string">"Oak"</span>)<span class="operator">,</span> listWidget);
<span class="keyword">new</span> <span class="type"><a href="qlistwidgetitem.html">QListWidgetItem</a></span>(tr(<span class="string">"Fir"</span>)<span class="operator">,</span> listWidget);
<span class="keyword">new</span> <span class="type"><a href="qlistwidgetitem.html">QListWidgetItem</a></span>(tr(<span class="string">"Pine"</span>)<span class="operator">,</span> listWidget);</pre>
<p>If you need to insert a new item into the list at a particular position, then it should be constructed without a parent widget. The <a href="qlistwidget.html#insertItem">insertItem</a>() function should then be used to place it within the list. The list widget will take ownership of the item.</p>
<pre class="cpp"> <span class="type"><a href="qlistwidgetitem.html">QListWidgetItem</a></span> <span class="operator">*</span>newItem <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qlistwidgetitem.html">QListWidgetItem</a></span>;
newItem<span class="operator">-</span><span class="operator">></span>setText(itemText);
listWidget<span class="operator">-</span><span class="operator">></span>insertItem(row<span class="operator">,</span> newItem);</pre>
<p>For multiple items, <a href="qlistwidget.html#insertItems">insertItems</a>() can be used instead. The number of items in the list is found with the <a href="qlistwidget.html#count-prop">count</a>() function. To remove items from the list, use <a href="qlistwidget.html#takeItem">takeItem</a>().</p>
<p>The current item in the list can be found with <a href="qlistwidget.html#currentItem">currentItem</a>(), and changed with <a href="qlistwidget.html#setCurrentItem">setCurrentItem</a>(). The user can also change the current item by navigating with the keyboard or clicking on a different item. When the current item changes, the <a href="qlistwidget.html#currentItemChanged">currentItemChanged</a>() signal is emitted with the new current item and the item that was previously current.</p>
<table class="generic" width="100%">
<tr valign="top" class="odd"><td ><img src="images/windowsxp-listview.png" alt="Screenshot of a Windows XP style list widget" /></td><td ><img src="images/macintosh-listview.png" alt="Screenshot of a Macintosh style table widget" /></td><td ><img src="images/plastique-listview.png" alt="Screenshot of a Plastique style table widget" /></td></tr>
<tr valign="top" class="even"><td >A <a href="gallery-windowsxp.html">Windows XP style</a> list widget.</td><td >A <a href="gallery-macintosh.html">Macintosh style</a> list widget.</td><td >A <a href="gallery-plastique.html">Plastique style</a> list widget.</td></tr>
</table>
</div>
<p><b>See also </b><a href="qlistwidgetitem.html">QListWidgetItem</a>, <a href="qlistview.html">QListView</a>, <a href="qtreeview.html">QTreeView</a>, <a href="model-view-programming.html">Model/View Programming</a>, and <a href="dialogs-configdialog.html">Config Dialog Example</a>.</p>
<!-- @@@QListWidget -->
<div class="prop">
<h2>Property Documentation</h2>
<!-- $$$count-prop$$$count -->
<h3 class="fn"><a name="count-prop"></a><span class="name">count</span> : const <span class="type">int</span></h3>
<p>This property holds the number of items in the list including any hidden items.</p>
<p><b>Access functions:</b></p>
<table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> int </td><td class="memItemRight bottomAlign"><span class="name"><b>count</b></span> () const</td></tr>
</table>
<!-- @@@count -->
<!-- $$$currentRow-prop$$$currentRow$$$setCurrentRowint$$$setCurrentRowintQItemSelectionModel::SelectionFlags$$$currentRowChangedint -->
<h3 class="fn"><a name="currentRow-prop"></a><span class="name">currentRow</span> : <span class="type">int</span></h3>
<p>This property holds the row of the current item.</p>
<p>Depending on the current selection mode, the row may also be selected.</p>
<p><b>Access functions:</b></p>
<table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> int </td><td class="memItemRight bottomAlign"><span class="name"><b>currentRow</b></span> () const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setCurrentRow</b></span> ( int <i>row</i> )</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setCurrentRow</b></span> ( int <i>row</i>, QItemSelectionModel::SelectionFlags <i>command</i> )</td></tr>
</table>
<p><b>Notifier signal:</b></p>
<table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b><a href="qlistwidget.html#currentRowChanged">currentRowChanged</a></b></span> ( int <i>currentRow</i> )</td></tr>
</table>
<!-- @@@currentRow -->
<!-- $$$sortingEnabled-prop$$$isSortingEnabled$$$setSortingEnabledbool -->
<h3 class="fn"><a name="sortingEnabled-prop"></a><span class="name">sortingEnabled</span> : <span class="type">bool</span></h3>
<p>This property holds whether sorting is enabled.</p>
<p>If this property is true, sorting is enabled for the list; if the property is false, sorting is not enabled.</p>
<p>The default value is false.</p>
<p>This property was introduced in Qt 4.2.</p>
<p><b>Access functions:</b></p>
<table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> bool </td><td class="memItemRight bottomAlign"><span class="name"><b>isSortingEnabled</b></span> () const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setSortingEnabled</b></span> ( bool <i>enable</i> )</td></tr>
</table>
<!-- @@@sortingEnabled -->
</div>
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QListWidget[overload1]$$$QListWidgetQWidget* -->
<h3 class="fn"><a name="QListWidget"></a>QListWidget::<span class="name">QListWidget</span> ( <span class="type"><a href="qwidget.html">QWidget</a></span> * <i>parent</i> = 0 )</h3>
<p>Constructs an empty <a href="qlistwidget.html">QListWidget</a> with the given <i>parent</i>.</p>
<!-- @@@QListWidget -->
<!-- $$$~QListWidget[overload1]$$$~QListWidget -->
<h3 class="fn"><a name="dtor.QListWidget"></a>QListWidget::<span class="name">~QListWidget</span> ()</h3>
<p>Destroys the list widget and all its items.</p>
<!-- @@@~QListWidget -->
<!-- $$$addItem[overload1]$$$addItemconstQString& -->
<h3 class="fn"><a name="addItem"></a><span class="type">void</span> QListWidget::<span class="name">addItem</span> ( const <span class="type"><a href="qstring.html">QString</a></span> & <i>label</i> )</h3>
<p>Inserts an item with the text <i>label</i> at the end of the list widget.</p>
<!-- @@@addItem -->
<!-- $$$addItem$$$addItemQListWidgetItem* -->
<h3 class="fn"><a name="addItem-2"></a><span class="type">void</span> QListWidget::<span class="name">addItem</span> ( <span class="type"><a href="qlistwidgetitem.html">QListWidgetItem</a></span> * <i>item</i> )</h3>
<p>Inserts the <i>item</i> at the end of the list widget.</p>
<p><b>Warning:</b> A <a href="qlistwidgetitem.html">QListWidgetItem</a> can only be added to a <a href="qlistwidget.html">QListWidget</a> once. Adding the same <a href="qlistwidgetitem.html">QListWidgetItem</a> multiple times to a <a href="qlistwidget.html">QListWidget</a> will result in undefined behavior.</p>
<p><b>See also </b><a href="qlistwidget.html#insertItem">insertItem</a>().</p>
<!-- @@@addItem -->
<!-- $$$addItems[overload1]$$$addItemsconstQStringList& -->
<h3 class="fn"><a name="addItems"></a><span class="type">void</span> QListWidget::<span class="name">addItems</span> ( const <span class="type"><a href="qstringlist.html">QStringList</a></span> & <i>labels</i> )</h3>
<p>Inserts items with the text <i>labels</i> at the end of the list widget.</p>
<p><b>See also </b><a href="qlistwidget.html#insertItems">insertItems</a>().</p>
<!-- @@@addItems -->
<!-- $$$clear[overload1]$$$clear -->
<h3 class="fn"><a name="clear"></a><span class="type">void</span> QListWidget::<span class="name">clear</span> ()<tt> [slot]</tt></h3>
<p>Removes all items and selections in the view.</p>
<p><b>Warning:</b> All items will be permanently deleted.</p>
<!-- @@@clear -->
<!-- $$$closePersistentEditor[overload1]$$$closePersistentEditorQListWidgetItem* -->
<h3 class="fn"><a name="closePersistentEditor"></a><span class="type">void</span> QListWidget::<span class="name">closePersistentEditor</span> ( <span class="type"><a href="qlistwidgetitem.html">QListWidgetItem</a></span> * <i>item</i> )</h3>
<p>Closes the persistent editor for the given <i>item</i>.</p>
<p><b>See also </b><a href="qlistwidget.html#openPersistentEditor">openPersistentEditor</a>().</p>
<!-- @@@closePersistentEditor -->
<!-- $$$currentItem[overload1]$$$currentItem -->
<h3 class="fn"><a name="currentItem"></a><span class="type"><a href="qlistwidgetitem.html">QListWidgetItem</a></span> * QListWidget::<span class="name">currentItem</span> () const</h3>
<p>Returns the current item.</p>
<p><b>See also </b><a href="qlistwidget.html#setCurrentItem">setCurrentItem</a>().</p>
<!-- @@@currentItem -->
<!-- $$$currentItemChanged[overload1]$$$currentItemChangedQListWidgetItem*QListWidgetItem* -->
<h3 class="fn"><a name="currentItemChanged"></a><span class="type">void</span> QListWidget::<span class="name">currentItemChanged</span> ( <span class="type"><a href="qlistwidgetitem.html">QListWidgetItem</a></span> * <i>current</i>, <span class="type"><a href="qlistwidgetitem.html">QListWidgetItem</a></span> * <i>previous</i> )<tt> [signal]</tt></h3>
<p>This signal is emitted whenever the current item changes.</p>
<p><i>previous</i> is the item that previously had the focus; <i>current</i> is the new current item.</p>
<!-- @@@currentItemChanged -->
<!-- $$$currentRowChanged[overload1]$$$currentRowChangedint -->
<h3 class="fn"><a name="currentRowChanged"></a><span class="type">void</span> QListWidget::<span class="name">currentRowChanged</span> ( <span class="type">int</span> <i>currentRow</i> )<tt> [signal]</tt></h3>
<p>This signal is emitted whenever the current item changes.</p>
<p><i>currentRow</i> is the row of the current item. If there is no current item, the <i>currentRow</i> is -1.</p>
<!-- @@@currentRowChanged -->
<!-- $$$currentTextChanged[overload1]$$$currentTextChangedconstQString& -->
<h3 class="fn"><a name="currentTextChanged"></a><span class="type">void</span> QListWidget::<span class="name">currentTextChanged</span> ( const <span class="type"><a href="qstring.html">QString</a></span> & <i>currentText</i> )<tt> [signal]</tt></h3>
<p>This signal is emitted whenever the current item changes.</p>
<p><i>currentText</i> is the text data in the current item. If there is no current item, the <i>currentText</i> is invalid.</p>
<!-- @@@currentTextChanged -->
<!-- $$$dropEvent[overload1]$$$dropEventQDropEvent* -->
<h3 class="fn"><a name="dropEvent"></a><span class="type">void</span> QListWidget::<span class="name">dropEvent</span> ( <span class="type"><a href="qdropevent.html">QDropEvent</a></span> * <i>event</i> )<tt> [virtual]</tt></h3>
<p>Reimplemented from <a href="qwidget.html#dropEvent">QWidget::dropEvent</a>().</p>
<!-- @@@dropEvent -->
<!-- $$$dropMimeData[overload1]$$$dropMimeDataintconstQMimeData*Qt::DropAction -->
<h3 class="fn"><a name="dropMimeData"></a><span class="type">bool</span> QListWidget::<span class="name">dropMimeData</span> ( <span class="type">int</span> <i>index</i>, const <span class="type"><a href="qmimedata.html">QMimeData</a></span> * <i>data</i>, <span class="type"><a href="qt.html#DropAction-enum">Qt::DropAction</a></span> <i>action</i> )<tt> [virtual protected]</tt></h3>
<p>Handles <i>data</i> supplied by an external drag and drop operation that ended with the given <i>action</i> in the given <i>index</i>. Returns true if <i>data</i> and <i>action</i> can be handled by the model; otherwise returns false.</p>
<p><b>See also </b><a href="qlistwidget.html#supportedDropActions">supportedDropActions</a>().</p>
<!-- @@@dropMimeData -->
<!-- $$$editItem[overload1]$$$editItemQListWidgetItem* -->
<h3 class="fn"><a name="editItem"></a><span class="type">void</span> QListWidget::<span class="name">editItem</span> ( <span class="type"><a href="qlistwidgetitem.html">QListWidgetItem</a></span> * <i>item</i> )</h3>
<p>Starts editing the <i>item</i> if it is editable.</p>
<!-- @@@editItem -->
<!-- $$$event[overload1]$$$eventQEvent* -->
<h3 class="fn"><a name="event"></a><span class="type">bool</span> QListWidget::<span class="name">event</span> ( <span class="type"><a href="qevent.html">QEvent</a></span> * <i>e</i> )<tt> [virtual protected]</tt></h3>
<p>Reimplemented from <a href="qobject.html#event">QObject::event</a>().</p>
<!-- @@@event -->
<!-- $$$findItems[overload1]$$$findItemsconstQString&Qt::MatchFlags -->
<h3 class="fn"><a name="findItems"></a><span class="type"><a href="qlist.html">QList</a></span><<span class="type"><a href="qlistwidgetitem.html">QListWidgetItem</a></span> *> QListWidget::<span class="name">findItems</span> ( const <span class="type"><a href="qstring.html">QString</a></span> & <i>text</i>, <span class="type"><a href="qt.html#MatchFlag-enum">Qt::MatchFlags</a></span> <i>flags</i> ) const</h3>
<p>Finds items with the text that matches the string <i>text</i> using the given <i>flags</i>.</p>
<!-- @@@findItems -->
<!-- $$$indexFromItem[overload1]$$$indexFromItemQListWidgetItem* -->
<h3 class="fn"><a name="indexFromItem"></a><span class="type"><a href="qmodelindex.html">QModelIndex</a></span> QListWidget::<span class="name">indexFromItem</span> ( <span class="type"><a href="qlistwidgetitem.html">QListWidgetItem</a></span> * <i>item</i> ) const<tt> [protected]</tt></h3>
<p>Returns the <a href="qmodelindex.html">QModelIndex</a> assocated with the given <i>item</i>.</p>
<!-- @@@indexFromItem -->
<!-- $$$insertItem[overload1]$$$insertItemintQListWidgetItem* -->
<h3 class="fn"><a name="insertItem"></a><span class="type">void</span> QListWidget::<span class="name">insertItem</span> ( <span class="type">int</span> <i>row</i>, <span class="type"><a href="qlistwidgetitem.html">QListWidgetItem</a></span> * <i>item</i> )</h3>
<p>Inserts the <i>item</i> at the position in the list given by <i>row</i>.</p>
<p><b>See also </b><a href="qlistwidget.html#addItem">addItem</a>().</p>
<!-- @@@insertItem -->
<!-- $$$insertItem$$$insertItemintconstQString& -->
<h3 class="fn"><a name="insertItem-2"></a><span class="type">void</span> QListWidget::<span class="name">insertItem</span> ( <span class="type">int</span> <i>row</i>, const <span class="type"><a href="qstring.html">QString</a></span> & <i>label</i> )</h3>
<p>Inserts an item with the text <i>label</i> in the list widget at the position given by <i>row</i>.</p>
<p><b>See also </b><a href="qlistwidget.html#addItem">addItem</a>().</p>
<!-- @@@insertItem -->
<!-- $$$insertItems[overload1]$$$insertItemsintconstQStringList& -->
<h3 class="fn"><a name="insertItems"></a><span class="type">void</span> QListWidget::<span class="name">insertItems</span> ( <span class="type">int</span> <i>row</i>, const <span class="type"><a href="qstringlist.html">QStringList</a></span> & <i>labels</i> )</h3>
<p>Inserts items from the list of <i>labels</i> into the list, starting at the given <i>row</i>.</p>
<p><b>See also </b><a href="qlistwidget.html#insertItem">insertItem</a>() and <a href="qlistwidget.html#addItem">addItem</a>().</p>
<!-- @@@insertItems -->
<!-- $$$item[overload1]$$$itemint -->
<h3 class="fn"><a name="item"></a><span class="type"><a href="qlistwidgetitem.html">QListWidgetItem</a></span> * QListWidget::<span class="name">item</span> ( <span class="type">int</span> <i>row</i> ) const</h3>
<p>Returns the item that occupies the given <i>row</i> in the list if one has been set; otherwise returns 0.</p>
<p><b>See also </b><a href="qlistwidget.html#row">row</a>().</p>
<!-- @@@item -->
<!-- $$$itemActivated[overload1]$$$itemActivatedQListWidgetItem* -->
<h3 class="fn"><a name="itemActivated"></a><span class="type">void</span> QListWidget::<span class="name">itemActivated</span> ( <span class="type"><a href="qlistwidgetitem.html">QListWidgetItem</a></span> * <i>item</i> )<tt> [signal]</tt></h3>
<p>This signal is emitted when the <i>item</i> is activated. The <i>item</i> is activated when the user clicks or double clicks on it, depending on the system configuration. It is also activated when the user presses the activation key (on Windows and X11 this is the <b>Return</b> key, on Mac OS X it is <b>Ctrl+0</b>).</p>
<!-- @@@itemActivated -->
<!-- $$$itemAt[overload1]$$$itemAtconstQPoint& -->
<h3 class="fn"><a name="itemAt"></a><span class="type"><a href="qlistwidgetitem.html">QListWidgetItem</a></span> * QListWidget::<span class="name">itemAt</span> ( const <span class="type"><a href="qpoint.html">QPoint</a></span> & <i>p</i> ) const</h3>
<p>Returns a pointer to the item at the coordinates <i>p</i>. The coordinates are relative to the list widget's <a href="qabstractscrollarea.html#viewport">viewport()</a>.</p>
<!-- @@@itemAt -->
<!-- $$$itemAt$$$itemAtintint -->
<h3 class="fn"><a name="itemAt-2"></a><span class="type"><a href="qlistwidgetitem.html">QListWidgetItem</a></span> * QListWidget::<span class="name">itemAt</span> ( <span class="type">int</span> <i>x</i>, <span class="type">int</span> <i>y</i> ) const</h3>
<p>This is an overloaded function.</p>
<p>Returns a pointer to the item at the coordinates (<i>x</i>, <i>y</i>). The coordinates are relative to the list widget's <a href="qabstractscrollarea.html#viewport">viewport()</a>.</p>
<!-- @@@itemAt -->
<!-- $$$itemChanged[overload1]$$$itemChangedQListWidgetItem* -->
<h3 class="fn"><a name="itemChanged"></a><span class="type">void</span> QListWidget::<span class="name">itemChanged</span> ( <span class="type"><a href="qlistwidgetitem.html">QListWidgetItem</a></span> * <i>item</i> )<tt> [signal]</tt></h3>
<p>This signal is emitted whenever the data of <i>item</i> has changed.</p>
<!-- @@@itemChanged -->
<!-- $$$itemClicked[overload1]$$$itemClickedQListWidgetItem* -->
<h3 class="fn"><a name="itemClicked"></a><span class="type">void</span> QListWidget::<span class="name">itemClicked</span> ( <span class="type"><a href="qlistwidgetitem.html">QListWidgetItem</a></span> * <i>item</i> )<tt> [signal]</tt></h3>
<p>This signal is emitted with the specified <i>item</i> when a mouse button is clicked on an item in the widget.</p>
<p><b>See also </b><a href="qlistwidget.html#itemPressed">itemPressed</a>() and <a href="qlistwidget.html#itemDoubleClicked">itemDoubleClicked</a>().</p>
<!-- @@@itemClicked -->
<!-- $$$itemDoubleClicked[overload1]$$$itemDoubleClickedQListWidgetItem* -->
<h3 class="fn"><a name="itemDoubleClicked"></a><span class="type">void</span> QListWidget::<span class="name">itemDoubleClicked</span> ( <span class="type"><a href="qlistwidgetitem.html">QListWidgetItem</a></span> * <i>item</i> )<tt> [signal]</tt></h3>
<p>This signal is emitted with the specified <i>item</i> when a mouse button is double clicked on an item in the widget.</p>
<p><b>See also </b><a href="qlistwidget.html#itemClicked">itemClicked</a>() and <a href="qlistwidget.html#itemPressed">itemPressed</a>().</p>
<!-- @@@itemDoubleClicked -->
<!-- $$$itemEntered[overload1]$$$itemEnteredQListWidgetItem* -->
<h3 class="fn"><a name="itemEntered"></a><span class="type">void</span> QListWidget::<span class="name">itemEntered</span> ( <span class="type"><a href="qlistwidgetitem.html">QListWidgetItem</a></span> * <i>item</i> )<tt> [signal]</tt></h3>
<p>This signal is emitted when the mouse cursor enters an item. The <i>item</i> is the item entered. This signal is only emitted when <a href="qwidget.html#mouseTracking-prop">mouseTracking</a> is turned on, or when a mouse button is pressed while moving into an item.</p>
<p><b>See also </b><a href="qwidget.html#mouseTracking-prop">QWidget::setMouseTracking</a>().</p>
<!-- @@@itemEntered -->
<!-- $$$itemFromIndex[overload1]$$$itemFromIndexconstQModelIndex& -->
<h3 class="fn"><a name="itemFromIndex"></a><span class="type"><a href="qlistwidgetitem.html">QListWidgetItem</a></span> * QListWidget::<span class="name">itemFromIndex</span> ( const <span class="type"><a href="qmodelindex.html">QModelIndex</a></span> & <i>index</i> ) const<tt> [protected]</tt></h3>
<p>Returns a pointer to the <a href="qlistwidgetitem.html">QListWidgetItem</a> assocated with the given <i>index</i>.</p>
<!-- @@@itemFromIndex -->
<!-- $$$itemPressed[overload1]$$$itemPressedQListWidgetItem* -->
<h3 class="fn"><a name="itemPressed"></a><span class="type">void</span> QListWidget::<span class="name">itemPressed</span> ( <span class="type"><a href="qlistwidgetitem.html">QListWidgetItem</a></span> * <i>item</i> )<tt> [signal]</tt></h3>
<p>This signal is emitted with the specified <i>item</i> when a mouse button is pressed on an item in the widget.</p>
<p><b>See also </b><a href="qlistwidget.html#itemClicked">itemClicked</a>() and <a href="qlistwidget.html#itemDoubleClicked">itemDoubleClicked</a>().</p>
<!-- @@@itemPressed -->
<!-- $$$itemSelectionChanged[overload1]$$$itemSelectionChanged -->
<h3 class="fn"><a name="itemSelectionChanged"></a><span class="type">void</span> QListWidget::<span class="name">itemSelectionChanged</span> ()<tt> [signal]</tt></h3>
<p>This signal is emitted whenever the selection changes.</p>
<p><b>See also </b><a href="qlistwidget.html#selectedItems">selectedItems</a>(), <a href="qlistwidgetitem.html#isSelected">QListWidgetItem::isSelected</a>(), and <a href="qlistwidget.html#currentItemChanged">currentItemChanged</a>().</p>
<!-- @@@itemSelectionChanged -->
<!-- $$$itemWidget[overload1]$$$itemWidgetQListWidgetItem* -->
<h3 class="fn"><a name="itemWidget"></a><span class="type"><a href="qwidget.html">QWidget</a></span> * QListWidget::<span class="name">itemWidget</span> ( <span class="type"><a href="qlistwidgetitem.html">QListWidgetItem</a></span> * <i>item</i> ) const</h3>
<p>Returns the widget displayed in the given <i>item</i>.</p>
<p>This function was introduced in Qt 4.1.</p>
<p><b>See also </b><a href="qlistwidget.html#setItemWidget">setItemWidget</a>().</p>
<!-- @@@itemWidget -->
<!-- $$$items[overload1]$$$itemsconstQMimeData* -->
<h3 class="fn"><a name="items"></a><span class="type"><a href="qlist.html">QList</a></span><<span class="type"><a href="qlistwidgetitem.html">QListWidgetItem</a></span> *> QListWidget::<span class="name">items</span> ( const <span class="type"><a href="qmimedata.html">QMimeData</a></span> * <i>data</i> ) const<tt> [protected]</tt></h3>
<p>Returns a list of pointers to the items contained in the <i>data</i> object. If the object was not created by a <a href="qlistwidget.html">QListWidget</a> in the same process, the list is empty.</p>
<!-- @@@items -->
<!-- $$$mimeData[overload1]$$$mimeDataconstQList<QListWidgetItem*> -->
<h3 class="fn"><a name="mimeData"></a><span class="type"><a href="qmimedata.html">QMimeData</a></span> * QListWidget::<span class="name">mimeData</span> ( const <span class="type"><a href="qlist.html">QList</a></span><<span class="type"><a href="qlistwidgetitem.html">QListWidgetItem</a></span> *> <i>items</i> ) const<tt> [virtual protected]</tt></h3>
<p>Returns an object that contains a serialized description of the specified <i>items</i>. The format used to describe the items is obtained from the <a href="qlistwidget.html#mimeTypes">mimeTypes</a>() function.</p>
<p>If the list of items is empty, 0 is returned instead of a serialized empty list.</p>
<!-- @@@mimeData -->
<!-- $$$mimeTypes[overload1]$$$mimeTypes -->
<h3 class="fn"><a name="mimeTypes"></a><span class="type"><a href="qstringlist.html">QStringList</a></span> QListWidget::<span class="name">mimeTypes</span> () const<tt> [virtual protected]</tt></h3>
<p>Returns a list of MIME types that can be used to describe a list of listwidget items.</p>
<p><b>See also </b><a href="qlistwidget.html#mimeData">mimeData</a>().</p>
<!-- @@@mimeTypes -->
<!-- $$$openPersistentEditor[overload1]$$$openPersistentEditorQListWidgetItem* -->
<h3 class="fn"><a name="openPersistentEditor"></a><span class="type">void</span> QListWidget::<span class="name">openPersistentEditor</span> ( <span class="type"><a href="qlistwidgetitem.html">QListWidgetItem</a></span> * <i>item</i> )</h3>
<p>Opens an editor for the given <i>item</i>. The editor remains open after editing.</p>
<p><b>See also </b><a href="qlistwidget.html#closePersistentEditor">closePersistentEditor</a>().</p>
<!-- @@@openPersistentEditor -->
<!-- $$$removeItemWidget[overload1]$$$removeItemWidgetQListWidgetItem* -->
<h3 class="fn"><a name="removeItemWidget"></a><span class="type">void</span> QListWidget::<span class="name">removeItemWidget</span> ( <span class="type"><a href="qlistwidgetitem.html">QListWidgetItem</a></span> * <i>item</i> )</h3>
<p>Removes the widget set on the given <i>item</i>.</p>
<p>This function was introduced in Qt 4.3.</p>
<!-- @@@removeItemWidget -->
<!-- $$$row[overload1]$$$rowconstQListWidgetItem* -->
<h3 class="fn"><a name="row"></a><span class="type">int</span> QListWidget::<span class="name">row</span> ( const <span class="type"><a href="qlistwidgetitem.html">QListWidgetItem</a></span> * <i>item</i> ) const</h3>
<p>Returns the row containing the given <i>item</i>.</p>
<p><b>See also </b><a href="qlistwidget.html#item">item</a>().</p>
<!-- @@@row -->
<!-- $$$scrollToItem[overload1]$$$scrollToItemconstQListWidgetItem*QAbstractItemView::ScrollHint -->
<h3 class="fn"><a name="scrollToItem"></a><span class="type">void</span> QListWidget::<span class="name">scrollToItem</span> ( const <span class="type"><a href="qlistwidgetitem.html">QListWidgetItem</a></span> * <i>item</i>, <span class="type"><a href="qabstractitemview.html#ScrollHint-enum">QAbstractItemView::ScrollHint</a></span> <i>hint</i> = EnsureVisible )<tt> [slot]</tt></h3>
<p>Scrolls the view if necessary to ensure that the <i>item</i> is visible.</p>
<p><i>hint</i> specifies where the <i>item</i> should be located after the operation.</p>
<!-- @@@scrollToItem -->
<!-- $$$selectedItems[overload1]$$$selectedItems -->
<h3 class="fn"><a name="selectedItems"></a><span class="type"><a href="qlist.html">QList</a></span><<span class="type"><a href="qlistwidgetitem.html">QListWidgetItem</a></span> *> QListWidget::<span class="name">selectedItems</span> () const</h3>
<p>Returns a list of all selected items in the list widget.</p>
<!-- @@@selectedItems -->
<!-- $$$setCurrentItem[overload1]$$$setCurrentItemQListWidgetItem* -->
<h3 class="fn"><a name="setCurrentItem"></a><span class="type">void</span> QListWidget::<span class="name">setCurrentItem</span> ( <span class="type"><a href="qlistwidgetitem.html">QListWidgetItem</a></span> * <i>item</i> )</h3>
<p>Sets the current item to <i>item</i>.</p>
<p>Unless the selection mode is <a href="qabstractitemview.html#SelectionMode-enum">NoSelection</a>, the item is also be selected.</p>
<p><b>See also </b><a href="qlistwidget.html#currentItem">currentItem</a>().</p>
<!-- @@@setCurrentItem -->
<!-- $$$setCurrentItem$$$setCurrentItemQListWidgetItem*QItemSelectionModel::SelectionFlags -->
<h3 class="fn"><a name="setCurrentItem-2"></a><span class="type">void</span> QListWidget::<span class="name">setCurrentItem</span> ( <span class="type"><a href="qlistwidgetitem.html">QListWidgetItem</a></span> * <i>item</i>, <span class="type"><a href="qitemselectionmodel.html#SelectionFlag-enum">QItemSelectionModel::SelectionFlags</a></span> <i>command</i> )</h3>
<p>Set the current item to <i>item</i>, using the given <i>command</i>.</p>
<p>This function was introduced in Qt 4.4.</p>
<!-- @@@setCurrentItem -->
<!-- $$$setItemWidget[overload1]$$$setItemWidgetQListWidgetItem*QWidget* -->
<h3 class="fn"><a name="setItemWidget"></a><span class="type">void</span> QListWidget::<span class="name">setItemWidget</span> ( <span class="type"><a href="qlistwidgetitem.html">QListWidgetItem</a></span> * <i>item</i>, <span class="type"><a href="qwidget.html">QWidget</a></span> * <i>widget</i> )</h3>
<p>Sets the <i>widget</i> to be displayed in the give <i>item</i>.</p>
<p>This function should only be used to display static content in the place of a list widget item. If you want to display custom dynamic content or implement a custom editor widget, use <a href="qlistview.html">QListView</a> and subclass <a href="qitemdelegate.html">QItemDelegate</a> instead.</p>
<p>This function was introduced in Qt 4.1.</p>
<p><b>See also </b><a href="qlistwidget.html#itemWidget">itemWidget</a>() and <a href="model-view-programming.html#delegate-classes">Delegate Classes</a>.</p>
<!-- @@@setItemWidget -->
<!-- $$$sortItems[overload1]$$$sortItemsQt::SortOrder -->
<h3 class="fn"><a name="sortItems"></a><span class="type">void</span> QListWidget::<span class="name">sortItems</span> ( <span class="type"><a href="qt.html#SortOrder-enum">Qt::SortOrder</a></span> <i>order</i> = Qt::AscendingOrder )</h3>
<p>Sorts all the items in the list widget according to the specified <i>order</i>.</p>
<!-- @@@sortItems -->
<!-- $$$supportedDropActions[overload1]$$$supportedDropActions -->
<h3 class="fn"><a name="supportedDropActions"></a><span class="type"><a href="qt.html#DropAction-enum">Qt::DropActions</a></span> QListWidget::<span class="name">supportedDropActions</span> () const<tt> [virtual protected]</tt></h3>
<p>Returns the drop actions supported by this view.</p>
<p><b>See also </b><a href="qt.html#DropAction-enum">Qt::DropActions</a>.</p>
<!-- @@@supportedDropActions -->
<!-- $$$takeItem[overload1]$$$takeItemint -->
<h3 class="fn"><a name="takeItem"></a><span class="type"><a href="qlistwidgetitem.html">QListWidgetItem</a></span> * QListWidget::<span class="name">takeItem</span> ( <span class="type">int</span> <i>row</i> )</h3>
<p>Removes and returns the item from the given <i>row</i> in the list widget; otherwise returns 0.</p>
<p>Items removed from a list widget will not be managed by Qt, and will need to be deleted manually.</p>
<p><b>See also </b><a href="qlistwidget.html#insertItem">insertItem</a>() and <a href="qlistwidget.html#addItem">addItem</a>().</p>
<!-- @@@takeItem -->
<!-- $$$visualItemRect[overload1]$$$visualItemRectconstQListWidgetItem* -->
<h3 class="fn"><a name="visualItemRect"></a><span class="type"><a href="qrect.html">QRect</a></span> QListWidget::<span class="name">visualItemRect</span> ( const <span class="type"><a href="qlistwidgetitem.html">QListWidgetItem</a></span> * <i>item</i> ) const</h3>
<p>Returns the rectangle on the viewport occupied by the item at <i>item</i>.</p>
<!-- @@@visualItemRect -->
</div>
<div class="ft">
<span></span>
</div>
</div>
<div class="footer">
<p>
<acronym title="Copyright">©</acronym> 2012 Nokia Corporation and/or its
subsidiaries. Documentation contributions included herein are the copyrights of
their respective owners.</p>
<br />
<p>
The documentation provided herein is licensed under the terms of the
<a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation
License version 1.3</a> as published by the Free Software Foundation.</p>
<p>
Documentation sources may be obtained from <a href="http://www.qt-project.org">
www.qt-project.org</a>.</p>
<br />
<p>
Nokia, Qt and their respective logos are trademarks of Nokia Corporation
in Finland and/or other countries worldwide. All other trademarks are property
of their respective owners. <a title="Privacy Policy"
href="http://en.gitorious.org/privacy_policy/">Privacy Policy</a></p>
</div>
</body>
</html>
|