[Interest] Model/View issue: omit model-entities in qml-view

André Somers andre at familiesomers.nl
Mon Oct 29 17:15:10 CET 2012


Op 29-10-2012 17:12, Tim Bienias schreef:
> Hey guys,
>
> let's say we have one QAbstractListModel consisting of animals in c++. 
> There are water- and land-animals within the model. Now i want to 
> create a view that does show (1)only the land-animals and a view with 
> (2)only the water-animals. There is also a view (3)with some water- 
> and some land-animals.
> The views are made with QML/Quick2.
> How can I achieve this? Is it possible to access just some animals of 
> the model and show them, or does a view (ListView or whatever) show 
> all animals from the model?
> Otherwise i have to create 2 models - one consisting of water-animals 
> and one of land-animals, but that's not what i want and it still 
> would'nt solve (3).
> Please give me a little hint or link.
>
> cheers,
> tim
Proxy models are the key. Start with considdering QSortFilterProxyModel.

André



More information about the Interest mailing list