Logo Search packages:      
Sourcecode: kdbg version File versions

void KTreeView::clear (  ) 

Removes all items from the tree.

Definition at line 688 of file ktreeview.cpp.

References KTreeViewItem::getChild(), KTreeViewItem::getParent(), KTreeViewItem::getSibling(), KTreeViewItem::hasChild(), KTreeViewItem::hasSibling(), setCurrentItem(), and takeItem().

Referenced by ~KTreeView().

{
    setCurrentItem(-1); 

    /* somewhat of a hack for takeItem so it doesn't update the current item... */
      clearing = TRUE;
      
      bool autoU = autoUpdate();
      setAutoUpdate(FALSE);
      QStack<KTreeViewItem> stack;
      stack.push(treeRoot);
      while(!stack.isEmpty()) {
            KTreeViewItem *item = stack.pop();
            if(item->hasChild()) {
                  stack.push(item);
                  stack.push(item->getChild());
            }
            else if(item->hasSibling()) {
                  stack.push(item);
                  stack.push(item->getSibling());
            }
            else if(item->getParent() != 0) {
                  takeItem(item);
                  delete item;
            }
      }
      clearing = FALSE;
  if(goingDown || QApplication::closingDown())
    return;
  setAutoUpdate(autoU);
  if(autoU && isVisible())
    repaint();
}


Generated by  Doxygen 1.6.0   Back to index