I am using following code from some official example:
model = QFileSystemModel()
model.setRootPath(QDir.currentPath())
view = QTreeView(parent=self);
view.setModel(model)
I expected it to expand directory structure in the tree view so directory from which my program is run would be displayed. What I get, however, is unexpanded tree starting with file system root. How can I make it right?
I tried using expand
, but it didn't help:
model = QFileSystemModel()
index = model.index(QDir.currentPath())
view = QTreeView(parent=self);
view.setModel(model)
view.expand(index)
The tree view is still unexpanded.
You would have to use QTreeView.expand.