src/hbwidgets/itemviews/hbtreemodeliterator_p_p.cpp
changeset 5 627c4a0fd0e7
parent 2 06ff229162e9
--- a/src/hbwidgets/itemviews/hbtreemodeliterator_p_p.cpp	Thu May 27 13:10:59 2010 +0300
+++ b/src/hbwidgets/itemviews/hbtreemodeliterator_p_p.cpp	Fri Jun 11 13:58:22 2010 +0300
@@ -39,8 +39,8 @@
 }
 
 /*
-    Return first index belonging to specified parent
-    If parent is colapsed QModelIndex is returned
+    Return first visible index belonging to specified parent.
+    If parent is collapsed QModelIndex is returned.
 */
 QModelIndex HbTreeModelIteratorPrivate::first(const QModelIndex &parent) const
 {
@@ -54,7 +54,8 @@
 }
 
 /*
-    Return last index belonging to specified parent - last child in whole parent branch
+    Return last visible index belonging to specified parent - last child in whole parent branch.
+    If parent is collapsed QModelIndex is returned.
 */
 QModelIndex HbTreeModelIteratorPrivate::last(const QModelIndex &parent) const
 {
@@ -112,8 +113,11 @@
             return -1;
         }
     }
-    mCachedPosition.count = result;
-    mCachedPosition.index = index;
+
+    if (mUseCache) {
+        mCachedPosition.count = result;
+        mCachedPosition.index = index;
+    }
     return result;
 }
 
@@ -130,8 +134,11 @@
             return -1;
         }
     }
-    mCachedPosition.count = result;
-    mCachedPosition.index = index;
+
+    if (mUseCache) {
+        mCachedPosition.count = result;
+        mCachedPosition.index = index;
+    }
     return result;
 }