Results 1 to 4 of 4

Thread: Filtering "NoDotDot" in filesystem model not working

  1. #1
    Join Date
    Oct 2011
    Posts
    160
    Thanks
    31
    Qt products
    Qt4
    Platforms
    Windows

    Default 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...

    Qt Code:
    1. QString sPath=ui->lineEdit_directory->text();
    2. dirmodel =new QFileSystemModel(this);
    3. dirmodel->setFilter(QDir::AllDirs | QDir::Dirs |QDir::NoDotDot); <---HERE "QDir::NoDotDot" IS NOT WORKING
    4.  
    5.  
    6. dirmodel->setRootPath(sPath);
    7. ui->treeView->setModel(dirmodel);
    8. ui->treeView->setRootIndex(dirmodel->index(sPath));
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Nov 2011
    Posts
    79
    Thanks
    5
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default 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.

  3. #3
    Join Date
    Oct 2011
    Posts
    160
    Thanks
    31
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Filtering "NoDotDot" in filesystem model not working

    OK ....
    I changed filter as follows...still ".."(DotDot) is displaying...
    dirmodel->setFilter(QDir::NoDotDot | QDir:irs );

  4. #4
    Join Date
    Sep 2011
    Location
    Manchester
    Posts
    538
    Thanks
    3
    Thanked 106 Times in 103 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Filtering "NoDotDot" in filesystem model not working

    There's a bug report about that and it will be fixed in next minor relase.

Similar Threads

  1. Replies: 0
    Last Post: 15th April 2011, 19:04
  2. Filtering Events on "black-box" objects
    By sebastian.f in forum Qt Programming
    Replies: 3
    Last Post: 12th June 2009, 08:35
  3. Replies: 3
    Last Post: 26th April 2009, 17:54
  4. Adapting the "Simple DOM Model Example" to be read/write
    By joshuajcarson in forum Qt Programming
    Replies: 7
    Last Post: 8th September 2008, 20:19
  5. Translation QFileDialog standart buttons ("Open"/"Save"/"Cancel")
    By victor.yacovlev in forum Qt Programming
    Replies: 4
    Last Post: 24th January 2008, 19:05

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.