如何知道 TreeView 节点何时关闭(未展开)

How to know when a TreeView Node is closed ( not Expanded)

我在文档 TreeView doc 中发现您可以使用 onExpanded 来知道 TreeView 中的 Node 何时是 expanded 但您如何才能知道知道什么时候 Nodeclosed 吗?

代码示例:

TreeView {
    TableViewColumn {
        title: "Name"
        role: "fileName"
        width: 300
    }
    TableViewColumn {
        title: "Permissions"
        role: "filePermissions"
        width: 100
    }
    model: fileSystemModel

    onExpanded {
       console.log("expanded :" + index)
    }
}

the documentation开始,onCollapsedonExpanded相反,因此您可以检查该信号何时发出。