*bump*

No ideas on this one?



On Wed, 07 Apr 2010 18:14:28 +0200, Sebastian Elsner <[email protected]> wrote:

One additional question:

You wrote, that internalPointer() is not meant to be used outside of the model. But how would I get the associated object from a QModelIndex?

I am using selectedIndex() on the view to get the indexes, but how to proceed from there on?



is On Tue, 06 Apr 2010 17:40:09 +0200, Phil Thompson <[email protected]> wrote:

On Tue, 06 Apr 2010 16:23:30 +0200, "Sebastian Elsner"
<[email protected]> wrote:
Hello,

I finally was able to compile an example case, which is not too complex,

please find it attached. Run the python script, expand one LevelOne item

and select a LevelTwo item and in the menu choose add/edit levelthree. If

you do this you should see an error or the interpreter will crash (try
adding more items und expand them!). As said this error can be prevented

by adding strong references for all items in the tree (which is something

the createIndex obviously does not). Uncomment line 210 and 211 to see
that adding all items to a list helps.

The root item is owned by the model, so this should work, right?!

The root item is owned by the model, but does the root item own all of its children, grandchildren etc.? I can see that it owns its children because you explicitly call its appendChild() method, but I'm not clear where the children's equivalent methods are called. Have you tried printing out the tree of items starting with the root item at various point to make sure the
tree contains what you think it should?

QAbstractItemModel won't maintain your model for you. As the documentation says, it "provides the abstract interface for item model classes" - the key word being "interface". It is not the container of the model data - that's
the responsibility of a sub-class.

Phil




--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
_______________________________________________
PyQt mailing list    [email protected]
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Reply via email to