[PyKDE] Problem with setModel on QTreeView

Andreas Pakulat apaku at gmx.de
Sun Jan 22 00:53:29 GMT 2006


Hi,

using setModel() on a QTreeView results in the TreeView "loosing" it's
model, if I don't save a separate reference to it. Following code
doesn't work:

tree = QtGui.QTreeView()
tree.setModel(SomeTreeModel(tree))
tree.show()

The tree is empty, however first creating a variable pointing to the
model and then using setModel() with that variable works.

I wouldn't bother writing this if this would be the case for other
Views too, but at least QTableView doesn't have this limitation. I don't
need a separate reference to the model.

It also shouldn't be necessary to hold a separate reference to the
model, as QTreeView should have one internal reference to it.

Andreas

-- 
You'll feel devilish tonight.  Toss dynamite caps under a flamenco dancer's
heel.




More information about the PyQt mailing list