is it possible to create a GridView in qml which its childs defined in model, so i can have a complete dynamic child view for my GridView items, for example i want to have 10 different rectangle defined in model to be data of my delegate.
for this ,i want to create a GridView and set delegate's data
property from model
GridView {
model: ListModel{
ListElement{
childs:Item{
// data is a list<Object> , so item here is wrong
//this part is wrong i am looking for correct way of doing this
//error : cannot contain nested elements
Button{
}
Button{
}
}
}
}
delegate: Rectangle{
data:childs
}
}
this code explains logic of my question. but its not correct.
my model items will be inside rectangle but its childs are completly dynamic it could be 100 items which i dont know about them.
or another approach to ask this question is "Can i have a Component inside ListModel?"
update
so if i want to use this it will end up like this "lets say file name is MyWidget" :
MyWidget{
model:ListModel{
//and here we go how can i set data of GridView's delegate
}
}