From: Bea Lam Date: Thu, 1 Sep 2011 03:52:23 +0000 (+1000) Subject: Don't emit attached add() and remove() for moved items X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=23c826303436f438aaac6f3edc87e1d5b22ee549;p=konrad%2Fqtdeclarative.git Don't emit attached add() and remove() for moved items Regression from 6fbc4b7e7e5aed8739ca1143e0fc1e38b8c8e17a Change-Id: I0bcd55548dca1559deea0d66112e7cdeb3da4ed9 Reviewed-on: http://codereview.qt.nokia.com/4023 Reviewed-by: Bea Lam Reviewed-by: Qt Sanity Bot --- diff --git a/src/declarative/items/qsggridview.cpp b/src/declarative/items/qsggridview.cpp index 50ea86a..1d4e831 100644 --- a/src/declarative/items/qsggridview.cpp +++ b/src/declarative/items/qsggridview.cpp @@ -1792,7 +1792,8 @@ bool QSGGridViewPrivate::applyInsertionChange(const QDeclarativeChangeSet::Inser if (!item) item = createItem(modelIndex + i); visibleItems.insert(index, item); - addedItems->append(item); + if (!change.isMove()) + addedItems->append(item); colPos += colSize(); if (colPos > colSize() * (columns-1)) { colPos = 0; diff --git a/src/declarative/items/qsgitemview.cpp b/src/declarative/items/qsgitemview.cpp index cd598e9..401a17e 100644 --- a/src/declarative/items/qsgitemview.cpp +++ b/src/declarative/items/qsgitemview.cpp @@ -1487,8 +1487,10 @@ bool QSGItemViewPrivate::applyModelChanges() } else { // removed item removedVisible = true; - item->attached->emitRemove(); - if (item->attached->delayRemove()) { + if (!removals[i].isMove()) + item->attached->emitRemove(); + + if (item->attached->delayRemove() && !removals[i].isMove()) { item->index = -1; QObject::connect(item->attached, SIGNAL(delayRemoveChanged()), q, SLOT(destroyRemoved()), Qt::QueuedConnection); ++it; diff --git a/src/declarative/items/qsglistview.cpp b/src/declarative/items/qsglistview.cpp index 73bbd87..321c66c 100644 --- a/src/declarative/items/qsglistview.cpp +++ b/src/declarative/items/qsglistview.cpp @@ -2164,7 +2164,8 @@ bool QSGListViewPrivate::applyInsertionChange(const QDeclarativeChangeSet::Inser item = createItem(modelIndex + i); visibleItems.insert(insertionIdx, item); - addedItems->append(item); + if (!change.isMove()) + addedItems->append(item); pos -= item->size() + spacing; index++; } @@ -2182,7 +2183,8 @@ bool QSGListViewPrivate::applyInsertionChange(const QDeclarativeChangeSet::Inser item = createItem(modelIndex + i); visibleItems.insert(index, item); - addedItems->append(item); + if (!change.isMove()) + addedItems->append(item); pos += item->size() + spacing; ++index; }