PDA

View Full Version : QFileSystemModel hiding folders



been_1990
14th February 2010, 04:52
How can I prevent folders from being show in a QFileSystemModel ?

psih128
14th February 2010, 07:10
you should probably change the filters with QFileSystemModel::setFilter

been_1990
14th February 2010, 14:53
You mean QFileSystemModel::setNameFilters. "Sets the name filters to apply against the existing files." Not what I need, I want to prevent folders from being displayed.

Lykurg
14th February 2010, 15:48
You mean QFileSystemModel::setNameFilters.
No, he doesn't, He meant QFileSystemModel::setFilter(). Have a look at the possibilities QDir::Filter gives you.

been_1990
14th February 2010, 16:18
No, he doesn't, He meant QFileSystemModel::setFilter(). Have a look at the possibilities QDir::Filter gives you.

Yeah, my bad. I wrote that because I searched the QtCreator docs for setfilter instead of setFilter, couldn't imagine it would make a difference.:D Where is Google Search when we need it...
But thanks, it solved my problem.

bslima
25th January 2011, 17:03
But with the QDir::Filters u can only specify global filters, not specific ones.
If i wanna prevent a folder with name Movies to appear in the FileSystemModel.
How can i do ti ?

thanks