Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.trolltech.qt.gui
Class QListWidget

    java.lang.Object
      com.trolltech.qt.internal.QSignalEmitterInternal
          com.trolltech.qt.QSignalEmitter
              com.trolltech.qt.QtJambiObject
                  com.trolltech.qt.core.QObject
                      com.trolltech.qt.gui.QWidget
                          com.trolltech.qt.gui.QFrame
                              com.trolltech.qt.gui.QAbstractScrollArea
                                  com.trolltech.qt.gui.QAbstractItemView
                                      com.trolltech.qt.gui.QListView
                                          com.trolltech.qt.gui.QListWidget

All Implemented Interfaces:
  QPaintDeviceInterface, QtJambiInterface

    public class QListWidget

extends QListView

The QListWidget class provides an item-based list widget. QListWidget is a convenience class that provides a list view similar to the one supplied by `QListView`, but with a classic item-based interface for adding and removing items. QListWidget uses an internal model to manage each `QListWidgetItem` in the list.

For a more flexible list view widget, use the `QListView` class with a standard model.

List widgets are constructed in the same way as other widgets:

            QListWidget listWidget = new QListWidget(this);

The selectionMode() 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 setSelectionMode() function.

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:

            new QListWidgetItem(tr("Oak"), listWidget);
            new QListWidgetItem(tr("Fir"), listWidget);
            new QListWidgetItem(tr("Pine"), listWidget);

If you need to insert a new item into the list at a particular position, it is more required to construct the item without a parent widget and use the `insertItem()` function to place it within the list. The list widget will take ownership of the item.

            QListWidgetItem newItem = new QListWidgetItem();
            newItem.setText(itemText);

            listWidget.insertItem(row, newItem);

For multiple items, `insertItems()` can be used instead. The number of items in the list is found with the `count()` function. To remove items from the list, use `takeItem()`.

The current item in the list can be found with `currentItem()`, and changed with `setCurrentItem()`. 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 `currentItemChanged()` signal is emitted with the new current item and the item that was previously current.

A Windows XP style list widget. | A Macintosh style list widget. | A Plastique style list widget.

See also:
  `QListWidgetItem`, `QListView`, `QTreeView`, Model/View Programming, and Config Dialog Example.

Nested Class Summary

Nested classes/interfaces inherited from class com.trolltech.qt.gui.QListView
`QListView.Flow, QListView.LayoutMode, QListView.Movement, QListView.ResizeMode, QListView.ViewMode`

Nested classes/interfaces inherited from class com.trolltech.qt.gui.QAbstractItemView
`QAbstractItemView.CursorAction, QAbstractItemView.DragDropMode, QAbstractItemView.DropIndicatorPosition, QAbstractItemView.EditTrigger, QAbstractItemView.EditTriggers, QAbstractItemView.ScrollHint, QAbstractItemView.ScrollMode, QAbstractItemView.SelectionBehavior, QAbstractItemView.SelectionMode, QAbstractItemView.State`

Nested classes/interfaces inherited from class com.trolltech.qt.gui.QFrame
`QFrame.Shadow, QFrame.Shape, QFrame.StyleMask`

Nested classes/interfaces inherited from class com.trolltech.qt.gui.QWidget
`QWidget.RenderFlag, QWidget.RenderFlags`

Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter
`QSignalEmitter.AbstractSignal, QSignalEmitter.Signal0, QSignalEmitter.Signal1, QSignalEmitter.Signal2, QSignalEmitter.Signal3, QSignalEmitter.Signal4, QSignalEmitter.Signal5, QSignalEmitter.Signal6, QSignalEmitter.Signal7, QSignalEmitter.Signal8, QSignalEmitter.Signal9`

Nested classes/interfaces inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
`com.trolltech.qt.internal.QSignalEmitterInternal.AbstractSignalInternal`

Field Summary
`QSignalEmitter.Signal2` | `currentItemChanged` This signal takes 2 generic argument(s).
`QSignalEmitter.Signal1` | `currentRowChanged` This signal takes 1 generic argument(s).
`QSignalEmitter.Signal1` | `currentTextChanged` This signal takes 1 generic argument(s).
`QSignalEmitter.Signal1` | `itemActivated` This signal takes 1 generic argument(s).
`QSignalEmitter.Signal1` | `itemChanged` This signal takes 1 generic argument(s).
`QSignalEmitter.Signal1` | `itemClicked` This signal takes 1 generic argument(s).
`QSignalEmitter.Signal1` | `itemDoubleClicked` This signal takes 1 generic argument(s).
`QSignalEmitter.Signal1` | `itemEntered` This signal takes 1 generic argument(s).
`QSignalEmitter.Signal1` | `itemPressed` This signal takes 1 generic argument(s).
`QSignalEmitter.Signal0` | `itemSelectionChanged` This signal is emitted whenever the selection changes.

