commit f82f98cb824955794ff3501849406e4806196527 Author: Albert Astals Cid Date: Thu Oct 3 11:12:53 2013 +0200 Fix rowsInserted not being emmited in some cases in QSortFilterProxyModel If the source model of the QSortFilterProxyModel it happened that the mapping for the root was not created since mapFromSource does not create it if the model index is not valid. This made _q_sourceDataChanged go into the // Don't care, since we don't have mapping for this index if and not emit the new row that was inserted because of the data change Change-Id: I2b410cc793568ddf7a1083c4252ee7fa3e90fe46 diff --git a/src/corelib/itemmodels/qsortfilterproxymodel.cpp b/src/corelib/itemmodels/qsortfilterproxymodel.cpp index 67b0d98..1235da3 100644 --- a/src/corelib/itemmodels/qsortfilterproxymodel.cpp +++ b/src/corelib/itemmodels/qsortfilterproxymodel.cpp @@ -1435,8 +1435,11 @@ void QSortFilterProxyModelPrivate::_q_sourceRowsMoved( QList parents; parents << q->mapFromSource(sourceParent); - if (sourceParent != destParent) - parents << q->mapFromSource(destParent); + create_mapping(sourceParent); + if (sourceParent != destParent) { + parents << q->mapFromSource(destParent); + create_mapping(destParent); + } emit q->layoutChanged(parents); }