summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-08-16 11:10:20 +0200
committerAndreas Kling <kling@serenityos.org>2020-08-16 16:44:09 +0200
commit17992fbab738450c892ee283a642b8f4697fafde (patch)
tree3b50122d9964bd0b8c26a19998b378dbbad056ff
parent6715b696fa898f03da5ad921e3d65167828eb50e (diff)
downloadserenity-17992fbab738450c892ee283a642b8f4697fafde.zip
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.
-rw-r--r--Libraries/LibGUI/SortingProxyModel.cpp5
1 files changed, 4 insertions, 1 deletions
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);
}