Important: Please read the Qt Code of Conduct -

How to add/find items to a model at a specific index

  • I have a tree model with 4 branches of the root. Now during runtime one of the branches should get children. The question is:
    How do I find/remember the right branch/item to add the children to?
    I found QPersistentModelIndex, which works. But is it the best approach? Or should I, when its time to insert new items, search in the model (how?) for the parent item they are supposed to be added to?

Log in to reply