Fields inherited from class com.trolltech.qt.gui.QListView
`indexesMoved`

Fields inherited from class com.trolltech.qt.gui.QAbstractItemView
`activated, clicked, doubleClicked, entered, pressed, viewportEntered`

Fields inherited from class com.trolltech.qt.gui.QWidget
`customContextMenuRequested`

Fields inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
`currentSender`

Constructor Summary
`QListWidget()` Constructs an empty QListWidget with the given `parent`.
`QListWidget(QWidget parent)` Constructs an empty QListWidget with the given `parent`.

Method Summary
`void` | `addItem(QListWidgetItem item)` Inserts the `item` at the the end of the list widget.
`void` | `addItem(java.lang.String label)` Inserts an item with the text label at the end of the list widget.
`void` | `addItems(java.util.List labels)` Inserts items with the text labels at the end of the list widget.
`void` | `clear()` Removes all items and selections in the view.
`void` | `closePersistentEditor(QListWidgetItem item)` Closes the persistent editor for the given `item`.
`int` | `count()` This property holds the number of items in the list including any hidden items.
`QListWidgetItem` | `currentItem()` Returns the current item.
`int` | `currentRow()` This property holds the row of the current item.
`protected boolean` | `dropMimeData(int index, QMimeData data, Qt.DropAction action)` Handles the `data` supplied by an external drag and drop operation that ended with the given `action` in the given `index`.
`void` | `editItem(QListWidgetItem item)` Starts editing the `item` if it is editable.
`java.util.List` | `findItems(java.lang.String text, Qt.MatchFlag[] flags)`
`java.util.List` | `findItems(java.lang.String text, Qt.MatchFlags flags)` Finds items with the text that matches the string `text` using the given `flags`.
`protected com.trolltech.qt.core.QModelIndex` | `indexFromItem(QListWidgetItem item)` Returns the QModelIndex assocated with the given `item`.
`void` | `insertItem(int row, QListWidgetItem item)` Inserts the `item` at the position in the list given by `row`.
`void` | `insertItem(int row, java.lang.String label)` This is an overloaded member function, provided for convenience.
`void` | `insertItems(int row, java.util.List labels)` Inserts items from the list of labels into the list, starting at the given row.
`boolean` | `isSortingEnabled()` This property holds whether sorting is enabled.
`QListWidgetItem` | `item(int row)` Returns the item that occupies the given `row` in the list if one has been set; otherwise returns 0.
`QListWidgetItem` | `itemAt(int x, int y)` Returns a pointer to the item at the coordinates (`x`, `y`).
`QListWidgetItem` | `itemAt(QPoint p)` Returns a pointer to the item at the coordinates `p`.
`protected QListWidgetItem` | `itemFromIndex(com.trolltech.qt.core.QModelIndex index)` Returns a pointer to the `QListWidgetItem` assocated with the given `index`.
`protected java.util.List` | `items(QMimeData data)` Returns a list of pointers to the items contained in the `data` object.
`QWidget` | `itemWidget(QListWidgetItem item)` Returns the widget displayed in the given `item`.
`protected QMimeData` | `mimeData(java.util.List items)` Returns an object that contains a serialized description of the specified `items`.
`protected java.util.List` | `mimeTypes()` Returns a list of MIME types that can be used to describe a list of listwidget items.
`void` | `openPersistentEditor(QListWidgetItem item)` Opens an editor for the given `item`.
`void` | `removeItemWidget(QListWidgetItem item)` Removes the widget set on the given `item`.
`int` | `row(QListWidgetItem item)` Returns the row containing the given `item`.
`void` | `scrollToItem(QListWidgetItem item)` Scrolls the view if necessary to ensure that the `item` is visible.
`void` | `scrollToItem(QListWidgetItem item, QAbstractItemView.ScrollHint hint)` Scrolls the view if necessary to ensure that the `item` is visible.
`java.util.List` | `selectedItems()` Returns a list of all selected items in the list widget.
`void` | `setCurrentItem(QListWidgetItem item)` Sets the current item to `item`.
`void` | `setCurrentItem(QListWidgetItem item, QItemSelectionModel.SelectionFlag[] command)`
`void` | `setCurrentItem(QListWidgetItem item, QItemSelectionModel.SelectionFlags command)` Set the current item to `item`, using the given `command`.
`void` | `setCurrentRow(int row)` This property holds the row of the current item.
`void` | `setCurrentRow(int row, QItemSelectionModel.SelectionFlag[] command)`
`void` | `setCurrentRow(int row, QItemSelectionModel.SelectionFlags command)` This property holds the row of the current item.
`void` | `setItemWidget(QListWidgetItem item, QWidget widget)` Sets the `widget` to be displayed in the give `item`.
`void` | `setSortingEnabled(boolean enable)` This property holds whether sorting is enabled.
`void` | `sortItems()` Sorts all the items in the list widget according to the specified `order`.
`void` | `sortItems(Qt.SortOrder order)` Sorts all the items in the list widget according to the specified `order`.
`protected Qt.DropActions` | `supportedDropActions()` Returns the drop actions supported by this view.
`QListWidgetItem` | `takeItem(int row)` Removes and returns the item from the given `row` in the list widget; otherwise returns 0.
`QRect` | `visualItemRect(QListWidgetItem item)` Returns the rectangle on the viewport occupied by the item at `item`.

