[PyQt] QAbstractItemModel subclass + QTreeView brickwall

Andreas Pakulat apaku at gmx.de
Sun Nov 25 22:41:36 GMT 2007

On 25.11.07 22:51:25, Simon Edwards wrote:
> Andreas Pakulat wrote:
>> On 25.11.07 21:17:12, Simon Edwards wrote:
>>> I'm having a hard time getting a QTreeView widget to work with my own 
>>> model. I've tried translating the "Simple Tree Model Example" from the Qt 
>>> docs, but it still doesn't work. Does anyone have working example code 
>>> for a QAbstractItemModel, or know what is going wrong?
>> Huh? That example is already existing in a PyQt version, see
>> examples/itemviews/simpletreemodel/ in the PyQt sources
> I grepped and searched a few times in the examples dir with Krusader. I 
> obviously missed it.
> Thanks for pointing that out!

Hehe :)

>>> Some of the methods get called (I've left the debug in), but nothing is 
>>> displayed.
>> Check contrib/pymodeltest/ add that to your model and it should help you
>> to find which of your models methods don't work according to the
>> "contract".
> interesting.

Its based off the C++ version, available from Trolltechs Labs page:

I'm posting that here because I'm not 100% sure the port is correct and
I'm also not sure wether all comments from the c++ version are in the qt
version. Those comments are sometimes useful to find out how to fix the


You will be married within a year, and divorced within two.

More information about the PyQt mailing list