Hmm.

Here's an issue: I'm creating QModelIndexes, and storing a pointer with traversal information via a 'new' operator in the index (so the object is allocated on the heap.)

Problem is, I don't know when the index is deleted - an obvious memory leak issue for the internal pointer object.

Looking through the docs and the code, there doesn't seem to be any way to know when a QModelIndex is being deleted. It would be nice if there was a flag in the index - something like: 'deletePointerOnDestroy'. That way the index could take care of the deletion on it's own.

Any thoughts on how to do something like this? I suppose I could keep a vector of the pointers and then delete them after I know no QModelIndexes were required, but that's not necessarily obvious, either.

Scratching my head... Any thoughts appreciated.

rickb