From a5073956f89f47493cb17d162c8d51821c5368f1 Mon Sep 17 00:00:00 2001 From: David Faure Date: Fri, 1 Oct 2021 09:34:07 +0200 Subject: [PATCH] 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 --- src/corelib/itemmodels/qsortfilterproxymodel.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/corelib/itemmodels/qsortfilterproxymodel.cpp b/src/corelib/itemmodels/qsortfilterproxymodel.cpp index bc2d83a6bc9..9ee438d6993 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(); }