Pārlūkot izejas kodu

LibGUI: Support hierarchical matches in FilterProxyModel

Fixes crash when searching in Help.
Patch by @eggpi
thankyouverycool 3 gadi atpakaļ
vecāks
revīzija
f3d672d53d
1 mainītis faili ar 2 papildinājumiem un 2 dzēšanām
  1. 2 2
      Userland/Libraries/LibGUI/FilteringProxyModel.cpp

+ 2 - 2
Userland/Libraries/LibGUI/FilteringProxyModel.cpp

@@ -41,8 +41,8 @@ Variant FilteringProxyModel::data(ModelIndex const& index, ModelRole role) const
     if ((size_t)index.row() > m_matching_indices.size() || index.row() < 0)
         return {};
 
-    // FIXME: Support hierarchical models (with a non-empty index.parent()).
-    auto underlying_index = m_model->index(m_matching_indices[index.row()].row(), index.column(), {});
+    auto matching_index = m_matching_indices[index.row()];
+    auto underlying_index = m_model->index(matching_index.row(), index.column(), matching_index.parent());
     return underlying_index.data(role);
 }