Don't emit attached add() and remove() for moved items
authorBea Lam <bea.lam@nokia.com>
Thu, 1 Sep 2011 03:52:23 +0000 (13:52 +1000)
committerQt by Nokia <qt-info@nokia.com>
Fri, 2 Sep 2011 02:17:44 +0000 (04:17 +0200)
Regression from 6fbc4b7e7e5aed8739ca1143e0fc1e38b8c8e17a

Change-Id: I0bcd55548dca1559deea0d66112e7cdeb3da4ed9
Reviewed-on: http://codereview.qt.nokia.com/4023
Reviewed-by: Bea Lam <bea.lam@nokia.com>
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>

src/declarative/items/qsggridview.cpp
src/declarative/items/qsgitemview.cpp
src/declarative/items/qsglistview.cpp

index 50ea86a..1d4e831 100644 (file)
@@ -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;
index cd598e9..401a17e 100644 (file)
@@ -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;
index 73bbd87..321c66c 100644 (file)
@@ -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;
         }