From e0b60d56a565ca2eea149d6148da503c9c4d6ddc Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Thu, 27 Jan 2022 19:48:33 +0100 Subject: [PATCH] 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. --- Userland/Libraries/LibGUI/FilteringProxyModel.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Userland/Libraries/LibGUI/FilteringProxyModel.cpp b/Userland/Libraries/LibGUI/FilteringProxyModel.cpp index 68f5643169..9143910c0f 100644 --- a/Userland/Libraries/LibGUI/FilteringProxyModel.cpp +++ b/Userland/Libraries/LibGUI/FilteringProxyModel.cpp @@ -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) 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()