I want to add a checkbox toggle to my application where a tree view gets flattened to show only the leafs nodes (child items with no children). When the toggle is unselected it should go back to the original treeview.
Something like this:
A
-B
-C
-D
-E
-F
-G
-H
-I
-K
Should become
-C
-E
-F
-K
The desired outcome should be similar to doing setIndentation(0) when the check box is toggled and setIndentation(20) when unchecked but only the children should be visible when checked and back to the original treeview when unchecked.
Other similar questions use KDE's KDescendantsProxyModel but for that you provide the depth level to show but in my case children can be at any depth level. And I am ideally looking for a solution involving only Qt APIs.
Is there a way I can use QSortProxyFilters to accomplish this?
Any thoughts/ suggestions?
Bookmarks