[Qt-interest] QTreeView and QSortFilterProxyModel

Alessandro Vanzulli alessandro.vanzulli at gmail.com
Tue Mar 24 22:59:56 CET 2009


Hi,

one question? How your filterAcceptsRow accept the group1row ??

It shall be discarded from the filter beacuse it does not match with your
filter criteria. Is it correct?If yes, the source of problem is located in
the filterAcceptsRow method.

Bye

Alessandro




2009/3/24 Daniel <firmware at gmx.de>

> 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
>
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090324/744b19aa/attachment.html 


More information about the Qt-interest-old mailing list