Qt 控制分支指示器内图像的可见性
在树状视图中,我观察到分支指示器的这种行为: 我打算控制分支指示器图像的可见性,而不管是否有孩子。我该怎么做 我正在为我的设置可见性,但它们没有生效:Qt 控制分支指示器内图像的可见性,qt,qml,Qt,Qml,在树状视图中,我观察到分支指示器的这种行为: 我打算控制分支指示器图像的可见性,而不管是否有孩子。我该怎么做 我正在为我的设置可见性,但它们没有生效: TreeView { ... style: TreeViewStyle { indentation: 25 branchDelegate: Item { visible: true // ** visible width: 20
TreeView {
...
style: TreeViewStyle {
indentation: 25
branchDelegate: Item {
visible: true // ** visible
width: 20
height: 10
Image {
// I want this image to be visible only if item has children:
visible: styleData.hasChildren
width: 10
height: 10
...
source: "images/arrow.png"
transform: Rotation {
origin.x: 10 / 2
origin.y: 10 / 2
angle: styleData.isExpanded ? 0 : -90
}
}
Image {
// I want this image to be always visible:
visible: true
width: 10
height: 10
...
}
}
}
...
}