diff options
author | Andrew den Exter <andrew.den.exter@jollamobile.com> | 2013-09-23 16:30:40 +1000 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-12-19 01:36:30 +0100 |
commit | 854272ecf9f26e77ddd8e3b7015cb8fe278183a5 (patch) | |
tree | b212a3055c38e6c1a8be3c22d82938ea6e23955d /src/quick/items/qquickitemview.cpp | |
parent | a34eddbf7a68360ead218b2f5a9215e6b1ae88ec (diff) |
Fix positioning of item when first cacheBuffer item is removed.
When items prior to the first visible item are removed from the instantiated
items list the first item is moved forward by the size of the item removed so
it position remains correct relative to the visible items. But if the removed
item is the first instanitated item then it's size shouldn't contribute to the
offset as the next instatiated item is already offset by its size.
Task-number: QTBUG-33619
Change-Id: I05c33f505e2856afa08cd9cd89d8eae97c20679d
Reviewed-by: Alan Alpert <aalpert@blackberry.com>
Diffstat (limited to 'src/quick/items/qquickitemview.cpp')
-rw-r--r-- | src/quick/items/qquickitemview.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/quick/items/qquickitemview.cpp b/src/quick/items/qquickitemview.cpp index d9ff024d9f..d7b984788e 100644 --- a/src/quick/items/qquickitemview.cpp +++ b/src/quick/items/qquickitemview.cpp @@ -2065,7 +2065,7 @@ void QQuickItemViewPrivate::removeItem(FxViewItem *item, const QQmlChangeSet::Re { if (removeResult->visiblePos.isValid()) { if (item->position() < removeResult->visiblePos) - removeResult->sizeChangesBeforeVisiblePos += item->size(); + updateSizeChangesBeforeVisiblePos(item, removeResult); else removeResult->sizeChangesAfterVisiblePos += item->size(); } @@ -2080,6 +2080,11 @@ void QQuickItemViewPrivate::removeItem(FxViewItem *item, const QQmlChangeSet::Re removeResult->changedFirstItem = true; } +void QQuickItemViewPrivate::updateSizeChangesBeforeVisiblePos(FxViewItem *item, ChangeResult *removeResult) +{ + removeResult->sizeChangesBeforeVisiblePos += item->size(); +} + void QQuickItemViewPrivate::repositionFirstItem(FxViewItem *prevVisibleItemsFirst, qreal prevVisibleItemsFirstPos, FxViewItem *prevFirstVisible, |