Results 1 to 3 of 3

Thread: QDir::NoDotAndDotDot hidding all files?

  1. #1
    Join Date
    Oct 2008
    Posts
    306
    Thanks
    6
    Thanked 9 Times in 8 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Question QDir::NoDotAndDotDot hidding all files?

    When I use QDir::NoDotAndDotDot, my QtDir gives me an empty string. But when I remove it all files are outputted.Any idea why this strange behaviour? And why these ".",".." appear? Thanks.

  2. #2
    Join Date
    May 2009
    Posts
    62
    Thanks
    2
    Thanked 16 Times in 15 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QDir::NoDotAndDotDot hidding all files?

    The default value for the filter flags is QDir::AllEntries. When you override the default flags with QDir::setFlags or QDir::entryList, you should not forget to include at least one of QDir::Dirs, QDir::Files, or QDir::Drives to get any entries.

    Qt Code:
    1. // output a list of all subdirectories except "." and ".."
    2. foreach(QString entry, QDir("mydir").entryList(QDir::NoDotAndDotDot | QDir::Dirs))
    3. {
    4. qDebug() << entry << ", ";
    5. }
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    Oct 2008
    Posts
    306
    Thanks
    6
    Thanked 9 Times in 8 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: QDir::NoDotAndDotDot hidding all files?

    Thank you.

Similar Threads

  1. How to display hidden files ?
    By merry in forum Qt Programming
    Replies: 1
    Last Post: 16th September 2008, 12:27
  2. visual studio project files - adding extra files
    By luf in forum Qt Programming
    Replies: 3
    Last Post: 13th June 2008, 21:05
  3. compiling problem / Qt DLL files
    By ht1 in forum Newbie
    Replies: 1
    Last Post: 5th January 2008, 17:58
  4. Replies: 5
    Last Post: 22nd September 2006, 08:04
  5. [Win32/VC++ 8.0] Strange problems with qrc_*.cpp files
    By mloskot in forum Installation and Deployment
    Replies: 6
    Last Post: 6th March 2006, 10:28

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.