Reviewing merge request #2262: Ensure complete mappings are created for first children of parent QModelIndexes
This commit is for creating mappings properly in QSortFilterProxyModel when creating new rows in a parent QModelIndex which did not have any child items before.
Without it QSFPM does not have complete mappings and returns an invalid QModelIndex when it should not sometimes.
Commits that would be merged:
- 0a4f8a7
- 6c3fa69
Make sure mappings are created for columns when indexes newly become parents.
0a4f8a7-6c3fa69Comments
Wouldn’t it be better to just call create_mapping or something similair, and return ?
Not really. There’s already a mapping for source_parent, which means create_mapping would be an early return.
We could do this:
beginInsertRows(proxy_parent, 0, proxy_rows);
remove_from_mapping(source_parent);
create_mapping(source_parent)
endInsertRows();
return;
But then we'd need to loop and do filterAcceptsRow to calculate proxy_rows, and then do the same loop again in create_mapping.
We could build the in source_rows for the Mapping in source_items_inserted and pass it as an optional argument to create_mapping, but I'm not sure that’s a better solution.
Please put the test in the QSortFilterProxy model test.
Also remove the qDebug()
And the Qt coding style put the { on the same line as the if.
Merged into oslo-staging-2
315c09c3873f7c5d8b785443372bf975bae47ee7


Add a new comment:
Login or create an account to post a comment