在这个qml代码中:
Component {
id: userdelegate
PictureBox {
...
icon: model.icon
icon.heigth: 50
}
}
PictureBox
以这种方式来自 PictureBox.qml
系统文件:
...
Image {
id: icon
...
width: parent.width; height: 150
}
运行qml,我在 Headers 中有错误 . 我需要使用 PictureBox.qml
,但我无法改变它 . 如何覆盖 PictureBox.qml
图标的默认高度值?
1 回答
您可以尝试绕过QML 's scoping rules by traversing Item children until you can find the Image and manipulate it directly. It'可能会在未来中断,但
item.toString()
为您提供了一些有用的东西:所以,你可以尝试这样的东西(未测试):
像这样使用它: