summaryrefslogtreecommitdiffstats
path: root/src/corelib/itemmodels/qsortfilterproxymodel.cpp
diff options
context:
space:
mode:
authorDavid Faure <david.faure@kdab.com>2021-10-01 09:34:07 +0200
committerDavid Faure <david.faure@kdab.com>2021-10-05 17:53:04 +0200
commita5073956f89f47493cb17d162c8d51821c5368f1 (patch)
treeba8ad4f74debdf03d9b2d7bacc015a53585351a0 /src/corelib/itemmodels/qsortfilterproxymodel.cpp
parent0263cfdfa0162162df07d4a15f896c20a6aac9d2 (diff)
QSFPM: remove redundant call to update_source_sort_column()
Everywhere else in this code, it says if (update_source_sort_column() && dynamic_sortfilter) so, doing the same here. This originally comes from commit 3ffcfc357dbc51bf62ffb but skelly isn't around anymore, and Milian (reviewer) had no objection to this change either. Looking into the implementation, calling it twice is a no-op anyway, create_mapping will early-return with "already done". On the other hand, now it has a chance of returning true, while before it would always return false in the second call ("return true if the column was changed"). I couldn't write a unittest for that case though, it would require that a source reset also changes the proxy->source column mapping somehow, but I don't see how that can be done (the latter being the QSFPM setup). Change-Id: Ie560facf1039a1afc02543e83bfdef0f8f2e09fc Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/corelib/itemmodels/qsortfilterproxymodel.cpp')
-rw-r--r--src/corelib/itemmodels/qsortfilterproxymodel.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/corelib/itemmodels/qsortfilterproxymodel.cpp b/src/corelib/itemmodels/qsortfilterproxymodel.cpp
index bc2d83a6bc..9ee438d699 100644
--- a/src/corelib/itemmodels/qsortfilterproxymodel.cpp
+++ b/src/corelib/itemmodels/qsortfilterproxymodel.cpp
@@ -1623,8 +1623,7 @@ void QSortFilterProxyModelPrivate::_q_sourceReset()
_q_clearMapping();
// All internal structures are deleted in clear()
q->endResetModel();
- update_source_sort_column();
- if (dynamic_sortfilter && update_source_sort_column())
+ if (update_source_sort_column() && dynamic_sortfilter)
sort();
}