PDA

View Full Version : TreeModel (QAbstractItemModel)



StrikeByte
8th October 2014, 11:14
At the moment im struggeling to get the TreeModel to work properly.

The biggest problem i have right now is how to use beginInsertRows and beginRemoveRows when adding or removing tree items, I cant seem to get the QModelIndex &parent that i need for those functions.
all the examples inherit the insertRows and removeRows, but i do not use a view to select the insert or deletion point, i have another model that adds or removes items to and from the tree.
How do i create or find the QModelindex &parent that i need for beginInsertRows or beginRemoveRows?

wysota
8th October 2014, 13:07
The parent marks where in the model you want to perform the modification so you should have a function that returns a valid model index based on what the other model knows about this model. If you show some of your code maybe it will be easier to provide a more concrete answer.