[PyKDE] More Newbie TreeView foolishness

Dave Fancella dave at davefancella.com
Fri Oct 6 08:31:42 BST 2006


On Friday 06 October 2006 2:27 am, Johannes Graumann wrote:
> 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,

Do you need something like this?

tree->setRootIndex(model->index(QDir::currentPath()));

(haven't used any of the stock models yet, sorry)

Dave

> 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_()
> _____________________________________________________________________
> Der WEB.DE SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
> http://smartsurfer.web.de/?mc=100071&distributionid=000000000066
>
> _______________________________________________
> PyKDE mailing list    PyKDE at mats.imk.fraunhofer.de
> http://mats.imk.fraunhofer.de/mailman/listinfo/pykde




More information about the PyQt mailing list