From pykde Fri Oct 06 08:02:21 2006 From: "Phil Thompson" Date: Fri, 06 Oct 2006 08:02:21 +0000 To: pykde Subject: Re: [PyKDE] More Newbie TreeView foolishness Message-Id: <40694.195.6.25.120.1160121741.squirrel () river-bank ! demon ! co ! uk> X-MARC-Message: https://marc.info/?l=pykde&m=116012246426892 > Hello, > > In my qt4-designer designer derived *.ui, I have a QTreeView defined, > which is called 'RepositoryTree'. I try to now populate that using > QDirModel, but am failing. What Am I doing wrong? Thanks for any hints, > > Joh > > #!/usr/bin/python > > import glob > from PyQt4 import QtGui, QtCore, uic > import sys > > class RepositoryTree: > def __init__(self,Tree): > self.tree = Tree > model = QtGui.QDirModel() > self.tree.setModel(model) > > if __name__=="__main__": > Application=QtGui.QApplication(sys.argv) > UserInterface = uic.loadUi("ElNotes_GUI.ui") > RepositoryTree = RepositoryTree(UserInterface.RepositoryTree) > UserInterface.show() > Application.connect(Application, > QtCore.SIGNAL("lastWindowClosed()"),Application, QtCore.SLOT("quit()")) > Application.exec_() I can't remember the code that pyuic4 generates off the top of my head, but is the tree actually being instantiated? A definate problem is that the model is being garbage collected. Either do "self.model" instead of "model" or (my preference) make the tree the parent object of "model". Phil _______________________________________________ PyKDE mailing list PyKDE@mats.imk.fraunhofer.de http://mats.imk.fraunhofer.de/mailman/listinfo/pykde