diff options
author | Martin Jones <martin.jones@nokia.com> | 2010-08-27 04:57:02 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2010-08-27 04:57:02 (GMT) |
commit | c43cf8ad4f1ba7d6d9e2403520a7e54ceadee60c (patch) | |
tree | ca764dc2ccab18073debb909acd6f094a6f8b881 /src/declarative | |
parent | 94d7ec29f177665e8e2a218a161df517f3ae51d5 (diff) | |
download | Qt-c43cf8ad4f1ba7d6d9e2403520a7e54ceadee60c.zip Qt-c43cf8ad4f1ba7d6d9e2403520a7e54ceadee60c.tar.gz Qt-c43cf8ad4f1ba7d6d9e2403520a7e54ceadee60c.tar.bz2 |
Fix VisualDataModel model update handling when rootIndex is specified.
Task-number: QTBUG-13038
Diffstat (limited to 'src/declarative')
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp index b4e8bda..a46ee73 100644 --- a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp +++ b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp @@ -1305,24 +1305,27 @@ void QDeclarativeVisualDataModel::_q_itemsMoved(int from, int to, int count) void QDeclarativeVisualDataModel::_q_rowsInserted(const QModelIndex &parent, int begin, int end) { - if (!parent.isValid()) + Q_D(QDeclarativeVisualDataModel); + if (parent == d->m_root) _q_itemsInserted(begin, end - begin + 1); } void QDeclarativeVisualDataModel::_q_rowsRemoved(const QModelIndex &parent, int begin, int end) { - if (!parent.isValid()) + Q_D(QDeclarativeVisualDataModel); + if (parent == d->m_root) _q_itemsRemoved(begin, end - begin + 1); } void QDeclarativeVisualDataModel::_q_rowsMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationRow) { + Q_D(QDeclarativeVisualDataModel); const int count = sourceEnd - sourceStart + 1; - if (!destinationParent.isValid() && !sourceParent.isValid()) { + if (destinationParent == d->m_root && sourceParent == d->m_root) { _q_itemsMoved(sourceStart, destinationRow, count); - } else if (!sourceParent.isValid()) { + } else if (sourceParent == d->m_root) { _q_itemsRemoved(sourceStart, count); - } else if (!destinationParent.isValid()) { + } else if (destinationParent == d->m_root) { _q_itemsInserted(destinationRow, count); } } @@ -1330,7 +1333,7 @@ void QDeclarativeVisualDataModel::_q_rowsMoved(const QModelIndex &sourceParent, void QDeclarativeVisualDataModel::_q_dataChanged(const QModelIndex &begin, const QModelIndex &end) { Q_D(QDeclarativeVisualDataModel); - if (!begin.parent().isValid()) + if (begin.parent() == d->m_root) _q_itemsChanged(begin.row(), end.row() - begin.row() + 1, d->m_roles); } |