你能告诉我下面的代码是否有任何方法来改变imgx元素的属性。我必须改变使用JavaScript的imgx.x值。或者还有其他方法吗?我搜索qt文档,但没有帮助。谢谢。如何在QML中访问Repeater儿童的属性?
Row {
Repeater {
id:mmm
model : 10
Rectangle{
clip: true
width: 54
height: 80
color:"transparent"
Image {
id:imgx
//x:-160
//x:-105
//x:-50
x:0
source: "images/tarama_lights.png"
}
}
}
}
谢谢。这非常有帮助。 –
@JuliusG你会如何得到你点击的任何东西的索引? – MrPickles
@MrPickles查看childAt(...)方法:http://doc.qt.io/qt-5/qml-qtquick-item.html#childAt-method – JuliusG