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

int Q3ListViewItem::totalHeight (  )  const

Returns the total height of this object, including any visible children. This height is recomputed lazily and cached for as long as possible.

Functions which can affect the total height are, setHeight() which is used to set an item's height, setOpen() to show or hide an item's children, and invalidateHeight() to invalidate the cached height.

See also:
height()

Definition at line 1704 of file q3listview.cpp.

References childCount(), childItem, configured, isOpen(), maybeTotalHeight, ownHeight, and setup().

Referenced by itemPos().

{
    if (!visible)
        return 0;
    if (maybeTotalHeight >= 0)
        return maybeTotalHeight;
    Q3ListViewItem * that = (Q3ListViewItem *)this;
    if (!that->configured) {
        that->configured = true;
        that->setup(); // ### virtual non-const function called in const
    }
    that->maybeTotalHeight = that->ownHeight;

    if (!that->isOpen() || !that->childCount())
        return that->ownHeight;

    Q3ListViewItem * child = that->childItem;
    while (child != 0) {
        that->maybeTotalHeight += child->totalHeight();
        child = child->siblingItem;
    }
    return that->maybeTotalHeight;
}


Generated by  Doxygen 1.6.0   Back to index