Logo Search packages:      
Sourcecode: kdbg version File versions

KTreeViewItem * KTreeView::recursiveFind ( KPath &  path  )  [protected]

Internal function that finds the item at the given path. Returns 0 if the item cannot be found. The path is destroyed by this function.

Definition at line 1851 of file ktreeview.cpp.

References KTreeViewItem::getChild(), KTreeViewItem::getSibling(), and KTreeViewItem::getText().

Referenced by itemAt().

{
    if (path.isEmpty())
      return treeRoot;

    // get the next key
    QString* searchString = path.pop();

    // find the parent item
    KTreeViewItem* parent = recursiveFind(path);
    if (parent == 0)
      return 0;

    /*
     * Iterate through the parent's children searching for searchString.
     */
    KTreeViewItem* sibling = parent->getChild();
    while (sibling != 0) {
      if (*searchString == sibling->getText()) {
          break;              /* found it! */
      }
      sibling = sibling->getSibling();
    }
    return sibling;
}


Generated by  Doxygen 1.6.0   Back to index