如何设置qml TreeView指标的颜色

问题描述 投票:0回答:1

如何在TreeView中更改指示器的颜色?我尝试使用分支委托

style: TreeViewStyle
{
    branchDelegate: {
        color: "red"
    }
}
qt qml
1个回答
2
投票

考虑到source code为基础,解决方案如下:

style: TreeViewStyle {
    branchDelegate: Item {
        width: indentation
        height: 16
        Text {
            visible: styleData.column === 0 && styleData.hasChildren
            text: styleData.isExpanded ? "\u25bc" : "\u25b6"
            color: "red" //!control.activeFocus || styleData.selected ? styleData.textColor : "#666"
            font.pointSize: 10
            renderType: Text.NativeRendering
            style: Text.PlainText
            anchors.centerIn: parent
            anchors.verticalCenterOffset: 2
        }
    }
}
© www.soinside.com 2019 - 2024. All rights reserved.