From 17992fbab738450c892ee283a642b8f4697fafde Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sun, 16 Aug 2020 11:10:20 +0200 Subject: [PATCH] LibGUI: Resort SortingProxyModel when source invalidates if possible If the source model invalidates with indexes still good, we can simply resort the proxy's mappings. --- Libraries/LibGUI/SortingProxyModel.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Libraries/LibGUI/SortingProxyModel.cpp b/Libraries/LibGUI/SortingProxyModel.cpp index e25f179b8d..0752dc1206 100644 --- a/Libraries/LibGUI/SortingProxyModel.cpp +++ b/Libraries/LibGUI/SortingProxyModel.cpp @@ -44,7 +44,10 @@ SortingProxyModel::~SortingProxyModel() void SortingProxyModel::invalidate(unsigned int flags) { - m_mappings.clear(); + if (flags == UpdateFlag::DontInvalidateIndexes) + sort(m_last_key_column, m_last_sort_order); + else + m_mappings.clear(); did_update(flags); }