[PyQt] QTreeview does not show subrows correctly when the model is a Python list

Herbert Ruessink herbert.ruessink at whistler-it.nl
Sat Jul 17 19:54:17 BST 2010


Dear all,

I am trying to use a Python list as a model for QTreeView, or to be precise, the model is a subclass of list, the 
daughter nodes are the elements on this list object, and they themselves are the same subclass of list.

Somehow I cannot get the data to show correctly. Only the first row is shown and although the top row indicates 
that is has subrows, expanding the toprow does not show the subrows.  I adapted the sample program that comes 
with the PyQt source distribution to illustrate the problem. Uncomment the code at line 194/195 to select the 
working code or my failing code.

I observe this problem when I run this on a Mac Book Pro (Mac OS X 10.6.4, Python 2.6, Qt 4.6.3, PyQt 4.7.4). I 
haven't had the opportunity to test this on other platforms. I'm not sure if there is some mistake in my code or this 
is a bug in PyQt or Qt.

Iv'e found one reference on the web to what sounds like a similar problem: 
http://www.python-forum.org/pythonforum/viewtopic.php?f=4&t=14676. 

Could anyone offer any insights? Many thanks in advance.

Best,

Herbert

-------------- next part --------------
A non-text attachment was scrubbed...
Name: tree_list_model_test.py
Type: text/x-python-script
Size: 7049 bytes
Desc: not available
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20100717/5d3506f2/attachment.bin>


More information about the PyQt mailing list