Constrain while loop on item count
authorAlan Alpert <alan.alpert@nokia.com>
Thu, 22 Sep 2011 04:34:57 +0000 (14:34 +1000)
committerQt by Nokia <qt-info@nokia.com>
Thu, 22 Sep 2011 05:22:13 +0000 (07:22 +0200)
pos won't necessarily change, but item count does like in the above loop

Task-number: QTBUG-21315
Change-Id: Iaedabeacf4ebe3cd0505193395047b3d65a09442
Reviewed-on: http://codereview.qt-project.org/5347
Reviewed-by: Martin Jones <martin.jones@nokia.com>

src/declarative/items/qsgpathview.cpp

index a1038ad..10161e5 100644 (file)
@@ -1367,7 +1367,7 @@ void QSGPathView::refill()
             }
             ++it;
         } else {
-//            qDebug() << "release";
+            // qDebug() << "release";
             d->updateItem(item, 1.0);
             d->releaseItem(item);
             if (it == d->items.begin()) {
@@ -1397,7 +1397,7 @@ void QSGPathView::refill()
             }
             qreal pos = d->positionOfIndex(idx);
             while ((pos > startPos || !d->items.count()) && d->items.count() < count) {
-    //            qDebug() << "append" << idx;
+                // qDebug() << "append" << idx;
                 QSGItem *item = d->getItem(idx);
                 if (d->model->completePending())
                     item->setZ(idx+1);
@@ -1421,8 +1421,8 @@ void QSGPathView::refill()
             if (idx < 0)
                 idx = d->modelCount - 1;
             pos = d->positionOfIndex(idx);
-            while (pos >= 0.0 && pos < startPos) {
-    //            qDebug() << "prepend" << idx;
+            while ((pos >= 0.0 && pos < startPos) && d->items.count() < count) {
+                // qDebug() << "prepend" << idx;
                 QSGItem *item = d->getItem(idx);
                 if (d->model->completePending())
                     item->setZ(idx+1);