Methods inherited from class com.trolltech.qt.gui.QListView
`batchSize, clearPropertyFlags, flow, gridSize, internalDrag, isRowHidden, isSelectionRectVisible, isWrapping, layoutMode, modelColumn, movement, rectForIndex, resizeMode, setBatchSize, setFlow, setGridSize, setLayoutMode, setModelColumn, setMovement, setPositionForIndex, setResizeMode, setRowHidden, setSelectionRectVisible, setSpacing, setUniformItemSizes, setViewMode, setWordWrap, setWrapping, spacing, uniformItemSizes, viewMode, wordWrap`

Methods inherited from class com.trolltech.qt.gui.QAbstractItemView
`alternatingRowColors, autoScrollMargin, clearSelection, closeEditor, closePersistentEditor, commitData, currentChanged, currentIndex, dataChanged, dirtyRegionOffset, dragDropMode, dragDropOverwriteMode, dragEnabled, dropIndicatorPosition, edit, edit, editorDestroyed, editTriggers, executeDelayedItemsLayout, hasAutoScroll, horizontalOffset, horizontalScrollMode, iconSize, indexAt, indexWidget, isIndexHidden, itemDelegate, itemDelegate, itemDelegateForColumn, itemDelegateForRow, keyboardSearch, model, moveCursor, openPersistentEditor, reset, rootIndex, rowsAboutToBeRemoved, rowsInserted, scheduleDelayedItemsLayout, scrollDirtyRegion, scrollTo, scrollTo, scrollToBottom, scrollToTop, selectAll, selectedIndexes, selectionBehavior, selectionChanged, selectionCommand, selectionCommand, selectionMode, selectionModel, setAlternatingRowColors, setAutoScroll, setAutoScrollMargin, setCurrentIndex, setDirtyRegion, setDragDropMode, setDragDropOverwriteMode, setDragEnabled, setDropIndicatorShown, setEditTriggers, setEditTriggers, setHorizontalScrollMode, setIconSize, setIndexWidget, setItemDelegate, setItemDelegateForColumn, setItemDelegateForRow, setModel, setRootIndex, setSelection, setSelectionBehavior, setSelectionMode, setSelectionModel, setState, setTabKeyNavigation, setTextElideMode, setVerticalScrollMode, showDropIndicator, sizeHintForColumn, sizeHintForIndex, sizeHintForRow, startDrag, startDrag, state, tabKeyNavigation, textElideMode, update, updateGeometries, verticalOffset, verticalScrollMode, viewOptions, visualRect, visualRegionForSelection`

Methods inherited from class com.trolltech.qt.gui.QAbstractScrollArea
`addScrollBarWidget, addScrollBarWidget, cornerWidget, horizontalScrollBar, horizontalScrollBarPolicy, maximumViewportSize, scrollBarWidgets, scrollBarWidgets, scrollContentsBy, setCornerWidget, setHorizontalScrollBar, setHorizontalScrollBarPolicy, setupViewport, setVerticalScrollBar, setVerticalScrollBarPolicy, setViewport, setViewportMargins, verticalScrollBar, verticalScrollBarPolicy, viewport, viewportEvent`

