1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-10 18:10:56 +09:00

LibGUI: Associate model index metadata directly with the model index

This was using internal_data beforehand, which relies on the internal
data to be distinct for different model indices. That's not the case for
example for SortingProxyModel. Using the model index directly makes tree
expansion work properly when using a tree table widget with a
SortingProxyModel.
This commit is contained in:
kleines Filmröllchen 2022-04-05 00:16:49 +02:00 committed by Andreas Kling
parent fc6ffbc006
commit d813bf77ee
Notes: sideshowbarker 2024-07-17 14:20:45 +09:00
2 changed files with 3 additions and 3 deletions

View file

@ -25,12 +25,12 @@ struct TreeView::MetadataForIndex {
TreeView::MetadataForIndex& TreeView::ensure_metadata_for_index(ModelIndex const& index) const
{
VERIFY(index.is_valid());
auto it = m_view_metadata.find(index.internal_data());
auto it = m_view_metadata.find(index);
if (it != m_view_metadata.end())
return *it->value;
auto new_metadata = make<MetadataForIndex>();
auto& new_metadata_ref = *new_metadata;
m_view_metadata.set(index.internal_data(), move(new_metadata));
m_view_metadata.set(index, move(new_metadata));
return new_metadata_ref;
}