src/hbwidgets/itemviews/hbtreeview.cpp
changeset 5 627c4a0fd0e7
parent 2 06ff229162e9
child 6 c3690ec91ef8
--- a/src/hbwidgets/itemviews/hbtreeview.cpp	Thu May 27 13:10:59 2010 +0300
+++ b/src/hbwidgets/itemviews/hbtreeview.cpp	Fri Jun 11 13:58:22 2010 +0300
@@ -178,19 +178,16 @@
 
     if (d->isParentValid(parent)) {
         if (isExpanded(parent) || parent == d->mModelIterator->rootIndex()) {
-            int lastStartPoint = 0;
             for (int i = start; i <= end; ++i) {
-                QModelIndex newParent = d->treeModelIterator()->index(i, parent);
+                HbAbstractItemView::rowsInserted(parent, i, i);
+                // if there is expanded parent under expanding parent, handle it recursively
+                QModelIndex newParent = d->treeModelIterator()->model()->index(i, 0, parent);
                 int childCount = d->treeModelIterator()->childCount(newParent);
                 if (childCount > 0 && isExpanded(newParent)) {
-                    HbAbstractItemView::rowsInserted(parent, lastStartPoint, i);
-                    lastStartPoint = i;
                     rowsInserted(newParent, 0, childCount - 1);
-                }
+                } 
             }
 
-            HbAbstractItemView::rowsInserted(parent, lastStartPoint, end);
-
             if (d->animationEnabled(true)) {
                 if (d->mInSetExpanded) {
                     d->startAppearEffect("treeviewitem", "expand", parent, start, end);