How can I set QFileSystemModel to display just directories?
Or is this impossible at all?
How can I set QFileSystemModel to display just directories? Or is this impossible at
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Have never had a chance to use the QFileSystemModel myself, but looking at the docs…did you try setFilter()?
http://doc.qt.io/qt-5/qfilesystemmodel.html#setFilter
http://doc.qt.io/qt-5/qdir.html#Filter-enum
The documentation notes, the default filter is
QDir::AllEntries | QDir::NoDotAndDotDot | QDir::AllDirs. That expands to:QDir::Dirs | QDir::Files | QDir::Drives | QDir::NoDotAndDot | QDir::AllDirs, and it says AllDirs is required.So maybe just: