I have the following C++ model structure:
Manager // QAbstractListModel
↪ Slot // QAbstractListModel
↪ Processor // QAbstractListModel
↪ name // Q_PROPERTY
I pass only the Manager
reference to QML on instantiation. I need to fill the ComboBox
with Processor
names but I don't know how to fill up with this nested structure.
Here is the code I plan to have (but is not working now):
ComboBox {
model: Repeater {
model: manager
delegate: Repeater {
model: slot
delegate:Repeater {
model: processor
delegate: ListModel {
ListElement {text: name}
}
}
}
}
}
I know that delegates are for specifying how to display data (and that's why ComboBox
doesn't have this one), but I'm out of ideas how to implement this correctly.
So my question is: how to fill up a ListModel
recursively?