Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

TreeViewModel Clear and new Model



  • How do I clear the information in the TreeView Model and create and insert a new model?

    The reason I want to do this is because of Crash.

    Crash occurs after paintSiblingsRecursive is called recursively ..


  • Moderators

    Why not fix the crash instead?

    Anyway. To replace a model, simply do this:

    model = someOtherModel
    

    in JS when you want the model to be replaced. Or, if you are using C++ model, you can call beginResetModel(), clear all data, then endResetModel().


Log in to reply