Answer the question
In order to leave comments, you need to log in
QAbstractItemModel: what if when deleting all siblings, the internalPointer changes?
There is a cache, the task of which is to display a certain slice of data in QTreeView. Each element contains a dynamic array of sons. Not pointers, but the sons themselves.
QModelIndex contains an internalPointer pointer to the element.
One of the elements has to be removed. In such a case, we run beginRemoveRows(), destroy the element, endRemoveRows(). Departure. If you do beginResetModel / endResetModel - everything is in order. Apparently, this is due to the fact that the index-brothers and sisters at the same time change the internalPointer.
What to do?
(Previously, live data was combined with a cache, each element had a dynamic array of pointers, everything worked. It needed to be divided - tricky cuts were needed, like product classification.)
UPD. I resolved most of the problems, one thing remains: there is a selected object - how to convert the index?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question