mirror of
https://github.com/RGBCube/serenity
synced 2025-05-28 10:15:07 +00:00
LibGUI: Make model sorting imperative and move order to AbstractView
Instead of SortingProxyModel having a column+order, we move that state to AbstractView. When you click on a column header, the view tells the model to resort the relevant column with the new order. This is implemented in SortingProxyModel by simply walking all the reified source/proxy mappings and resorting their row indexes.
This commit is contained in:
parent
370624bc37
commit
e1ed71ef9e
15 changed files with 85 additions and 55 deletions
|
@ -58,7 +58,7 @@ ProcessChooser::ProcessChooser(const StringView& window_title, const StringView&
|
|||
m_table_view = widget.add<GUI::TableView>();
|
||||
auto sorting_model = GUI::SortingProxyModel::create(RunningProcessesModel::create());
|
||||
sorting_model->set_sort_role(GUI::Model::Role::Display);
|
||||
sorting_model->set_key_column_and_sort_order(RunningProcessesModel::Column::PID, GUI::SortOrder::Descending);
|
||||
m_table_view->set_key_column_and_sort_order(RunningProcessesModel::Column::PID, GUI::SortOrder::Descending);
|
||||
m_table_view->set_model(sorting_model);
|
||||
|
||||
m_table_view->on_activation = [this](const ModelIndex& index) { set_pid_from_index_and_close(index); };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue