ListModel{
id: myFlowListModel
}
Component{
id: myDelegate
Rectangle{
width: 92
height: 60
color: "transparent"
Image {
id: qwname
source: myImg
width: 92
height: 53
}
Text {
id: helloText
text: myString
font.pixelSize: 12
}
}
}
ScrollView{
anchors.top: parent.top
anchors.topMargin: 30
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.right: parent.right
clip: true
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
Flow{
id: myFlow
anchors.left: parent.left
anchors.leftMargin: 20
anchors.top: parent.top
width: outSideRec.width - 40
height: parent.height
spacing: 10
visible: true
Repeater{
model: myFlowListModel
delegate: myDelegate
}
}
repeater的delegate中最外层只能有一个控件,然后repeater会重复创建这个控件,但是如果没有最外层的rectangle包裹,就同时需要重复创建img和text,repeater无法创建