I want to change the children of a determined parent node in a QML treeview, I thought to iterate through every child and change the property that I want, but I don't know how to get the children list from a parent. I have the follow QML Menu:
TreeView {
id: tree
anchors.fill: parent
model: model
itemDelegate: CustomNode{
id: node
Menu {
id: menu
MenuItem {
text: "Show"
onTriggered: {
styleData.value.active = !!+state
}
}
}
MouseArea{
anchors.fill: parent
acceptedButtons: Qt.LeftButton
onClicked: {
idNode = styleData.value.vredId
menu.popup()
}
}
}
}
When I click on the node it opens a menu that after clicked in the "Show" button change a property of the selected node, from this node I need to get its children and change the same property that was changed on the parent.
How can I do it?