2
我正在寻找一种方法来访问在QML中的模型中找到的元素的数量。在QML中使用模型的大小
例如:
Item {
id: root
Row {
id: row
height: root.height
width: root.width
spacing: 5
Repeater {
id: rep
width: root.width
height: root.height
model: [5, 3, 3, 1, 12]
delegate: myDelegate
Text {
id: myDelegate
text: "Element " + index + " of " size + ":" + modelData
}
}
}
但我无法弄清楚如何检索模型的大小。 在文档中我可以找到一个名为count
的属性,但没有提示如何访问它。
谢谢! rep.count像一个魅力。我会立即尝试另一个! – derM