【发布时间】:2014-08-13 04:40:40
【问题描述】:
我需要 QML ListView 中元素之间的边距。使用此代码,我得到元素列的边距,但我需要每个元素之间的边距:
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
}
我得到列表元素框之间的边距。工作正常吗。我需要 ListView 的每个元素之间的边距。我需要这样的列:
Element "Apple"
margin
Element "Banana"
【问题讨论】: