PDA

View Full Version : Changing the branch icon of the Qml TreeView



volcano
13th May 2016, 08:23
Hi all,

I need to modify the branch icon of the treeview. Can you explain me how to go about the same?
I have set a style sheet but can't figure out how to use the branchDelegate.

Kindly advice

Binit Amin
1st June 2018, 08:00
Please let me know if you find the solution...

virago1100
19th November 2020, 12:20
The way I did it, example:

TreeView {
id: treeview
anchors.fill: parent
model: treemodel
style: TreeViewStyle {
branchDelegate: Rectangle {
width: 15; height: 15
Image {
source: styleData.isExpanded ? "images/16px/ArrowDownSmall_black_16px.svg" : "images/16px/ArrowRightSmall_black_16px.svg"
}
}

Simply add a branchDelegate, then in my example I checked isExpanded and put my own images like the example.