On 20.04.2012 10:42, Artem Marchenko wrote: > Indeed it is so. To be precise, there are two conceptually different, > yet related models. > > 1. One is to have a contact list coming from the messenger API. OK, I > add a couple of custom properties, yet it is still pretty much an > external contact list and it would be good to keep it this way - easier > to verify, easier to sync (I don't trust messenger API much, so it's > good to have isolated point of contact). > > 2. Another one is the model for list shown in the UI. That can have an > extra item (my own contacts) or maybe even hide some item (voice test > contact always provided by a messenger). > > These two models are indeed conceptually different yet one can be > transformed into another one using a couple of clear and simple rules. > > *Options* > So what I am asking for is an advice (or maybe somebody even has similar > experience) on how to do such a transformation. One possibility is to to > make 2nd model in a pure QML (manipulate ListModel whenever c++ model > changes). Another one is to have 2nd model in C++. Another option is to > have just one model on a C++ side, inject and remove items there and/or > maybe have special attribute to tell whether a particular item is hidden.
Isn't it, that (1) is a pure data model and (2) is a view model, so (2) should be a kind of proxy model relying on (1)? You will need to separate those anyways as soon as you want to show two different lists both based on filtered data of (1) but differently sorted for example. QAbstractProxyModel is made for this, if I'm not mistaken, but I never used it before. BR Sven _______________________________________________ Qt-qml mailing list Qt-qml@qt.nokia.com http://lists.qt.nokia.com/mailman/listinfo/qt-qml