LibGUI+DevTools+Applications: Use ModelIndex::data() in many places

This way you don't have to keep track of which model it came from.
This commit is contained in:
Andreas Kling 2020-08-16 16:14:39 +02:00
parent 96f98b1fc9
commit 9102b624ac
Notes: sideshowbarker 2024-07-19 03:33:02 +09:00
18 changed files with 56 additions and 57 deletions

View file

@ -130,8 +130,8 @@ StringView SortingProxyModel::drag_data_type() const
bool SortingProxyModel::less_than(const ModelIndex& index1, const ModelIndex& index2) const
{
auto data1 = index1.model() ? index1.model()->data(index1, m_sort_role) : Variant();
auto data2 = index2.model() ? index2.model()->data(index2, m_sort_role) : Variant();
auto data1 = index1.data(m_sort_role);
auto data2 = index2.data(m_sort_role);
if (data1.is_string() && data2.is_string())
return data1.as_string().to_lowercase() < data2.as_string().to_lowercase();
return data1 < data2;