[Development] QSortFilterProxyModel: recursiveFilteringEnabled

SanthoshKumar Selvaraj santhosh.kumar.selvaraj at qt.io
Wed Sep 20 16:17:41 CEST 2023


Hi Lazlo,

How about  adding a custom proxy model that inherits from QSortFilterProxyModel and override filterAcceptRow() for required data (like here adding a condition to validate for leaf node)?

>From the stack overflow, I see your comment, that in practice it's not possible, why do you think so?

Regards,
Santhosh.

From: Development <development-bounces at qt-project.org> On Behalf Of László Papp
Sent: 20 September 2023 15:55
To: development at qt-project.org
Subject: [Development] QSortFilterProxyModel: recursiveFilteringEnabled

Hi,

Would it make sense to split this property into two?

https://doc.qt.io/qt-6/qsortfilterproxymodel.html#recursiveFilteringEnabled-prop

A use case would be something like this:

https://stackoverflow.com/questions/3384005/qt-table-and-tree-view-with-the-same-model

You want to show the leaf nodes of a selected branch node of a tree view in a table view. Or all leaf nodes from the tree in the table view as in the above Stack Overflow question.

Currently, you need to set recursiveFilteringEnabled to true because:

> This property holds whether the filter to be applied recursively on children

Otherwise, the leaf nodes will not be checked, or any embedded branch node. But the problem is then this:

> and for any matching child, its parents will be visible as well.

I would not like to have the parents visible, only the leaf like in the above Stack Overflow question.

Thoughts? Thanks.

Kind regards,
László
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20230920/30d6717d/attachment-0001.htm>


More information about the Development mailing list