summaryrefslogtreecommitdiffstats
path: root/src/gui/itemviews/qsortfilterproxymodel.cpp
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@trolltech.com>2009-04-16 17:29:36 +0200
committerOlivier Goffart <ogoffart@trolltech.com>2009-04-16 17:40:35 +0200
commitd1221d84714a169e12192cfa073af11db61bfbcc (patch)
tree2ba6b2185a0b843271cbd7db8723e9c325575d33 /src/gui/itemviews/qsortfilterproxymodel.cpp
parent139265031939d676f049edd2c91918040e0659b4 (diff)
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/qsortfilterproxymodel.cpp')
-rw-r--r--src/gui/itemviews/qsortfilterproxymodel.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/gui/itemviews/qsortfilterproxymodel.cpp b/src/gui/itemviews/qsortfilterproxymodel.cpp
index 2c9eeeaf7b..a1d35b0cae 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