How can I get QFileSystemModel to display directories beginning with a "." (dotfiles) e.g. /users/paulsmith/.dirName?
-
Hi,
I am working in Unix and I want QFileSystemModel to display directories beginning with a "." (dotfiles) e.g. /users/paulsmith/.dirName as well as ordinary directories.
I have:
.h file:
private:
QFileSystemModel *dirModel;.cpp file:
QString sPath = "/users/paulsmith/";
dirModel = new QFileSystemModel(this);
dirModel->setRootPath(sPath);
dirModel->setFilter(QDir::AllDirs);...but the last line above doesn't do what I want to achieve and I don't know what else will. Does anybody know how?
Thanks,
-
Hi,
I am working in Unix and I want QFileSystemModel to display directories beginning with a "." (dotfiles) e.g. /users/paulsmith/.dirName as well as ordinary directories.
I have:
.h file:
private:
QFileSystemModel *dirModel;.cpp file:
QString sPath = "/users/paulsmith/";
dirModel = new QFileSystemModel(this);
dirModel->setRootPath(sPath);
dirModel->setFilter(QDir::AllDirs);...but the last line above doesn't do what I want to achieve and I don't know what else will. Does anybody know how?
Thanks,
@gshannon154 Try
QDir::Dirs|QDir::Hidden
orQDir::AllDirs|QDir::Hidden
. -
@gshannon154 Try
QDir::Dirs|QDir::Hidden
orQDir::AllDirs|QDir::Hidden
.Thank you that has worked well! The only problem is that now no files are being displayed. Do you know how to fix this but still keep the dotfiles?
Thanks,
-
Thank you that has worked well! The only problem is that now no files are being displayed. Do you know how to fix this but still keep the dotfiles?
Thanks,
@gshannon154 Yes. Just add
QDir::Files
to it. -
Brilliant thanks!