Logo Search packages:      
Sourcecode: kdbg version File versions

bool KTreeView::forEveryVisibleItem ( KForEveryFunc  func,
void *  user,
KTreeViewItem root = 0 
)

This function is like forEveryItem, but only iterates visible items, in order. If the specified root item is invisible no items are visited.

Parameters:
func the member function to call for every visited item
user extra data that is passed to func
root the root item of the subtree to scan; this item itself is not scanned
See also:
forEveryItem

Definition at line 789 of file ktreeview.cpp.

References KTreeViewItem::getChild(), KTreeViewItem::getSibling(), KTreeViewItem::hasChild(), KTreeViewItem::isExpanded(), KTreeViewItem::isVisible(), and KTreeViewItem::owner.

Referenced by scrollVisible().

{
    if (item == 0) {
      item = treeRoot;
    } else {
      // children are invisible (hence, nothing to do)
      // if item is invisible or collapsed
      if (!item->isVisible() || !item->isExpanded()) {
          return false;
      }
    }
    assert(item->owner == this);
    item = item->getChild();

    while (item != 0) {
      // visit the siblings
      if ((*func)(item, user)) {
          return true;
      }
      // visit the children (recursively)
      if (item->hasChild() && item->isExpanded()) {
          if (forEveryVisibleItem(func, user, item))
            return true;
      }
      item = item->getSibling();
    }
    return false;
}


Generated by  Doxygen 1.6.0   Back to index