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
).