summaryrefslogtreecommitdiffstats
path: root/src/gui/itemviews/qsortfilterproxymodel.cpp
diff options
context:
space:
mode:
authorOlivier Goffart <olivier.goffart@nokia.com>2011-02-25 14:06:57 +0100
committerOlivier Goffart <olivier.goffart@nokia.com>2011-02-25 16:09:29 +0100
commite77e820191919aaf54c85f599cf71cfbecd1ee14 (patch)
treedfd3813109be589144a247916e84ee53f7081ded /src/gui/itemviews/qsortfilterproxymodel.cpp
parent92d7aebf897f93e7de6f1db16d0b8b12e4eeb37a (diff)
QSortFilterProxyModel::reset() should invalidate.
This was broken by: d149a3faca9b97ce806249bc7ef73fe2f59589d5 The connection was removed in that commit because we did not want the layoutChanged signal to be emitted. So instead of calling invalidate(), we call clearMapping() directly. In order to do that, clear_mapping has been turned into a private slot Task-number: QTBUG-17812 Reviewed-by: Gabriel
Diffstat (limited to 'src/gui/itemviews/qsortfilterproxymodel.cpp')
-rw-r--r--src/gui/itemviews/qsortfilterproxymodel.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/gui/itemviews/qsortfilterproxymodel.cpp b/src/gui/itemviews/qsortfilterproxymodel.cpp
index e54cbd24d5..9f89bf5bf8 100644
--- a/src/gui/itemviews/qsortfilterproxymodel.cpp
+++ b/src/gui/itemviews/qsortfilterproxymodel.cpp
@@ -227,7 +227,7 @@ public:
void _q_sourceColumnsRemoved(const QModelIndex &source_parent,
int start, int end);
- void clear_mapping();
+ void _q_clearMapping();
void sort();
bool update_source_sort_column();
@@ -281,7 +281,7 @@ typedef QHash<QModelIndex, QSortFilterProxyModelPrivate::Mapping *> IndexMap;
void QSortFilterProxyModelPrivate::_q_sourceModelDestroyed()
{
QAbstractProxyModelPrivate::_q_sourceModelDestroyed();
- clear_mapping();
+ _q_clearMapping();
}
void QSortFilterProxyModelPrivate::remove_from_mapping(const QModelIndex &source_parent)
@@ -293,7 +293,7 @@ void QSortFilterProxyModelPrivate::remove_from_mapping(const QModelIndex &source
}
}
-void QSortFilterProxyModelPrivate::clear_mapping()
+void QSortFilterProxyModelPrivate::_q_clearMapping()
{
// store the persistent indexes
QModelIndexPairList source_indexes = store_persistent_indexes();
@@ -1223,7 +1223,7 @@ void QSortFilterProxyModelPrivate::_q_sourceReset()
{
Q_Q(QSortFilterProxyModel);
invalidatePersistentIndexes();
- clear_mapping();
+ _q_clearMapping();
// All internal structures are deleted in clear()
q->endResetModel();
update_source_sort_column();
@@ -1519,6 +1519,7 @@ QSortFilterProxyModel::QSortFilterProxyModel(QObject *parent)
d->filter_column = 0;
d->filter_role = Qt::DisplayRole;
d->dynamic_sortfilter = false;
+ connect(this, SIGNAL(modelReset()), this, SLOT(_q_clearMapping()));
}
/*!
@@ -1620,7 +1621,7 @@ void QSortFilterProxyModel::setSourceModel(QAbstractItemModel *sourceModel)
connect(d->model, SIGNAL(modelAboutToBeReset()), this, SLOT(_q_sourceAboutToBeReset()));
connect(d->model, SIGNAL(modelReset()), this, SLOT(_q_sourceReset()));
- d->clear_mapping();
+ d->_q_clearMapping();
endResetModel();
if (d->update_source_sort_column() && d->dynamic_sortfilter)
d->sort();
@@ -2311,7 +2312,7 @@ void QSortFilterProxyModel::clear()
{
Q_D(QSortFilterProxyModel);
emit layoutAboutToBeChanged();
- d->clear_mapping();
+ d->_q_clearMapping();
emit layoutChanged();
}
@@ -2326,7 +2327,7 @@ void QSortFilterProxyModel::invalidate()
{
Q_D(QSortFilterProxyModel);
emit layoutAboutToBeChanged();
- d->clear_mapping();
+ d->_q_clearMapping();
emit layoutChanged();
}