[Qt-interest] QTreeView and QSortFilterProxyModel

Daniel firmware at gmx.de
Tue Mar 24 22:50:58 CET 2009


Hi all,

I have a custom QTreeView and a custom QSortFilterProxyModel with a
reimplemented filterAcceptsRow function.
Assume, the model contains:

- group1
   - item11
   - item12
- group2
   - item21
   - item22

Now I apply a string filter "item2?" only for the items, so group 1 would
empty. This works without problems and results in:

 group1
-group2
   - item21
   - item22

I want the empty toplevel groups to be hidden, e.g.

-group2
   - item21
   - item22

I have tried to determine the number of children that pass the filter within
filterAcceptsRow with no success.
Another approach was to hide the empty toplevel row in the QTreeView
reimplementing drawRow, but this ended up still showing an empty line.

Any ideas, friends?
Daniel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090324/2ae45118/attachment.html 


More information about the Qt-interest-old mailing list