summaryrefslogtreecommitdiffstats
path: root/src/declarative
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2010-12-13 03:49:52 (GMT)
committerMartin Jones <martin.jones@nokia.com>2010-12-13 03:49:52 (GMT)
commit35f964ac3d88831c857a850bbdc58fcbfdbaf13c (patch)
tree19776f7ec3a4db699728707a52ca6c9340caab99 /src/declarative
parent2249a44e57764e88ed2967aee7f845fdf4cf2358 (diff)
downloadQt-35f964ac3d88831c857a850bbdc58fcbfdbaf13c.zip
Qt-35f964ac3d88831c857a850bbdc58fcbfdbaf13c.tar.gz
Qt-35f964ac3d88831c857a850bbdc58fcbfdbaf13c.tar.bz2
A QAIM model resulted in items moving to incorrect locations
QAbstractItemModel moves items to the gaps between items. QML views assume items are moved to the destination index. This means we need to adjust the destination when moving forward to a gap. Task-number: QTBUG-15841 Reviewed-by: Michael Brasser
Diffstat (limited to 'src/declarative')
-rw-r--r--src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp
index 4fe6c4c..4f5213a 100644
--- a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp
+++ b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp
@@ -1367,7 +1367,7 @@ void QDeclarativeVisualDataModel::_q_rowsMoved(const QModelIndex &sourceParent,
Q_D(QDeclarativeVisualDataModel);
const int count = sourceEnd - sourceStart + 1;
if (destinationParent == d->m_root && sourceParent == d->m_root) {
- _q_itemsMoved(sourceStart, destinationRow, count);
+ _q_itemsMoved(sourceStart, sourceStart > destinationRow ? destinationRow : destinationRow-1, count);
} else if (sourceParent == d->m_root) {
_q_itemsRemoved(sourceStart, count);
} else if (destinationParent == d->m_root) {