[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    [PyQt] Using QModelIndex.internalPointer
From:       Bakuriu <giacomo.alzetta () gmail ! com>
Date:       2009-12-04 16:25:30
Message-ID: 26635941.post () talk ! nabble ! com
[Download RAW message or body]


Hello.
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:

A-
  |-Letters
  |-Starting
  |-With
  |-A
B-
  |-Letters
  |-Starting
  |-With
  |-B
etc

Actually i use a wrapper class to access the shelve db which allows the tree
representation.
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?

Ps:
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.

_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic