[Development] QSortFilterProxyModel: recursiveFilteringEnabled

renaud.guezennec renaud.guezennec at gmail.com
Sat Oct 21 19:12:15 CEST 2023


Hello,

You can find an example of that in my project.

I have a model storing all players of the game. A player can have one or 
more characters.

The PlayerModel is the tree model.
Header: 
https://invent.kde.org/rolisteam/rolisteam/-/blob/master/src/libraries/core/include/model/playermodel.h
Cpp: 
https://invent.kde.org/rolisteam/rolisteam/-/blob/master/src/libraries/core/src/model/playermodel.cpp

The CharacterModel is the proxy model gathering all characters (leaves 
of the PlayerModel) from all players as a list model.
Header: 
https://invent.kde.org/rolisteam/rolisteam/-/blob/master/src/libraries/core/include/model/charactermodel.h
Cpp: 
https://invent.kde.org/rolisteam/rolisteam/-/blob/master/src/libraries/core/src/model/charactermodel.cpp

The PlayerProxyModel is a proxy model gathering all players as a list 
model (roots of PlayerModel).
Header: 
https://invent.kde.org/rolisteam/rolisteam/-/blob/master/src/libraries/core/include/model/playerproxymodel.h
Cpp: 
https://invent.kde.org/rolisteam/rolisteam/-/blob/master/src/libraries/core/src/model/playerproxymodel.cpp

I also have few proxy model to deal with PlayerProxyModel to show only 
remote players (removing the local player).

Hope it helps.

Regards.


On 21/09/2023 19:44, László Papp wrote:
> Thanks!
>
> Since both QML and KDE have had this use case, and now, I also have 
> it, as well as another person on Stack Overflow, should we propose a 
> public API in Qt for this?
>
> I think this would be a great addition to the public interface.
>
> For now, I will implement my own version, but it sounds like this is 
> common enough to offer it in the public API longer-term.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20231021/a22bc727/attachment.htm>


More information about the Development mailing list