I have a “project structure”, which is something like this.
-Project Main File
--Project Subfile 1
--Project Subfile 2
--Project Subfolder 1
---Project Subfolder 2
----Project Subfile 3
I’m using a QFileSystemModel to get the files on the specified path. Then after recognizing what is a folder and what is a file i want to display them on a view with the structure from above.
What i’ve though is using a QTreeView using QTreeWidgetItem.
Is this feasible?
QFileSystemModelis a tree model.QTreeWidgetis a tree widget which only accepts data in individual items.What you are looking for is the
QTreeViewwidget, which accepts aQAbstractItemModelas its data structure. Use thesetModel()function ofQTreeViewand pass it yourQFileSystemModel.For more info, see the Dir View Example. (Ignore the fact that it says it uses
QDirModel, if you have the latest Qt SDK, it really usesQFileSystemModel).