How to Insert/Update/Remove in a C++ TreeModel and a QML View
I need for my
QMLUI to use a
I based my TreeViewModel from this example
custom Dataand they are displayed correctly. However, I have trouble to understand how I could
updatethe view when I need for example to
When using for example a
QAbstractListModel, I will use functions like
It is easy to find the
indexbecause you have a
However, in a
TreeModel, the only Data you have is the root of the
So I don't know what
indexto give to
beginInsertRows()if I want to insert (or update or remove) a
Could someone explain it to me ?
I don't know if my explanation was clear, my english is not perfect. If you have trouble to understand my question, just tell me and I will try to make it more clear.
Thanks a lot and have a good day !
- Check Editable Tree Model Example.
- Item delegate has
styleData.indexspecial property that holds QModelIndex.
Thanks a lot !