When using a ListModel for a repeater, if a property is not set in the first element of the model, then it is not considered in the following elements. Why?
import QtQuick 2.7
import QtQuick.Controls 2.3
Item{
id: root
property var labels: ListModel{}
Button{
text: 'create labels'
onClicked:{
root.labels.append({})
root.labels.append({name: '2'})
root.labels.append({name: '3'})
}
}
Column{
x: 10
y: 200
spacing: 2
Repeater{
model: root.labels
Button{
width: 120
height: 30
text: model.name
}
}
}
}
This code is ok:
....
onClicked:{
root.labels.append({name: '1'})
root.labels.append({})
root.labels.append({name: '3'})
}
....