mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 20:07:35 +00: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
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