Methods inherited from class com.trolltech.qt.gui.QFrame
`frameRect, frameShadow, frameShape, frameStyle, frameWidth, lineWidth, midLineWidth, setFrameRect, setFrameShadow, setFrameShape, setFrameStyle, setLineWidth, setMidLineWidth`

Methods inherited from class com.trolltech.qt.gui.QWidget
`acceptDrops, accessibleDescription, accessibleName, actionEvent, actions, activateWindow, addAction, addActions, adjustSize, autoFillBackground, backgroundRole, baseSize, changeEvent, childAt, childAt, childrenRect, childrenRegion, clearFocus, clearMask, close, closeEvent, contentsRect, contextMenuEvent, contextMenuPolicy, cursor, depth, destroy, destroy, destroy, dragEnterEvent, dragLeaveEvent, dragMoveEvent, dropEvent, effectiveWinId, ensurePolished, enterEvent, focusInEvent, focusNextChild, focusNextPrevChild, focusOutEvent, focusPolicy, focusPreviousChild, focusProxy, focusWidget, font, fontInfo, fontMetrics, foregroundRole, frameGeometry, frameSize, geometry, getContentsMargins, grabKeyboard, grabMouse, grabMouse, grabShortcut, grabShortcut, hasFocus, hasMouseTracking, height, heightForWidth, heightMM, hide, hideEvent, inputContext, inputMethodEvent, inputMethodQuery, insertAction, insertActions, isActiveWindow, isAncestorOf, isEnabled, isEnabledTo, isFullScreen, isHidden, isMaximized, isMinimized, isModal, isVisible, isVisibleTo, isWindow, isWindowModified, keyboardGrabber, keyPressEvent, keyReleaseEvent, languageChange, layout, layoutDirection, leaveEvent, locale, logicalDpiX, logicalDpiY, lower, mapFrom, mapFromGlobal, mapFromParent, mapTo, mapToGlobal, mapToParent, mask, maximumHeight, maximumSize, maximumWidth, metric, minimumHeight, minimumSize, minimumSizeHint, minimumWidth, mouseDoubleClickEvent, mouseGrabber, mouseMoveEvent, mousePressEvent, mouseReleaseEvent, move, move, moveEvent, nativeParentWidget, nextInFocusChain, normalGeometry, numColors, overrideWindowFlags, overrideWindowFlags, overrideWindowState, paintEngine, paintEvent, paintingActive, palette, parentWidget, physicalDpiX, physicalDpiY, pos, raise, rect, releaseKeyboard, releaseMouse, releaseShortcut, removeAction, render, render, render, render, render, render, render, render, render, repaint, repaint, repaint, repaint, resetInputContext, resize, resize, resizeEvent, restoreGeometry, saveGeometry, scroll, scroll, setAcceptDrops, setAccessibleDescription, setAccessibleName, setAttribute, setAttribute, setAutoFillBackground, setBackgroundRole, setBaseSize, setBaseSize, setContentsMargins, setContentsMargins, setContextMenuPolicy, setCursor, setDisabled, setEnabled, setFixedHeight, setFixedSize, setFixedSize, setFixedWidth, setFocus, setFocus, setFocusPolicy, setFocusProxy, setFont, setForegroundRole, setGeometry, setGeometry, setHidden, setInputContext, setLayout, setLayoutDirection, setLocale, setMask, setMask, setMaximumHeight, setMaximumSize, setMaximumSize, setMaximumWidth, setMinimumHeight, setMinimumSize, setMinimumSize, setMinimumWidth, setMouseTracking, setPalette, setParent, setParent, setParent, setShortcutAutoRepeat, setShortcutAutoRepeat, setShortcutEnabled, setShortcutEnabled, setSizeIncrement, setSizeIncrement, setSizePolicy, setSizePolicy, setStatusTip, setStyle, setStyleSheet, setTabOrder, setToolTip, setUpdatesEnabled, setVisible, setWhatsThis, setWindowFilePath, setWindowFlags, setWindowFlags, setWindowIcon, setWindowIconText, setWindowModality, setWindowModified, setWindowOpacity, setWindowRole, setWindowState, setWindowState, setWindowTitle, show, showEvent, showFullScreen, showMaximized, showMinimized, showNormal, size, sizeHint, sizeIncrement, sizePolicy, stackUnder, statusTip, style, styleSheet, tabletEvent, testAttribute, toolTip, underMouse, unsetCursor, unsetLayoutDirection, unsetLocale, update, update, update, update, updateGeometry, updateMicroFocus, updatesEnabled, visibleRegion, whatsThis, wheelEvent, width, widthMM, window, windowFilePath, windowFlags, windowIcon, windowIconText, windowModality, windowOpacity, windowRole, windowState, windowTitle, windowType, winId, x, y`

