Logo Search packages:      
Sourcecode: qt4-x11 version File versions  Download package

QList< QListWidgetItem * > QListWidget::selectedItems (  )  const

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

Definition at line 1605 of file qlistwidget.cpp.

References QList< T >::append(), QList< T >::at(), QList< T >::count(), items(), QModelIndex::row(), QItemSelectionModel::selectedIndexes(), and QAbstractItemView::selectionModel().

{
    Q_D(const QListWidget);
    QModelIndexList indexes = selectionModel()->selectedIndexes();
    QList<QListWidgetItem*> items;
    for (int i = 0; i < indexes.count(); ++i)
        items.append(d->model()->at(indexes.at(i).row()));
    return items;
}


Generated by  Doxygen 1.6.0   Back to index