summaryrefslogtreecommitdiff
path: root/src/declarative/items/qquickitemview.cpp
diff options
context:
space:
mode:
authorCharles Yin <charles.yin@nokia.com>2011-11-14 10:35:51 +1000
committerCharles Yin <charles.yin@nokia.com>2011-11-14 10:35:51 +1000
commitfc54db69809a16f613f65a2761fab55d5911b02c (patch)
treea00d9284eb13f81f5b195f8a4c6cfee03edb4f17 /src/declarative/items/qquickitemview.cpp
parent35275892ca8a7046451b8e943985dd779fee4794 (diff)
parent2557ff5a940242b398dee65c3c79cec088164e32 (diff)
downloadqtdeclarative-fc54db69809a16f613f65a2761fab55d5911b02c.tar.gz
Merge branch 'master' into animation-refactor
Conflicts: tools/qmlviewer/qdeclarativetester.cpp tools/qmlviewer/qmlruntime.cpp Change-Id: I48f0eb02df27e4b524f45927939b4c257452b0aa
Diffstat (limited to 'src/declarative/items/qquickitemview.cpp')
-rw-r--r--src/declarative/items/qquickitemview.cpp20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/declarative/items/qquickitemview.cpp b/src/declarative/items/qquickitemview.cpp
index b3429ded7c..79787d777c 100644
--- a/src/declarative/items/qquickitemview.cpp
+++ b/src/declarative/items/qquickitemview.cpp
@@ -1146,7 +1146,6 @@ qreal QQuickItemViewPrivate::endPosition() const
qreal QQuickItemViewPrivate::contentStartPosition() const
{
- Q_Q(const QQuickItemView);
qreal pos = -headerSize();
if (layoutOrientation() == Qt::Vertical)
pos -= vData.startMargin;
@@ -1414,7 +1413,7 @@ bool QQuickItemViewPrivate::applyModelChanges()
moveReason = QQuickItemViewPrivate::Other;
int prevCount = itemCount;
- bool removedVisible = false;
+ bool visibleAffected = false;
bool viewportChanged = !currentChanges.pendingChanges.removes().isEmpty()
|| !currentChanges.pendingChanges.inserts().isEmpty();
@@ -1433,8 +1432,8 @@ bool QQuickItemViewPrivate::applyModelChanges()
FxViewItem *item = *it;
if (item->index == -1 || item->index < removals[i].index) {
// already removed, or before removed items
- if (item->index < removals[i].index && !removedVisible)
- removedVisible = true;
+ if (!visibleAffected && item->index < removals[i].index)
+ visibleAffected = true;
++it;
} else if (item->index >= removals[i].index + removals[i].count) {
// after removed items
@@ -1442,7 +1441,7 @@ bool QQuickItemViewPrivate::applyModelChanges()
++it;
} else {
// removed item
- removedVisible = true;
+ visibleAffected = true;
if (!removals[i].isMove())
item->attached->emitRemove();
@@ -1464,20 +1463,22 @@ bool QQuickItemViewPrivate::applyModelChanges()
}
}
}
-
+ if (!visibleAffected && needsRefillForAddedOrRemovedIndex(removals[i].index))
+ visibleAffected = true;
}
if (!removals.isEmpty())
updateVisibleIndex();
const QVector<QDeclarativeChangeSet::Insert> &insertions = currentChanges.pendingChanges.inserts();
- bool addedVisible = false;
InsertionsResult insertResult;
bool allInsertionsBeforeVisible = true;
for (int i=0; i<insertions.count(); i++) {
bool wasEmpty = visibleItems.isEmpty();
if (applyInsertionChange(insertions[i], firstVisible, &insertResult))
- addedVisible = true;
+ visibleAffected = true;
+ if (!visibleAffected && needsRefillForAddedOrRemovedIndex(insertions[i].index))
+ visibleAffected = true;
if (insertions[i].index >= visibleIndex)
allInsertionsBeforeVisible = false;
if (wasEmpty && !visibleItems.isEmpty())
@@ -1543,7 +1544,8 @@ bool QQuickItemViewPrivate::applyModelChanges()
if (prevCount != itemCount)
emit q->countChanged();
- bool visibleAffected = removedVisible || addedVisible || !currentChanges.pendingChanges.changes().isEmpty();
+ if (!visibleAffected)
+ visibleAffected = !currentChanges.pendingChanges.changes().isEmpty();
if (!visibleAffected && viewportChanged)
updateViewport();