diff options
author | Olivier Goffart <ogoffart@trolltech.com> | 2009-04-16 15:29:36 (GMT) |
---|---|---|
committer | Olivier Goffart <ogoffart@trolltech.com> | 2009-04-16 15:40:35 (GMT) |
commit | d1221d84714a169e12192cfa073af11db61bfbcc (patch) | |
tree | 2ba6b2185a0b843271cbd7db8723e9c325575d33 /src/gui/itemviews | |
parent | 139265031939d676f049edd2c91918040e0659b4 (diff) | |
download | Qt-d1221d84714a169e12192cfa073af11db61bfbcc.zip Qt-d1221d84714a169e12192cfa073af11db61bfbcc.tar.gz Qt-d1221d84714a169e12192cfa073af11db61bfbcc.tar.bz2 |
QSortFilterProxyModel: In dynamic filter model, childs of temporarly
filtered items are not correctly updated.
when filtering away a row, we should remove all the mapping of the
children
Task-number: 251296
Reviewed-by: Marius Bugge Monsen
Diffstat (limited to 'src/gui/itemviews')
-rw-r--r-- | src/gui/itemviews/qsortfilterproxymodel.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/gui/itemviews/qsortfilterproxymodel.cpp b/src/gui/itemviews/qsortfilterproxymodel.cpp index 2c9eeea..a1d35b0 100644 --- a/src/gui/itemviews/qsortfilterproxymodel.cpp +++ b/src/gui/itemviews/qsortfilterproxymodel.cpp @@ -1032,9 +1032,21 @@ void QSortFilterProxyModelPrivate::_q_sourceDataChanged(const QModelIndex &sourc } } - if (!source_rows_remove.isEmpty()) + if (!source_rows_remove.isEmpty()) { remove_source_items(m->proxy_rows, m->source_rows, source_rows_remove, source_parent, Qt::Vertical); + QSet<int> source_rows_remove_set = source_rows_remove.toSet(); + QVector<QModelIndex>::iterator it = m->mapped_children.begin(); + while (it != m->mapped_children.end()) { + const QModelIndex source_child_index = *it; + if (source_rows_remove_set.contains(source_child_index.row())) { + it = m->mapped_children.erase(it); + remove_from_mapping(source_child_index); + } else { + ++it; + } + } + } if (!source_rows_resort.isEmpty()) { // Re-sort the rows |