diff options
Diffstat (limited to 'src/declarative/items/qsggridview.cpp')
-rw-r--r-- | src/declarative/items/qsggridview.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/declarative/items/qsggridview.cpp b/src/declarative/items/qsggridview.cpp index e5e41c07af..9beac05d72 100644 --- a/src/declarative/items/qsggridview.cpp +++ b/src/declarative/items/qsggridview.cpp @@ -193,6 +193,7 @@ public: if (q->isComponentComplete()) { clear(); updateGrid(); + setPosition(0); q->refill(); updateCurrent(currentIndex); } @@ -636,7 +637,7 @@ void QSGGridViewPrivate::refill(qreal from, qreal to, bool doBuffer) if (!lazyRelease || !changed || deferredRelease) { // avoid destroying items in the same frame that we create while (visibleItems.count() > 1 && (item = visibleItems.first()) - && item->endRowPos() < bufferFrom - rowSize()*(item->colPos()/colSize()+1)/(columns+1)) { + && item->rowPos()+rowSize()-1 < bufferFrom - rowSize()*(item->colPos()/colSize()+1)/(columns+1)) { if (item->attached->delayRemove()) break; // qDebug() << "refill: remove first" << visibleIndex << "top end pos" << item->endRowPos(); @@ -648,7 +649,7 @@ void QSGGridViewPrivate::refill(qreal from, qreal to, bool doBuffer) } while (visibleItems.count() > 1 && (item = visibleItems.last()) - && item->rowPos()+rowSize()-1 < bufferFrom - rowSize()*(item->colPos()/colSize()+1)/(columns+1)) { + && item->rowPos() > bufferTo + rowSize()*(columns - item->colPos()/colSize())/(columns+1)) { if (item->attached->delayRemove()) break; // qDebug() << "refill: remove last" << visibleIndex+visibleItems.count()-1; @@ -684,7 +685,6 @@ void QSGGridViewPrivate::updateGrid() q->setContentHeight(endPosition() - startPosition()); else q->setContentWidth(lastPosition() - originPosition()); - setPosition(0); } } @@ -2455,7 +2455,6 @@ void QSGGridView::itemsRemoved(int modelIndex, int count) d->setPosition(0); d->updateHeader(); d->updateFooter(); - update(); } } |