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

QList< QTreeWidgetItem * > QTreeWidget::selectedItems (  )  const

Returns a list of all selected non-hidden items.

Definition at line 2253 of file qtreewidget.cpp.

References QList< T >::append(), QList< T >::at(), QList< T >::contains(), QList< T >::count(), QTreeWidgetItem::model, QItemSelectionModel::selectedIndexes(), and QAbstractItemView::selectionModel().

{
    Q_D(const QTreeWidget);
    QModelIndexList indexes = selectionModel()->selectedIndexes();
    QList<QTreeWidgetItem*> items;
    for (int i = 0; i < indexes.count(); ++i) {
        QTreeWidgetItem *item = d->model()->item(indexes.at(i));
        if (!items.contains(item)) // ### slow, optimize later
            items.append(item);
    }
    return items;
}


Generated by  Doxygen 1.6.0   Back to index