Reputation: 602
I'm currently writing a prototype of an AVOD Portal application for embedded systems using Qt and QML.
Basically, I have a catalog of media (music, stream, movies etc.). I plan to have different views of media according to the choice of the users:
For that purpose, I plan to implement a QAbstractListModel
to implement my whole catalog.
And then, I plan to implement different QSortFilterProxyModel
objects to filter the display accord the choice of the user (see. above).
I have been using MVC with Qt for a while but I never used the proxy-model. So before getting into the code, I'm wondering if it is a reliable solution and if it fits with the integration of the models into QML ?
Z.
Upvotes: 2
Views: 212
Reputation: 98505
A proxy model is a model that happens to query other models behind the scenes. That a model is a proxy is an implementation detail invisible to the user of the model (e.g. to the view). There's nothing otherwise special about a model being a proxy from the model user's point of view. A proxy model is "just" a QAbstractItemModel
with some convenience code added if you happen to derive from one of the proxy base classes.
In other words, there isn't much to a proxy model: it must fulfill all of the requirements placed on a QAbstractItemModel
, because it is one.
So yes, your approach will work.
Upvotes: 1
Reputation: 24416
I'm wondering if it is a reliable solution and if it fits with the integration of the models into QML?
Yes and yes.
Upvotes: 2