mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-02-24 00:24:38 +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:
@@ -37,7 +37,8 @@
|
||||
namespace GUI {
|
||||
|
||||
AbstractView::AbstractView()
|
||||
: m_selection(*this)
|
||||
: m_sort_order(SortOrder::Ascending)
|
||||
, m_selection(*this)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -400,4 +401,13 @@ void AbstractView::set_multi_select(bool multi_select)
|
||||
}
|
||||
}
|
||||
|
||||
void AbstractView::set_key_column_and_sort_order(int column, SortOrder sort_order)
|
||||
{
|
||||
m_key_column = column;
|
||||
m_sort_order = sort_order;
|
||||
|
||||
if (model())
|
||||
model()->sort(column, sort_order);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user