42 : m_removes(changeSet.m_removes)
43 , m_inserts(changeSet.m_inserts)
44 , m_changes(changeSet.m_changes)
45 , m_difference(changeSet.m_difference)
63 m_removes = changeSet.m_removes;
64 m_inserts = changeSet.m_inserts;
65 m_changes = changeSet.m_changes;
66 m_difference = changeSet.m_difference;
152 for (; rit !=
removes->end(); ++rit) {
153 int index = rit->index + removeCount;
154 int count = rit->count;
159 change->index -= removeCount;
165 }
else if (rit->index <
change->index) {
166 change->index = rit->index;
173 insertCount +=
insert->count;
174 insert->index -= removeCount;
177 rit->index -= insertCount;
187 if (offset < 0 && rit->moveId != -1) {
188 rit =
removes->insert(rit, Change(
189 rit->index, -
offset, rit->moveId, rit->offset));
212 if (iit->moveId != rit->moveId
213 || rit->offset > iit->offset + iit->count
219 const int overlapOffset = rit->offset - iit->offset;
220 if (overlapOffset > 0) {
221 iit =
inserts->insert(iit, Change(
222 iit->index, overlapOffset, iit->moveId, iit->offset));
224 iit->index += overlapOffset;
225 iit->count -= overlapOffset;
226 iit->offset += overlapOffset;
228 if (iit->offset >= rit->offset
229 && iit->offset + iit->count <= rit->offset +
difference) {
232 iit->moveId =
insert->moveId;
233 iit->offset =
insert->offset +
qMax(0, -overlapOffset);
239 -
qMax(iit->offset, rit->offset);
240 iit =
inserts->insert(iit, Change(
248 iit->offset +=
count;
265 }
else if (rit->count == -
offset || rit->count == 0) {
270 rit->index -=
insert->count;
271 insertCount +=
insert->count;
275 removeCount += rit->count;
278 insert->index -= removeCount;
287 &&
next->index == rit->index
288 &&
next->moveId == -1
289 && rit->moveId == -1; ++
next) {
290 next->count += rit->count;
293 int index = rit->index + removeCount;
297 remove->index -= removeCount;
302 for (; rend != m_removes.end()
304 && rend->moveId == -1
305 &&
index + rit->count >= rend->index; ++rend) {
306 count += rend->count;
312 if (rend == m_removes.end()) {
314 }
else if (rit->index + rit->count < rend->index - removeCount) {
316 }
else if (rend->moveId != -1) {
317 difference = rend->index - removeCount - rit->index;
324 remove->index = rit->index;
332 rit->index,
offset, rit->moveId, rit->offset));
339 remove->index = rit->index;
345 if (rit->count > 0) {
349 removeCount += rit->count;
352 remove->index -= removeCount;
353 m_difference -= removeCount;
368 int index = iit->index - insertCount;
373 &&
next->index == iit->index + iit->count
374 &&
next->moveId == -1
375 && iit->moveId == -1; ++
next) {
383 change->index += insertCount;
397 insert->index += insertCount;
398 if (
insert == m_inserts.end()) {
409 }
else if (iit->moveId == -1 &&
insert->moveId == -1) {
412 if (offset < insert->
count) {
416 insert->index += insertCount;
420 }
else if (offset < insert->
count) {
434 insert->index += insertCount;
440 insertCount += current.
count;
443 insert->index += insertCount;
444 m_difference += insertCount;
490 if (
change == m_changes.end() ||
change->index > cit->index + cit->count) {
491 if (cit->count > 0) {
496 if (cit->index <
change->index) {
498 change->index = cit->index;
501 if (cit->index + cit->count >
change->index +
change->count) {
502 change->count = cit->index + cit->count -
change->index;
509 if (cbegin != cend) {
510 change = m_changes.erase(cbegin, cend);
527 debug.nospace() <<
"QQmlChangeSet(";
536 debug << change <<
' ';
537 return debug.nospace() <<
')';
549 return debug.nospace() <<
"Change(" << change.
index <<
',' << change.
count <<
')';
The QQmlChangeSet class stores an ordered list of notifications about changes to a linear data set.
~QQmlChangeSet()
Destroys a change set.
const QVector< Change > & removes() const
void remove(int index, int count)
Appends a notification that count items were removed at index.
void change(int index, int count)
Appends a notification that count items were changed at index.
const QVector< Change > & changes() const
QQmlChangeSet & operator=(const QQmlChangeSet &changeSet)
Assigns the value of a changeSet to another.
void move(int from, int to, int count, int moveId)
Appends a notification that count items were moved from one index to another.
void insert(int index, int count)
Appends a notification that count items were inserted at index.
void apply(const QQmlChangeSet &changeSet)
Applies the changes in a changeSet to another.
QQmlChangeSet()
Constructs an empty change set.
const QVector< Change > & inserts() const
cache insert(employee->id(), employee)
const PluginKeyMapConstIterator cend
Combined button and popup list for selecting options.
constexpr const T & qMin(const T &a, const T &b)
constexpr const T & qMax(const T &a, const T &b)
GLenum GLenum GLsizei count
GLenum GLuint GLintptr offset
QFuture< QSet< QChar > > set
[10]
settings remove("monkey")