[PyQt] PyQt createIndex question
apaku at gmx.de
Sun Sep 14 14:27:17 BST 2008
On 14.09.08 09:01:49, Doug Nichols wrote:
> Yea, but the C++ equivalent also doesn't do GC, I was reling on the Python
> GC to do my memory management for me. Bad/Lazy programming style.
Well ideally you shouldn't need to care.
> I'll look into the dictionary concept. I just need to determine when
> to clear the dictionary, because the Indices created were thrown away.
> I assume it would be whenever a layoutChanged() signal is emitted?
I'm not sure what you mean here. What I meant was for each item you have
in your model, you keep a map of a unique identifier (for example
obtained via id()) and that "item" (data structure of your data). And
let the model index carry that number instead of some data-pointer. And
of course your model should know when some of its underlying data is
being removed. layoutChanged is meant for things like the view or
selection model to get notified when your models underlying data changed
Future looks spotty. You will spill soup in late evening.
More information about the PyQt