Reorder results after filtering data using QSortFilterProxyModel
-
Is it possible to reorder the results gotten from filtering data using QSortFilterProxyModel?
I have a treemodel:
- parentitem
- childitem
- childitem
- parentitem
- childitem
- childitem
etc
I want to apply a QSortFilterProxyModel to this so that I can allow users to search the tree data, then I want to restructure the result from filtering the data so that I end up with this:
-
childitem
-
childitem
-
parentitem
- childitem
- childitem
All child items that matched the search will be shown as root level items.
All parent items that match the search will be shown including all there child items even if they do not match the search.After much head scratching I don't think this can be done using QSortFilterProxyModel, if not how can I achieve the desired result?
- parentitem