[PyQt] File Filtering using QFileSystemModel & QTreeView

JPolk jpolk5001 at yahoo.com
Fri Mar 9 23:13:47 GMT 2012


...looking at my old code,...I also do a ".setRootIndex"....like so:

libmodel1 = QtGui.QFileSystemModel()
libmodel1.setFilter(QDir.AllDirs | QDir.NoDotAndDotDot | QDir.AllEntries)
libmodel1.setNameFilters(filter)
libmodel1.setNameFilterDisables(False)
*libmodel1.setRootPath(QDir.rootPath() )
libmodel1.setRootPath(startDir)*
self.model1 = libmodel1
self.Shader1_TreeView.setModel(libmodel1)
*self.Shader1_TreeView.setRootIndex(libmodel1.index(startDir) )*
self.Shader1_TreeView.setAnimated(True)
self.view1.setSelectionMode(1)
self.selectionModel1 = self.view1.selectionModel()
self.selectionModel1.selectionChanged.connect(self.TreeViewSelectionChanged)

--
View this message in context: http://python.6.n6.nabble.com/File-Filtering-using-QFileSystemModel-QTreeView-tp1917066p4563859.html
Sent from the PyQt mailing list archive at Nabble.com.


More information about the PyQt mailing list