I have a ListView (A) that on it's delegate has another ListView (B). How can (B) objects change when the user changes from one item to another in (A)?
For exemple:
Imagine that I have a list of persons, and every person has a list of cars:
- Person1 - car1, car2, car3
- Person2 - car4
- Person3 - car5, car6, car7, car8
- Person4 - car9, car10
...
The QML has a ListView (A) that it's delegate has another ListView (B). The parent ListView (A) shows the Person data, and the detail ListView (B) must show the cars of that person.
// A ListView
ListView {
model: personModels
delegate: Row {
Text {
text: model.name
}
Text {
text: model.street
}
...
// B ListView
ListView {
model: ????
delegate: Row {
Text {
text: model.carColor
}
}
}
}
}
// A ListView
ListView {
model: personModels
delegate: Row {
Text {
text: model.name
}
Text {
text: model.street
}
...
// B ListView
ListView {
model: ????
delegate: Row {
Text {
text: model.carColor
}
}
}
}
}
To copy to clipboard, switch view to plain text mode
The problem is that the second ListView must change the model for every item in ListView A.
How can I do it?
Bookmarks