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?
QFileSystemModel
is a tree model. QTreeWidget
is a tree widget which only accepts data in individual items.
What you are looking for is the QTreeView
widget, which accepts a QAbstractItemModel
as its data structure. Use the setModel()
function of QTreeView
and pass it your QFileSystemModel
.
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 uses QFileSystemModel
).