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

void QTreeView::setSelection ( const QRect rect,
QItemSelectionModel::SelectionFlags  command 
) [protected, virtual, inherited]

Applies the selection command to the items in or touched by the rectangle, rect.

See also:

Implements QAbstractItemView.

Definition at line 1194 of file qtreeview.cpp.

References QList< T >::append(), QRect::bottom(), QTreeView::indexAt(), QWidget::isRightToLeft(), QModelIndex::isValid(), QRect::left(), QRect::right(), QItemSelectionModel::select(), QAbstractItemView::selectionBehavior, QAbstractItemView::selectionModel(), and QRect::top().

    if (!selectionModel())

    QPoint tl(isRightToLeft() ? rect.right() : rect.left(), rect.top());
    QPoint br(isRightToLeft() ? rect.left() : rect.right(), rect.bottom());
    QModelIndex topLeft = indexAt(tl);
    QModelIndex bottomRight = indexAt(br);
    if (selectionBehavior() != SelectRows) {
        QItemSelection selection;
        if (topLeft.isValid() && bottomRight.isValid()) {
            selection.append(QItemSelectionRange(topLeft, bottomRight));
            selectionModel()->select(selection, command);
    } else {
        d->select(d->viewIndex(topLeft), d->viewIndex(bottomRight), command);

Generated by  Doxygen 1.6.0   Back to index