implementing a custom "model" for a view

  • Hi
    I am new to qt (qtquick2 5.10) but got previous experience in .net WPF, with the idea of separating the ViewModel from the view.
    I am in need of having a list of model data where each instantiated item delegate freely can move between a number of different listViews. A custom implementation resembling the DelegateModel where each view can have its own DelegateModelGroup .

    the qt documentation details how to implement/subclass from the QAbstrictItemModel family, for maintaining data changes within a list and it members.
    Implementing this is not a problem and connecting it directly with a ListView, GridView, etc or through the DelegateModel.

    What i cant find any info on in the documentation is how or what the "model" property/type actually works and more important how to implement one for a custom view, to later be hooked up with an implementation of QAbstractItemModel.

    for the following questions assume the use of a QAbstractItemModel to be used, referred to as list:
    a delegate item in a ViewList usually have access to an attached property model/modelData (an index in the list). it is managed by the data(), setData() and roleNames() of the list.
    How would you in C++ attach such an index to be used in the same manor with a custom View implementation for its delegate through an attached property?

Log in to reply