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

QRect QTreeView::visualRect ( const QModelIndex index  )  const [virtual, inherited]

Returns the rectangle on the viewport occupied by the item at index. If the index is not visible or explicitly hidden, the returned rectangle is invalid.

Implements QAbstractItemView.

Definition at line 617 of file qtreeview.cpp.

References QModelIndex::column(), QTreeView::columnViewportPosition(), QTreeView::columnWidth(), QTreeView::isIndexHidden(), QModelIndex::isValid(), QWidget::x, and QWidget::y.

Referenced by QTreeView::scrollTo(), visualItemRect(), and QTreeView::visualRegionForSelection().

    Q_D(const QTreeView);

    if (!index.isValid() || isIndexHidden(index))
        return QRect();


    int vi = d->viewIndex(index);
    if (vi < 0)
        return QRect();

    int x = columnViewportPosition(index.column());
    int w = columnWidth(index.column());

    if (index.column() == 0) {
        int i = d->indentation(vi);
        x += i;
        w -= i;
    int y = d->coordinate(vi);
    int h = d->height(vi);
    return QRect(x, y, w, h);

Generated by  Doxygen 1.6.0   Back to index