Skip to content

Commit e0b60d5

Browse files
committed
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.
1 parent af532b2 commit e0b60d5

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Userland/Libraries/LibGUI/FilteringProxyModel.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ Variant FilteringProxyModel::data(ModelIndex const& index, ModelRole role) const
4141
if ((size_t)index.row() > m_matching_indices.size() || index.row() < 0)
4242
return {};
4343

44-
return m_matching_indices[index.row()].data(role);
44+
// FIXME: Support hierarchical models (with a non-empty index.parent()).
45+
auto underlying_index = m_model->index(m_matching_indices[index.row()].row(), index.column(), {});
46+
return underlying_index.data(role);
4547
}
4648

4749
void FilteringProxyModel::invalidate()

0 commit comments

Comments
 (0)