Is there a way to create a model for TreeView in pure Qml (without using C++)
Solved
QML and Qt Quick
-
I managed to list two nodes in my TreeView using ListModel and ListElement. But I could not try to display a hierarchy of items in my tree view. Is there a way of doing this? Maybe just passing a JS object. An example would be great!
ListModel { ListElement { name: "Root" rows: [ ListElement { name: "Child 1" }, ListElement { name: "Child 2" } ] } ListElement { name: "Root 2" } }
-
Sure, that's possible. There is even an example in its documentation!
-
No it isn't possible, as confirmed by the link given by Axel.
I've heard it's planned but don't plan on it too soon. -
Dear @Axel-Spoerl Thanks for the answer. Which part of documentation are you referring to? The comment section?
// The model needs to be a QAbstractItemModel // model: yourTreeModel
-
S Serhan Kars has marked this topic as solved on