Methods inherited from class com.trolltech.qt.core.QObject
`childEvent, children, connectSlotsByName, customEvent, disposeLater, dumpObjectInfo, dumpObjectTree, dynamicPropertyNames, event, eventFilter, findChild, findChild, findChild, findChildren, findChildren, findChildren, findChildren, indexOfProperty, installEventFilter, isWidgetType, killTimer, moveToThread, objectName, parent, properties, property, removeEventFilter, setObjectName, setParent, setProperty, startTimer, timerEvent, toString, userProperty`

Methods inherited from class com.trolltech.qt.QtJambiObject
`dispose, disposed, equals, finalize, reassignNativeResources, tr, tr, tr`

Methods inherited from class com.trolltech.qt.QSignalEmitter
`blockSignals, disconnect, disconnect, signalsBlocked, signalSender, thread`

Methods inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
`__qt_signalInitialization`

Methods inherited from class java.lang.Object
`clone, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Methods inherited from interface com.trolltech.qt.QtJambiInterface
`disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership`

Field Detail

### currentItemChanged

    public final QSignalEmitter.Signal2 currentItemChanged

  This signal takes 2 generic argument(s). We list their type and the name they go by in the description of this signal. <com.trolltech.qt.gui.QListWidgetItem(named: current), com.trolltech.qt.gui.QListWidgetItem(named: previous)>:

  This signal is emitted whenever the current item changes. The `previous` item is the item that previously had the focus, `current` is the new current item.

### currentRowChanged

    public final QSignalEmitter.Signal1 currentRowChanged

  This signal takes 1 generic argument(s). We list their type and the name they go by in the description of this signal. <java.lang.Integer(named: currentRow)>:

  This signal is emitted whenever the current item changes. The `currentRow` is the row of the current item. If there is no current item, the `currentRow` is -1.

### currentTextChanged

    public final QSignalEmitter.Signal1 currentTextChanged

  This signal takes 1 generic argument(s). We list their type and the name they go by in the description of this signal. <java.lang.String(named: currentText)>:

  This signal is emitted whenever the current item changes. The `currentText` is the text data in the current item. If there is no current item, the `currentText` is invalid.

### itemActivated

    public final QSignalEmitter.Signal1 itemActivated

  This signal takes 1 generic argument(s). We list their type and the name they go by in the description of this signal. <com.trolltech.qt.gui.QListWidgetItem(named: item)>:

  This signal is emitted when the `item` is activated. The `item` 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 Return key, on Mac OS X it is Ctrl+0).

### itemChanged

    public final QSignalEmitter.Signal1 itemChanged

  This signal takes 1 generic argument(s). We list their type and the name they go by in the description of this signal. <com.trolltech.qt.gui.QListWidgetItem(named: item)>:

  This signal is emitted whenever the data of `item` has changed.

### itemClicked

    public final QSignalEmitter.Signal1 itemClicked

  This signal takes 1 generic argument(s). We list their type and the name they go by in the description of this signal. <com.trolltech.qt.gui.QListWidgetItem(named: item)>:

  This signal is emitted with the specified `item` when a mouse button is clicked on an item in the widget.

See also:
  `itemPressed()` , and `itemDoubleClicked()` .

### itemDoubleClicked

    public final QSignalEmitter.Signal1 itemDoubleClicked

  This signal takes 1 generic argument(s). We list their type and the name they go by in the description of this signal. <com.trolltech.qt.gui.QListWidgetItem(named: item)>:

  This signal is emitted with the specified `item` when a mouse button is double clicked on an item in the widget.

See also:
  `itemClicked()` , and `itemPressed()` .

### itemEntered

    public final QSignalEmitter.Signal1 itemEntered

  This signal takes 1 generic argument(s). We list their type and the name they go by in the description of this signal. <com.trolltech.qt.gui.QListWidgetItem(named: item)>:

  This signal is emitted when the mouse cursor enters an item. The `item` is the item entered. This signal is only emitted when `mouseTracking` is turned on, or when a mouse button is pressed while moving into an item.

### itemPressed

    public final QSignalEmitter.Signal1 itemPressed

  This signal takes 1 generic argument(s). We list their type and the name they go by in the description of this signal. <com.trolltech.qt.gui.QListWidgetItem(named: item)>:

  This signal is emitted with the specified `item` when a mouse button is pressed on an item in the widget.

See also:
  `itemClicked()` , and `itemDoubleClicked()` .

### itemSelectionChanged

    public final QSignalEmitter.Signal0 itemSelectionChanged

  This signal is emitted whenever the selection changes.

See also:
  `selectedItems()`, isItemSelected(), and `currentItemChanged()` .

Constructor Detail

### QListWidget

    public QListWidget()

  Constructs an empty QListWidget with the given `parent`.

### QListWidget

    public QListWidget(QWidget parent)

  Constructs an empty QListWidget with the given `parent`.

Method Detail

### addItem

    public final void addItem(QListWidgetItem item)

  Inserts the `item` at the the end of the list widget.

  Warning: A `QListWidgetItem` can only be added to a QListWidget once. Adding the same `QListWidgetItem` multiple times to a QListWidget will result in undefined behavior.

See also:
  `insertItem()`.

### clear

    public final void clear()

  Removes all items and selections in the view.

  Note: All items will be permanently deleted.

### closePersistentEditor

    public final void closePersistentEditor(QListWidgetItem item)

  Closes the persistent editor for the given `item`.

See also:
  `openPersistentEditor()`.

### count

    public final int count()

  This property holds the number of items in the list including any hidden items.

### currentItem

    public final QListWidgetItem currentItem()

  Returns the current item.

See also:
  `setCurrentItem()`.

### currentRow

    public final int currentRow()

  This property holds the row of the current item. Depending on the current selection mode, the row may also be selected.

### editItem

    public final void editItem(QListWidgetItem item)

  Starts editing the `item` if it is editable.

### findItems

    public final java.util.List findItems(java.lang.String text,
                                          Qt.MatchFlag[] flags)

### findItems

    public final java.util.List findItems(java.lang.String text,
                                          Qt.MatchFlags flags)

  Finds items with the text that matches the string `text` using the given `flags`.

### indexFromItem

    protected final com.trolltech.qt.core.QModelIndex indexFromItem(QListWidgetItem item)

  Returns the QModelIndex assocated with the given `item`.

### insertItem

    public final void insertItem(int row,
                                 QListWidgetItem item)

  Inserts the `item` at the position in the list given by `row`.

See also:
  `addItem()`.

### isSortingEnabled

    public final boolean isSortingEnabled()

  This property holds whether sorting is enabled. If this property is true, sorting is enabled for the list; if the property is false, sorting is not enabled. The default value is false.

### item

    public final QListWidgetItem item(int row)

  Returns the item that occupies the given `row` in the list if one has been set; otherwise returns 0.

See also:
  `row()`.

### itemAt

    public final QListWidgetItem itemAt(QPoint p)

  Returns a pointer to the item at the coordinates `p`.

### itemAt

    public final QListWidgetItem itemAt(int x,
                                        int y)

  Returns a pointer to the item at the coordinates (`x`, `y`).

### itemFromIndex

    protected final QListWidgetItem itemFromIndex(com.trolltech.qt.core.QModelIndex index)

  Returns a pointer to the `QListWidgetItem` assocated with the given `index`.

### itemWidget

    public final QWidget itemWidget(QListWidgetItem item)

  Returns the widget displayed in the given `item`.

See also:
  `setItemWidget()`.

### items

    protected final java.util.List items(QMimeData data)

  Returns a list of pointers to the items contained in the `data` object. If the object was not created by a QListWidget in the same process, the list is empty.

### openPersistentEditor

    public final void openPersistentEditor(QListWidgetItem item)

  Opens an editor for the given `item`. The editor remains open after editing.

See also:
  `closePersistentEditor()`.

### removeItemWidget

    public final void removeItemWidget(QListWidgetItem item)

  Removes the widget set on the given `item`.

### row

    public final int row(QListWidgetItem item)

  Returns the row containing the given `item`.

See also:
  `item()`.

### scrollToItem

    public final void scrollToItem(QListWidgetItem item)

  Scrolls the view if necessary to ensure that the `item` is visible. The `hint` parameter specifies more precisely where the `item` should be located after the operation.

### scrollToItem

    public final void scrollToItem(QListWidgetItem item,
                                   QAbstractItemView.ScrollHint hint)

  Scrolls the view if necessary to ensure that the `item` is visible. The `hint` parameter specifies more precisely where the `item` should be located after the operation.

### selectedItems

    public final java.util.List selectedItems()

  Returns a list of all selected items in the list widget.

### setCurrentItem

    public final void setCurrentItem(QListWidgetItem item)

  Sets the current item to `item`.

  Depending on the current selection mode, the item may also be selected.

See also:
  `currentItem()`.

### setCurrentItem

    public final void setCurrentItem(QListWidgetItem item,
                                     QItemSelectionModel.SelectionFlag[] command)

### setCurrentItem

    public final void setCurrentItem(QListWidgetItem item,
                                     QItemSelectionModel.SelectionFlags command)

  Set the current item to `item`, using the given `command`.

### setCurrentRow

    public final void setCurrentRow(int row)

  This property holds the row of the current item. Depending on the current selection mode, the row may also be selected.

### setCurrentRow

    public final void setCurrentRow(int row,
                                    QItemSelectionModel.SelectionFlag[] command)

### setCurrentRow

    public final void setCurrentRow(int row,
                                    QItemSelectionModel.SelectionFlags command)

  This property holds the row of the current item. Depending on the current selection mode, the row may also be selected.

### setItemWidget

    public final void setItemWidget(QListWidgetItem item,
                                    QWidget widget)

  Sets the `widget` to be displayed in the give `item`.

  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 `QListView` and subclass `QItemDelegate` instead.

See also:
  `itemWidget()`, and Delegate Classes.

### setSortingEnabled

    public final void setSortingEnabled(boolean enable)

  This property holds whether sorting is enabled. If this property is true, sorting is enabled for the list; if the property is false, sorting is not enabled. The default value is false.

### sortItems

    public final void sortItems()

  Sorts all the items in the list widget according to the specified `order`.

### sortItems

    public final void sortItems(Qt.SortOrder order)

  Sorts all the items in the list widget according to the specified `order`.

### takeItem

    public final QListWidgetItem takeItem(int row)

  Removes and returns the item from the given `row` in the list widget; otherwise returns 0.

  Items removed from a list widget will not be managed by Qt, and will need to be deleted manually.

See also:
  `insertItem()`, and `addItem()`.

### visualItemRect

    public final QRect visualItemRect(QListWidgetItem item)

  Returns the rectangle on the viewport occupied by the item at `item`.

### dropMimeData

    protected boolean dropMimeData(int index,
                                   QMimeData data,
                                   Qt.DropAction action)

  Handles the `data` supplied by an external drag and drop operation that ended with the given `action` in the given `index`. Returns true if the data and action can be handled by the model; otherwise returns false.

See also:
  `supportedDropActions()`.

### mimeData

    protected QMimeData mimeData(java.util.List items)

  Returns an object that contains a serialized description of the specified `items`. The format used to describe the items is obtained from the `mimeTypes()` function.

  If the list of items is empty, 0 is returned rather than a serialized empty list.

### mimeTypes

    protected java.util.List mimeTypes()

  Returns a list of MIME types that can be used to describe a list of listwidget items.

See also:
  `mimeData()`.

### supportedDropActions

    protected Qt.DropActions supportedDropActions()

  Returns the drop actions supported by this view.

See also:
  Qt::DropActions.

### addItem

    public final void addItem(java.lang.String label)

  Inserts an item with the text label at the end of the list widget.

  Parameters:
    `label` - The text of the new item.

### addItems

    public final void addItems(java.util.List labels)

  Inserts items with the text labels at the end of the list widget.

  Parameters:
    `labels` - The collection of labels for the new items.

### insertItem

    public final void insertItem(int row,
                                 java.lang.String label)

  This is an overloaded member function, provided for convenience. Inserts an item with the text label in the list widget at the position given by row.

  Parameters:
    `row` - The position in which to insert the new item.
    `label` - The text of the new item.

### insertItems

    public final void insertItems(int row,
                                  java.util.List labels)

  Inserts items from the list of labels into the list, starting at the given row.

  Parameters:
    `row` - The position in which to insert the new items.
    `labels` - The collection of labels for the new items.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD