1.1 --- a/treemodel.cpp Wed May 20 15:40:14 2009 +0000
1.2 +++ b/treemodel.cpp Tue May 26 11:23:44 2009 +0000
1.3 @@ -106,7 +106,7 @@
1.4 return rootItem->columnCount();
1.5 }
1.6
1.7 -BranchItem* TreeModel::next(BranchItem* ¤t, BranchItem* &previous, int &d0)
1.8 +BranchItem* TreeModel::next(BranchItem* ¤t, BranchItem* &previous, BranchItem* start)
1.9 {
1.10 // Walk through map beginning at current with previous==0
1.11 // Start at root, if current==NULL
1.12 @@ -115,8 +115,8 @@
1.13 // Are we just beginning to walk the map?
1.14 if (!previous)
1.15 {
1.16 + if (!start) start=current;
1.17 previous=current;
1.18 - d0=current->depth();
1.19 current=current->getFirstBranch();
1.20 return current;
1.21 }
1.22 @@ -138,7 +138,8 @@
1.23 // turn around and go up again
1.24 }
1.25
1.26 - // Coming from below,
1.27 + // Coming from below
1.28 +
1.29 // Trying to go down again to siblings
1.30
1.31 BranchItem *sibling=current->getBranchNum (previous->num()+1);
1.32 @@ -151,6 +152,9 @@
1.33 return current;
1.34 }
1.35
1.36 + // If we only needed to go through subtree, we are done now
1.37 + if (start==current) return NULL;
1.38 +
1.39 // Go up and try to find siblings of current
1.40 previous=current;
1.41 current=(BranchItem*)current->parent();
1.42 @@ -159,27 +163,11 @@
1.43 if (!current) return current;
1.44
1.45 while (current && current->depth() < previous->depth() )
1.46 - next (current,previous,d0);
1.47 + current=next (current,previous,start);
1.48
1.49 return current;
1.50 }
1.51
1.52 -/*
1.53 -bool TreeModel::insertRows ( int row, int count, const QModelIndex & parent)
1.54 -{
1.55 - std::cout << "TreeModel insertRows()\n";
1.56 - int last=row+count-1;
1.57 - beginInsertRows (parent,row,last);
1.58 -
1.59 - for (int i=row; i<=last; i++)
1.60 - {
1.61 - std::cout << "TreeModel::insertRows inserting i="<<i<<std::endl;
1.62 - }
1.63 - endInsertRows ();
1.64 - return true;
1.65 -}
1.66 -*/
1.67 -
1.68 bool TreeModel::removeRows ( int row, int count, const QModelIndex & parent)
1.69 {
1.70 int last=row+count-1;