diff --git a/TreeItem.cc b/TreeItem.cc index eeaa919ae9c772aad1fd29d8c30ed1b39511d509..3f9861bd754f333c842e443f25d35629e78e8018 100644 --- a/TreeItem.cc +++ b/TreeItem.cc @@ -42,8 +42,6 @@ #include "TreeItem.hh" -/// Acceleration map -static QMap<int,TreeItem*> treeMap_; //-------------------------------------------------------------------------------- @@ -191,8 +189,9 @@ TreeItem* TreeItem::next() { while ( parentPointer ) { // If there is an unvisited child of the parent, return this one - if ( parentPointer->childCount() > ( thisPointer->row() + 1) ) { - return parentPointer->childItems_[ thisPointer->row() + 1 ]; + const int position = (thisPointer->row() + 1); + if ( parentPointer->childCount() > ( position ) ) { + return parentPointer->childItems_[ position ]; } // Go to the next level diff --git a/TreeItem.hh b/TreeItem.hh index 112cd9b7a8b6393582f76d13b37c0f308fb273e5..4297aa354f30d20bb7dfee51c65a92aeeea265f3 100644 --- a/TreeItem.hh +++ b/TreeItem.hh @@ -110,12 +110,15 @@ class TreeItem { int level(); private: - /// Parent item or 0 if rootnode + /// Parent item or 0 if root node TreeItem *parentItem_; /// Children of this node QList<TreeItem*> childItems_; + /// Acceleration map + static QMap<int,TreeItem*> treeMap_; + public: //=========================================================================== /** @name Tree : Parent nodes @@ -125,7 +128,7 @@ class TreeItem { /// get the row of this item from the parent int row() const; - /// Get the parent item ( 0 if rootitem ) + /// Get the parent item ( 0 if root item ) TreeItem *parent(); /// Set the parent pointer