继承与Item,用于创建显示大量相同控件,https://blog.csdn.net/qq_26611129/article/details/113933202

属性

  1. //元素个数
  2. count : int
  3. //代理
  4. delegate : Component
  5. //模型
  6. model : any
  7. *A number that indicates the number of delegates to be created by the repeater
  8. *A model (e.g. a ListModel item, or a QAbstractItemModel subclass)
  9. *A string list
  10. *An object list
  1. Repeater{
  2. // model: 3 //模型 数字:表示有几个模型/控件
  3. // Rectangle{
  4. // y: index * 50
  5. // width: 100
  6. // height: 40
  7. // border.width: 1
  8. // color: "yellow"
  9. // }
  10. //数量3 读取list的大小
  11. model: ["button", "rectangle", "mousearea"]
  12. Button{
  13. y: index *50
  14. width:100
  15. height: 40
  16. text: modelData + " " + index
  17. }
  18. }

image.png