*** GMX Spamverdacht *** Re: [Eric] Bugs in latest eric4 snapshot
Jürgen Urner
jUrner at arcor.de
Wed Apr 4 23:03:18 BST 2007
Andreas Pakulat schrieb:
> Model indices are not persistent across application runs, but the Qt
> views do cache model indices that they retrieve from the model. As I
> said above, if you use internalPointer in python you need to make sure
> to keep a reference to the object yourself, i.e. in a list or dict.
> Thats why I tend to use internalId and keep a dict of id->object in the
> model.
>
> Andreas
>
>
How can you know when Qt decides to reuse some memory?
Quote from QModelIndex docs:
> > Model indexes can become invalid over time so they should be used
> > immediately and then discarded. If you need to keep a model index
> > over time use a QPersistentModelIndex <qpersistentmodelindex.html>.
...and even QPersistentModelIndex <qpersistentmodelindex.html> will
become invalid if the index
is no longer reachable. Haven't tested, but a guess would be
that QPersistentModelIndex <qpersistentmodelindex.html> may become
invalid, but keeps the pointer
or its internal is guaranteed to still be unique. But as I said, this is
just a
guess (nothing regarding this mentioned in the docs).
Jürgen
More information about the Eric
mailing list