Tree model in QML without C++
-
Hi
can you create a model that can be used for treeview using qml only?
all articles I found implement the model in c++
-
Hi
Im not QML user but the only thing about pure QML models i could find was this
http://doc.qt.io/qt-5/qtquick-xmllistmodel-qmlmodule.html
So not sure you can defien new models in QML alone.
Could be cool though :) -
@mrjj thanks but this is for list model. I am interested in treemodel with parent-child relations
-
@Krasi
Hi
I think you need to use c++ for that.
Sadly. -
I was stuck at the same point, "why are the example only static read-only c++ models"?
I found two helpful pure QML examples for custom made tree views that use QML ListModel and Javascript arrays, e.g:
Youtube - TreeView component in pure Qt Quick
https://gist.github.com/pcdummy/c03845aa9449168b7d24c491ad913fceQMLRearrangeableTreeView from Eric Gregory which showcases drag&drop. I extended it to make it editable, and save/load the structure via a JSON string:
QMLRearrangeableTreeView for edit&saveHope this can help.