summaryrefslogtreecommitdiffstats
path: root/tests/auto/modeltest/dynamictreemodel.cpp
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 /tests/auto/modeltest/dynamictreemodel.cpp
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 'tests/auto/modeltest/dynamictreemodel.cpp')
-rw-r--r--tests/auto/modeltest/dynamictreemodel.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/auto/modeltest/dynamictreemodel.cpp b/tests/auto/modeltest/dynamictreemodel.cpp
index b572eb1..fa634b6 100644
--- a/tests/auto/modeltest/dynamictreemodel.cpp
+++ b/tests/auto/modeltest/dynamictreemodel.cpp
@@ -63,6 +63,13 @@ QModelIndex DynamicTreeModel::index(int row, int column, const QModelIndex &pare
QList<QList<qint64> > childIdColumns = m_childItems.value(parent.internalId());
+ const qint64 grandParent = findParentId(parent.internalId());
+ if (grandParent >= 0) {
+ QList<QList<qint64> > parentTable = m_childItems.value(grandParent);
+ Q_ASSERT(parent.column() < parentTable.size());
+ QList<qint64> parentSiblings = parentTable.at(parent.column());
+ Q_ASSERT(parent.row() < parentSiblings.size());
+ }
if (childIdColumns.size() == 0)
return QModelIndex();