1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-15 04:04:59 +00:00

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
18 changed files with 56 additions and 57 deletions

View file

@ -61,7 +61,7 @@ Variant FilteringProxyModel::data(const ModelIndex& index, ModelRole role) const
if ((size_t)index.row() > m_matching_indices.size() || index.row() < 0)
return 0;
return m_model.data(m_matching_indices[index.row()], role);
return m_matching_indices[index.row()].data(role);
}
void FilteringProxyModel::update()
@ -84,7 +84,7 @@ void FilteringProxyModel::filter()
auto filter_matches = m_model.data_matches(index, m_filter_term);
bool matches = filter_matches == TriState::True;
if (filter_matches == TriState::Unknown) {
auto data = m_model.data(index, ModelRole::Display);
auto data = index.data();
if (data.is_string() && data.as_string().contains(m_filter_term))
matches = true;
}