The "internal" stuff in a QModelIndex is internal to the respective model instance.
I.e. any model function that gets a QModelIndex passed as an argument, can first check if model() is "this".
If it is, it can work with either internalId() or internalPointer() knowing that itself and nobody else put that info into the model index.
Also keep in mind that this lookup structure can be purged or at least cleaned in a lot of cases.
Anything that modifies the model, be it setData() or inserting/removing rows, etc. is assumed to invalidate all model indexes.
So any mapping that is kept for QModelndex -> internal data lookup could be invalidated at these times as well.
(might have to check for persistent model indexes though).
Event processing is also assumed to be invalidate model indexes, so one can also clear those mappings based on a timer.
Cheers,
_
Bookmarks