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:
parent
fc6ffbc006
commit
d813bf77ee
Notes:
sideshowbarker
2024-07-17 14:20:45 +09:00
Author: https://github.com/kleinesfilmroellchen
Commit: d813bf77ee
Pull-request: https://github.com/SerenityOS/serenity/pull/13516
Issue: https://github.com/SerenityOS/serenity/issues/65
2 changed files with 3 additions and 3 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue