mirror of
https://github.com/RGBCube/serenity
synced 2025-06-16 20:32:09 +00:00
LibGUI: Make FilteringProxyModel::data() support multi-column data
While the rows are filtered, we can't just return data from column 0 every time, since that breaks underlying multi-column models. Instead, simply forward the incoming index.
This commit is contained in:
parent
af532b22c8
commit
e0b60d56a5
1 changed files with 3 additions and 1 deletions
|
@ -41,7 +41,9 @@ Variant FilteringProxyModel::data(ModelIndex const& index, ModelRole role) const
|
||||||
if ((size_t)index.row() > m_matching_indices.size() || index.row() < 0)
|
if ((size_t)index.row() > m_matching_indices.size() || index.row() < 0)
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
return m_matching_indices[index.row()].data(role);
|
// FIXME: Support hierarchical models (with a non-empty index.parent()).
|
||||||
|
auto underlying_index = m_model->index(m_matching_indices[index.row()].row(), index.column(), {});
|
||||||
|
return underlying_index.data(role);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FilteringProxyModel::invalidate()
|
void FilteringProxyModel::invalidate()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue