mirror of
https://github.com/RGBCube/serenity
synced 2025-05-15 04:14:58 +00:00
LibGUI: Add SortingProxyModel::sort_role()
This allows you to specify a role to sort by. Defaults to Role::Sort. Also reordered the Role enum so that Role::Custom is last.
This commit is contained in:
parent
d851863704
commit
a5799ed462
3 changed files with 7 additions and 3 deletions
|
@ -112,8 +112,8 @@ void SortingProxyModel::resort()
|
|||
return;
|
||||
}
|
||||
quick_sort(m_row_mappings, [&](auto row1, auto row2) -> bool {
|
||||
auto data1 = target().data(target().index(row1, m_key_column), Model::Role::Sort);
|
||||
auto data2 = target().data(target().index(row2, m_key_column), Model::Role::Sort);
|
||||
auto data1 = target().data(target().index(row1, m_key_column), m_sort_role);
|
||||
auto data2 = target().data(target().index(row2, m_key_column), m_sort_role);
|
||||
if (data1 == data2)
|
||||
return 0;
|
||||
bool is_less_than;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue