[SOLVED]One-to-Many QProxyModel



  • Hello all!

    Is exist way for creating subclass of QAbstractProxyModel for many-to-one relationship? It means that for each item from source model will be exist several items in proxy model.

    I saw mapFormSource method, but it return strictly only one item for each item in source model. How to return in this method several items or which ways are exist for my target?

    Thanks for your attention!



  • I dont think you can do that and still use lot from QAbstractProxyModel. I think you will have to do your own proxy model directly subclassing from QAbstractItemModel. Basically wrapping your source model in object proxy design pattern. Can be done but it will be non trivial work and good amount of testing.



  • I found a good solution. I can just create subclass from source model and redefine data and setData methods.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.