hi,I want to subclass QAbstractItemModel class for handling the tree-like structure data . But i don't know how to inerst a new item into the "tree" at the given position.Is anyone give me some example? Thanks
hi,I want to subclass QAbstractItemModel class for handling the tree-like structure data . But i don't know how to inerst a new item into the "tree" at the given position.Is anyone give me some example? Thanks
thanks,But the simpletreemodel just a read only model,it can not resize the model.
where parentIndex is the model index of the parent you wish to add a child for. "Under the hood" you have to implement it as a simple modification to your internal data structures and you can see in the simpletreemodel example how to do it (just look at its code, not the app itself - the model is initialised on startup).Qt Code:
insertRow(rowCount(parentIndex), parentIndex); setData(ind, "value");To copy to clipboard, switch view to plain text mode
Bookmarks