Hi Guys,

I want to display N horizontal lists. I put listview inside of repeater. N is a number of lists and it depends on some data in C++. Each list has its own model. I don't know how to properly register model for each list. Here is some sketch of code:

Qt Code:
  1. Column {
  2. Repeater {
  3. model: ?? // This number (number of lists) depends on some data in C++
  4. Rectangle {
  5. ListView {
  6. orientation: ListView.Horizontal
  7. model: ?? // There will be more than one list --> Question: How to assign different models to list
  8. delegate: Rectangle {
  9. Text {
  10. text: somemodelproperty
  11. }
  12. }
  13. }
  14. }
  15. }
  16. }
To copy to clipboard, switch view to plain text mode 

I've found something like this:

property var subModels: [m1, m2, ... m10]

Then for the ListView inside the repeater delegate you can:

ListView {
model: subModels[index]
// ...
}

but here is specific number of models, and I don't how how many of them I'll have.

In C++, I have implemented QList <DataClass> list, and each list is "bounded" to a ListView by doing something like that:

QQmlContext *ctxt = view.rootContext();

ctxt->setContextProperty("myModel", &serviceList);

Registering one model for one listview is just fine and it's working.