简体   繁体   English

QtQuick:在TreeView中更改展开图标

[英]QtQuick: Change expand icon in TreeView

I want to exchange the standard expand icon in a TreeView, is that possible? 我想在TreeView中交换标准的展开图标,这可能吗? I guess I would need to define states for the image. 我想我需要为图像定义状态。

You can provide branchDelegate in TreeViewStyle and use styleData.isExpanded to determine its state. 您可以在TreeViewStyle提供branchDelegate ,并使用styleData.isExpanded确定其状态。 For example, 例如,

TreeView {
    style: TreeViewStyle {
        branchDelegate: Rectangle {
            width: 15; height: 15
            color: styleData.isExpanded ? "red" : "green"
        }
    }
    //...
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM