Quote Originally Posted by TheRonin View Post
Perhaps the model is calling the createIndex-method on its own with some other pointers but my code shouldn't be.
No, QAbstractItemModel does not call createIndex itself, since as you pointed out this would be highly confusing for any implementation of that interface.

Are you passing your model directly to a Qt item view? Or could there be some other code that calls methods, probably passing "foreign" indexes?

Another common mistake that even happens to experienced model developers sometimes is to not handle the invalid model index correctly, e.g. assuming that all model indexes have an internal pointer, etc

Cheers,
_