Unsolved How to hide the content from a directory in QFileSystemModel
-
Hi,
I am using the QFileSystemModel model data model for the local filesystem.
I would like to hide the content from a specific directory - not the name of the directory itself, but solely it content (files and sub-directories). I assume that setting a filter is not going to work, so that I will have to subclass some of the functions inherited QAbstractItemModel.
What would be the best way to archive that.
Thanks,
Laurent -
@Laurent-Schall
You can subclass fromQFileSystemModel
, which should be used to achieve this, so why think about dropping down toQAbstractItemModel
? -
subclass
QFileSystemModel
, and reimplement bothrowCount()
andhasChildren()
to rerurn 0/false for the foder you want to hide the contents of -
@VRonin said in How to hide the content from a directory in QFileSystemModel:
subclass QFileSystemModel
Or subclass
QIdentityProxyModel
, modify it as you want (i.e. what the fellows above suggested) and attach it to the standardQFileSystemModel
.