summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorStephen Kelly <stephen.kelly@kdab.com>2010-10-13 09:42:10 (GMT)
committerOlivier Goffart <olivier.goffart@nokia.com>2010-10-13 09:52:10 (GMT)
commit62dc9c9602987f4381481cc5642e3ea0782bb418 (patch)
tree3072b0afe3201f80299123d7de6c9358fe31ec91 /src/corelib
parent6f1f1317e68a261173ddb24a045dcc823b16a3bd (diff)
downloadQt-62dc9c9602987f4381481cc5642e3ea0782bb418.zip
Qt-62dc9c9602987f4381481cc5642e3ea0782bb418.tar.gz
Qt-62dc9c9602987f4381481cc5642e3ea0782bb418.tar.bz2
Adjust the parent index for the itemsMoved call.
Not doing this causes the parent QModelIndexes to be out of sync with the model. The fix in fe350ca756df6392b3d0b7840351fccc89f9ef6f is extended to also use adjusted indexes in the itemMove call. Merge-request: 849 Reviewed-by: Olivier Goffart <olivier.goffart@nokia.com>
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/kernel/qabstractitemmodel.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/corelib/kernel/qabstractitemmodel.cpp b/src/corelib/kernel/qabstractitemmodel.cpp
index 9a99ea1..05cb271 100644
--- a/src/corelib/kernel/qabstractitemmodel.cpp
+++ b/src/corelib/kernel/qabstractitemmodel.cpp
@@ -2637,8 +2637,6 @@ void QAbstractItemModel::endMoveRows()
QAbstractItemModelPrivate::Change insertChange = d->changes.pop();
QAbstractItemModelPrivate::Change removeChange = d->changes.pop();
- d->itemsMoved(removeChange.parent, removeChange.first, removeChange.last, insertChange.parent, insertChange.first, Qt::Vertical);
-
QModelIndex adjustedSource = removeChange.parent;
QModelIndex adjustedDestination = insertChange.parent;
@@ -2649,6 +2647,8 @@ void QAbstractItemModel::endMoveRows()
if (removeChange.needsAdjust)
adjustedSource = createIndex(adjustedSource.row() + numMoved, adjustedSource.column(), adjustedSource.internalPointer());
+ d->itemsMoved(adjustedSource, removeChange.first, removeChange.last, adjustedDestination, insertChange.first, Qt::Vertical);
+
emit rowsMoved(adjustedSource, removeChange.first, removeChange.last, adjustedDestination, insertChange.first);
emit layoutChanged();
}
@@ -2861,8 +2861,6 @@ void QAbstractItemModel::endMoveColumns()
QAbstractItemModelPrivate::Change insertChange = d->changes.pop();
QAbstractItemModelPrivate::Change removeChange = d->changes.pop();
- d->itemsMoved(removeChange.parent, removeChange.first, removeChange.last, insertChange.parent, insertChange.first, Qt::Horizontal);
-
QModelIndex adjustedSource = removeChange.parent;
QModelIndex adjustedDestination = insertChange.parent;
@@ -2873,6 +2871,8 @@ void QAbstractItemModel::endMoveColumns()
if (removeChange.needsAdjust)
adjustedSource = createIndex(adjustedSource.row(), adjustedSource.column() + numMoved, adjustedSource.internalPointer());
+ d->itemsMoved(adjustedSource, removeChange.first, removeChange.last, adjustedDestination, insertChange.first, Qt::Horizontal);
+
emit columnsMoved(adjustedSource, removeChange.first, removeChange.last, adjustedDestination, insertChange.first);
emit layoutChanged();
}