[PyQt] Using QModelIndex.internalPointer

Bakuriu giacomo.alzetta at gmail.com
Fri Dec 4 16:25:30 GMT 2009

I'm trying to create a model so I inheritad QAbstractItemModel and
implemented the necessary methods.
Now i'm stuck at implementing the "parent" method.

My model should navigate through a shelve db, which contains "Word"
objects(my custom objects).
These words should be separated by initials so that the tree view shows:


Actually i use a wrapper class to access the shelve db which allows the tree
The problem is that when i call the QModelIndex.internalPointer method it
returns the class "Word" and not an instance of that class.
Therefore i cannot retrieve the parent index(my wrapper class also has got
methods which returns the index position of a word in the tree
representation using a tuple)

I read the documentation but it simply says that it returns a void*
pointer(in C++).
Anyone knows how to retrieve the exact data from a QModelIndex?

In the index method i call createIndex passing the right row and column and
an instance of the object, not the class...

View this message in context: http://old.nabble.com/Using-QModelIndex.internalPointer-tp26635941p26635941.html
Sent from the PyQt mailing list archive at Nabble.com.

More information about the PyQt mailing list