From 2a390bb481a2433a239a9198e463c9337a26db59 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 25 May 2009 18:32:46 +0200 Subject: Fixed: QSortFilterProxyModel setDynamicSortFilter doesn't works when setting the model initially This was caused by two different bug: - In the QSortFilterProxyModel, we need to re-sort when setting the source model change the sorting column (happen when setting a model initially) - In the treeview, we need to activate the sorting even if there is no column yet (because the initial model is empty Task-number: 254234 Reviewed-by: Thierry BT: --- src/gui/itemviews/qsortfilterproxymodel.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/gui/itemviews/qsortfilterproxymodel.cpp') diff --git a/src/gui/itemviews/qsortfilterproxymodel.cpp b/src/gui/itemviews/qsortfilterproxymodel.cpp index 43feda84b2..92dfd19a00 100644 --- a/src/gui/itemviews/qsortfilterproxymodel.cpp +++ b/src/gui/itemviews/qsortfilterproxymodel.cpp @@ -1518,7 +1518,8 @@ void QSortFilterProxyModel::setSourceModel(QAbstractItemModel *sourceModel) d->clear_mapping(); reset(); - d->update_source_sort_column(); + if (d->update_source_sort_column() && d->dynamic_sortfilter) + d->sort(); } /*! -- cgit v1.2.3