我需要QML ListView中的元素之间的边距.有了这段代码,我得到了elemts列的边距,但我需要在每个元素之间留有余量:
ListModel {
id: listModel
ListElement {
name: "Apple"
}
ListElement {
name: "Banana"
}
}
Component {
id: listDelegate
Rectangle {
width: 250; height: 100
anchors.margins: 30
color: "green"
Text {
id: itexItem
anchors.leftMargin: 20
anchors.verticalCenter: parent.verticalCenter
font.pixelSize: 40
text: name
}
}
}
ListView {
id: listView
anchors.fill: parent;
anchors.margins: 50
model: listModel
delegate: listDelegate
focus: true
}
Run Code Online (Sandbox Code Playgroud)
我在列表元素框之间得到了保证金.它运作正常吗 我需要ListView的每个元素之间的边距.我需要列如下:
Element "Apple"
margin
Element "Banana"
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6152 次 |
| 最近记录: |