Ginsengelf
19th October 2011, 12:17
Hi, I have a QTreeView with the following structure:
-1
|-A
| |-a
| |-b
|
|-B
| |-a
|
|-C
|-b
I would like to filter this and show only the nodes that contain a "a" item, like this:
-1
|-A
| |-a
|
|-B
|-a
but using a custom QSortFilterProxyModel I only achieved this:
-1
|-A
| |-a
|
|-B
| |-a
|
|-C
which is understandable since my filter condition is applied to the a,b,c items only.
I also tried to filter the filtered output with a second QSortFilterProxyModel, but that did not help since the hasChildren() method for the model indexes always returned 0 and all items got filtered out...
Is there a simple way to completely filter out the nodes that do not contain an "a" item (the "C" node in the example above)?
Thanks,
Ginsengelf
-1
|-A
| |-a
| |-b
|
|-B
| |-a
|
|-C
|-b
I would like to filter this and show only the nodes that contain a "a" item, like this:
-1
|-A
| |-a
|
|-B
|-a
but using a custom QSortFilterProxyModel I only achieved this:
-1
|-A
| |-a
|
|-B
| |-a
|
|-C
which is understandable since my filter condition is applied to the a,b,c items only.
I also tried to filter the filtered output with a second QSortFilterProxyModel, but that did not help since the hasChildren() method for the model indexes always returned 0 and all items got filtered out...
Is there a simple way to completely filter out the nodes that do not contain an "a" item (the "C" node in the example above)?
Thanks,
Ginsengelf