diff options
author | Lars Knoll <lars.knoll@digia.com> | 2014-04-30 20:29:39 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2014-07-22 13:49:09 +0200 |
commit | 2338bb1faac05c87575495d324be6b8c5066479a (patch) | |
tree | 46c92157ec0865e2dfbd7c48c53b0b7c7a73bf9c /src/qml/util/qqmllistcompositor.cpp | |
parent | fb4edc2359b3761f0f01afac33b8441bbbda22ab (diff) |
Fix QQmlDelegateModelChangeArray
The class had a vtable, clashing with assumptions about Managed
objects. The derived classes where actually only cosmetic sugar
on top of the basic change class. Clean this up and unify the
functionality in the base class.
In addition adjust the class to the new data layout.
Change-Id: I8677f6c71465381f7ebdf82eb6025fda6d137ec3
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/util/qqmllistcompositor.cpp')
-rw-r--r-- | src/qml/util/qqmllistcompositor.cpp | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/src/qml/util/qqmllistcompositor.cpp b/src/qml/util/qqmllistcompositor.cpp index 830a24e752..64528dafd2 100644 --- a/src/qml/util/qqmllistcompositor.cpp +++ b/src/qml/util/qqmllistcompositor.cpp @@ -951,7 +951,7 @@ void QQmlListCompositor::clear() void QQmlListCompositor::listItemsInserted( QVector<Insert> *translatedInsertions, void *list, - const QVector<QQmlChangeSet::Insert> &insertions, + const QVector<QQmlChangeSet::Change> &insertions, const QVector<MovedFlags> *movedFlags) { QT_QML_TRACE_LISTCOMPOSITOR(<< list << insertions) @@ -966,7 +966,7 @@ void QQmlListCompositor::listItemsInserted( it.incrementIndexes(it->count); continue; } - foreach (const QQmlChangeSet::Insert &insertion, insertions) { + foreach (const QQmlChangeSet::Change &insertion, insertions) { int offset = insertion.index - it->index; if ((offset > 0 && offset < it->count) || (offset == 0 && it->prepend()) @@ -1064,8 +1064,8 @@ void QQmlListCompositor::listItemsInserted( QT_QML_TRACE_LISTCOMPOSITOR(<< list << index << count) Q_ASSERT(count > 0); - QVector<QQmlChangeSet::Insert> insertions; - insertions.append(QQmlChangeSet::Insert(index, count)); + QVector<QQmlChangeSet::Change> insertions; + insertions.append(QQmlChangeSet::Change(index, count)); listItemsInserted(translatedInsertions, list, insertions); } @@ -1073,8 +1073,8 @@ void QQmlListCompositor::listItemsInserted( void QQmlListCompositor::listItemsRemoved( QVector<Remove> *translatedRemovals, void *list, - QVector<QQmlChangeSet::Remove> *removals, - QVector<QQmlChangeSet::Insert> *insertions, + QVector<QQmlChangeSet::Change> *removals, + QVector<QQmlChangeSet::Change> *insertions, QVector<MovedFlags> *movedFlags) { QT_QML_TRACE_LISTCOMPOSITOR(<< list << *removals) @@ -1086,7 +1086,7 @@ void QQmlListCompositor::listItemsRemoved( continue; } bool removed = false; - for (QVector<QQmlChangeSet::Remove>::iterator removal = removals->begin(); + for (QVector<QQmlChangeSet::Change>::iterator removal = removals->begin(); !removed && removal != removals->end(); ++removal) { int relativeIndex = removal->index - it->index; @@ -1104,7 +1104,7 @@ void QQmlListCompositor::listItemsRemoved( } if (removal->isMove()) { // If the removal was part of a move find the corresponding insert. - QVector<QQmlChangeSet::Insert>::iterator insertion = insertions->begin(); + QVector<QQmlChangeSet::Change>::iterator insertion = insertions->begin(); for (; insertion != insertions->end() && insertion->moveId != removal->moveId; ++insertion) {} Q_ASSERT(insertion != insertions->end()); @@ -1114,11 +1114,11 @@ void QQmlListCompositor::listItemsRemoved( // If the remove started before the current range, split it and the // corresponding insert so we're only working with intersecting part. int splitMoveId = ++m_moveId; - removal = removals->insert(removal, QQmlChangeSet::Remove( + removal = removals->insert(removal, QQmlChangeSet::Change( removal->index, -relativeIndex, splitMoveId)); ++removal; removal->count -= -relativeIndex; - insertion = insertions->insert(insertion, QQmlChangeSet::Insert( + insertion = insertions->insert(insertion, QQmlChangeSet::Change( insertion->index, -relativeIndex, splitMoveId)); ++insertion; insertion->index += -relativeIndex; @@ -1135,10 +1135,10 @@ void QQmlListCompositor::listItemsRemoved( if (removeCount < removal->count) { // If the remove doesn't encompass all of the current range, // split it and the corresponding insert. - removal = removals->insert(removal, QQmlChangeSet::Remove( + removal = removals->insert(removal, QQmlChangeSet::Change( removal->index, removeCount, translatedRemoval.moveId)); ++removal; - insertion = insertions->insert(insertion, QQmlChangeSet::Insert( + insertion = insertions->insert(insertion, QQmlChangeSet::Change( insertion->index, removeCount, translatedRemoval.moveId)); ++insertion; @@ -1253,8 +1253,8 @@ void QQmlListCompositor::listItemsRemoved( QT_QML_TRACE_LISTCOMPOSITOR(<< list << index << count) Q_ASSERT(count >= 0); - QVector<QQmlChangeSet::Remove> removals; - removals.append(QQmlChangeSet::Remove(index, count)); + QVector<QQmlChangeSet::Change> removals; + removals.append(QQmlChangeSet::Change(index, count)); listItemsRemoved(translatedRemovals, list, &removals, 0, 0); } @@ -1280,11 +1280,11 @@ void QQmlListCompositor::listItemsMoved( QT_QML_TRACE_LISTCOMPOSITOR(<< list << from << to << count) Q_ASSERT(count >= 0); - QVector<QQmlChangeSet::Remove> removals; - QVector<QQmlChangeSet::Insert> insertions; + QVector<QQmlChangeSet::Change> removals; + QVector<QQmlChangeSet::Change> insertions; QVector<MovedFlags> movedFlags; - removals.append(QQmlChangeSet::Remove(from, count, 0)); - insertions.append(QQmlChangeSet::Insert(to, count, 0)); + removals.append(QQmlChangeSet::Change(from, count, 0)); + insertions.append(QQmlChangeSet::Change(to, count, 0)); listItemsRemoved(translatedRemovals, list, &removals, &insertions, &movedFlags); listItemsInserted(translatedInsertions, list, insertions, &movedFlags); @@ -1342,16 +1342,16 @@ void QQmlListCompositor::listItemsChanged( void QQmlListCompositor::transition( Group from, Group to, - QVector<QQmlChangeSet::Remove> *removes, - QVector<QQmlChangeSet::Insert> *inserts) + QVector<QQmlChangeSet::Change> *removes, + QVector<QQmlChangeSet::Change> *inserts) { int removeCount = 0; for (iterator it(m_ranges.next, 0, Default, m_groupCount); *it != &m_ranges; *it = it->next) { if (it == from && it != to) { - removes->append(QQmlChangeSet::Remove(it.index[from]- removeCount, it->count)); + removes->append(QQmlChangeSet::Change(it.index[from]- removeCount, it->count)); removeCount += it->count; } else if (it != from && it == to) { - inserts->append(QQmlChangeSet::Insert(it.index[to], it->count)); + inserts->append(QQmlChangeSet::Change(it.index[to], it->count)); } it.incrementIndexes(it->count); } |