mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-27 06:48:49 +00:00
LibGUI: Add a way for models to update without invalidating indexes
This is really just a workaround to keep SystemMonitor's process table working right wrt selection retention during resorts (while also doing full index invalidation on things like ProfileViewer inversion.) It's starting to feel like the model abstraction is not super great and we'll need a better approach if we want to actually build some more dynamic functionality into our views.
This commit is contained in:
parent
93f2a4edd3
commit
8e4751a963
Notes:
sideshowbarker
2024-07-19 07:41:21 +09:00
Author: https://github.com/awesomekling
Commit: 8e4751a963
17 changed files with 37 additions and 29 deletions
|
@ -118,7 +118,7 @@ void SortingProxyModel::resort()
|
|||
for (int i = 0; i < row_count; ++i)
|
||||
m_row_mappings[i] = i;
|
||||
if (m_key_column == -1) {
|
||||
did_update();
|
||||
did_update(Model::UpdateFlag::DontInvalidateIndexes);
|
||||
return;
|
||||
}
|
||||
quick_sort(m_row_mappings, [&](auto row1, auto row2) -> bool {
|
||||
|
@ -133,7 +133,7 @@ void SortingProxyModel::resort()
|
|||
is_less_than = data1 < data2;
|
||||
return m_sort_order == SortOrder::Ascending ? is_less_than : !is_less_than;
|
||||
});
|
||||
did_update();
|
||||
did_update(Model::UpdateFlag::DontInvalidateIndexes);
|
||||
for_each_view([&](AbstractView& view) {
|
||||
auto& selection = view.selection();
|
||||
Vector<ModelIndex> selected_indexes_in_target;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue