Filtering "NoDotDot" in filesystem model not working
Hi ,
I using filesystem model in my program to display the filesystems....
Its working fine, it displays all the files and directoris including Dot and DotDot....
But i dont want to display the "DotDot" hence i used filter as shown below, unfortunately its not working....IT DISPLAYS DOTDOT ALSO....
Please somebody tell me whats wrong here...
Code:
QString sPath
=ui
->lineEdit_directory
->text
();
dirmodel =new QFileSystemModel(this);
dirmodel
->setFilter
(QDir::AllDirs |
QDir::Dirs |QDir
::NoDotDot); <
---HERE
"QDir::NoDotDot" IS NOT WORKING
dirmodel->setRootPath(sPath);
ui->treeView->setModel(dirmodel);
ui->treeView->setRootIndex(dirmodel->index(sPath));
Re: Filtering "NoDotDot" in filesystem model not working
http://qt-project.org/doc/qt-4.8/qdir.html#Filter-enum
QDir::AllDirs 0x400 List all directories; i.e. don't apply the filters to directory names.
Re: Filtering "NoDotDot" in filesystem model not working
OK ....
I changed filter as follows...still ".."(DotDot) is displaying...
dirmodel->setFilter(QDir::NoDotDot | QDir::Dirs );
Re: Filtering "NoDotDot" in filesystem model not working
There's a bug report about that and it will be fixed in next minor relase.