aboutsummaryrefslogtreecommitdiffstats
path: root/src/declarative/util
diff options
context:
space:
mode:
authorAndrew den Exter <andrew.den-exter@nokia.com>2011-10-10 10:37:31 +1000
committerQt by Nokia <qt-info@nokia.com>2011-10-11 06:44:05 +0200
commita00e70ef2cc7e4c265862d82976fc871035f3416 (patch)
tree35d6873b371a6bdd878de3899232b6f15c250904 /src/declarative/util
parent60d07fc96b60a709396bf983dc79e84f786c1ad0 (diff)
Fix layout issues with recently removed items.
Items removed from the source model aren't removed from the cache group until they've also been released by the view. Skip over these removed items when translating future changes to the source model so no invalid translated changes are created. Change-Id: I9bf3801135e78b5a6493b4ef50ce44ee5c912bfc Reviewed-on: http://codereview.qt-project.org/6298 Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Martin Jones <martin.jones@nokia.com>
Diffstat (limited to 'src/declarative/util')
-rw-r--r--src/declarative/util/qdeclarativelistcompositor.cpp27
1 files changed, 15 insertions, 12 deletions
diff --git a/src/declarative/util/qdeclarativelistcompositor.cpp b/src/declarative/util/qdeclarativelistcompositor.cpp
index 8fd4ec44dd..7beefdaafa 100644
--- a/src/declarative/util/qdeclarativelistcompositor.cpp
+++ b/src/declarative/util/qdeclarativelistcompositor.cpp
@@ -544,13 +544,14 @@ void QDeclarativeListCompositor::clearFlags(
const int difference = qMin(count, from->count);
count -= difference;
- const int removeFlags = from->flags & flags;
+ const int removeFlags = from->flags & flags & ~(AppendFlag | PrependFlag);
const int clearedFlags = from->flags & ~(flags | AppendFlag);
if (removeFlags && removes) {
const int maskedFlags = clearCache
? (removeFlags & ~CacheFlag)
: (removeFlags | (from->flags & CacheFlag));
- removes->append(Remove(from, difference, maskedFlags));
+ if (maskedFlags)
+ removes->append(Remove(from, difference, maskedFlags));
}
m_end.decrementIndexes(difference, removeFlags);
from.incrementIndexes(difference, clearedFlags);
@@ -793,7 +794,7 @@ void QDeclarativeListCompositor::listItemsInserted(
{
QT_DECLARATIVE_TRACE_LISTCOMPOSITOR(<< list << insertions)
for (iterator it(m_ranges.next, 0, Default, m_groupCount); *it != &m_ranges; *it = it->next) {
- if (it->list != list) {
+ if (it->list != list || it->flags == CacheFlag) {
it.incrementIndexes(it->count);
continue;
} else if (it->flags & MovedFlag) {
@@ -818,12 +819,14 @@ void QDeclarativeListCompositor::listItemsInserted(
}
}
}
- Insert translatedInsert(it, insertion.count, flags, insertion.moveId);
- for (int i = 0; i < m_groupCount; ++i) {
- if (it->inGroup(i))
- translatedInsert.index[i] += offset;
+ if (flags & ~(AppendFlag | PrependFlag)) {
+ Insert translatedInsert(it, insertion.count, flags, insertion.moveId);
+ for (int i = 0; i < m_groupCount; ++i) {
+ if (it->inGroup(i))
+ translatedInsert.index[i] += offset;
+ }
+ translatedInsertions->append(translatedInsert);
}
- translatedInsertions->append(translatedInsert);
if ((it->flags & ~AppendFlag) == flags) {
it->count += insertion.count;
} else {
@@ -879,7 +882,7 @@ void QDeclarativeListCompositor::listItemsRemoved(
for (iterator it(m_ranges.next, 0, Default, m_groupCount);
*it != &m_ranges && !removals->isEmpty();
*it = it->next) {
- if (it->list != list) {
+ if (it->list != list || it->flags == CacheFlag) {
it.incrementIndexes(it->count);
continue;
}
@@ -1042,11 +1045,11 @@ void QDeclarativeListCompositor::listItemsChanged(
{
QT_DECLARATIVE_TRACE_LISTCOMPOSITOR(<< list << changes)
for (iterator it(m_ranges.next, 0, Default, m_groupCount); *it != &m_ranges; *it = it->next) {
- if (!it->inGroup()) {
- continue;
- } else if (it->list != list) {
+ if (it->list != list || it->flags == CacheFlag) {
it.incrementIndexes(it->count);
continue;
+ } else if (!it->inGroup()) {
+ continue;
}
foreach (const QDeclarativeChangeSet::Change &change, changes) {
const int offset = change.index - it->index;