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

int QTreeView::verticalOffset (  )  const [protected, virtual, inherited]

Returns the vertical offset of the items in the tree view.

See also:
horizontalOffset()

Implements QAbstractItemView.

Definition at line 1128 of file qtreeview.cpp.

References QAbstractItemView::model(), QAbstractItemView::rootIndex(), QAbstractScrollArea::verticalScrollBar(), and QAbstractItemView::verticalStepsPerItem().

Referenced by QTreeView::drawBranches().

{
    Q_D(const QTreeView);
    // gives an estimate
    if (model() && model()->rowCount(rootIndex()) > 0) {
        float items = float(verticalScrollBar()->value()) / float(verticalStepsPerItem());
        return int(items * d->itemHeight);
    }
    // no items, no offset
    return 0;
}


Generated by  Doxygen 1.6.0   Back to index