Results 1 to 4 of 4

Thread: QDir entryList performing slowly

  1. #1
    Join Date
    Jan 2007
    Location
    Paris
    Posts
    459
    Thanks
    98
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4 Qt5

    Default QDir entryList performing slowly

    Hey trolls,

    I want to retrieve every file name in a directory.

    I'm doing this:
    Qt Code:
    1. dir.entryList(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot);
    To copy to clipboard, switch view to plain text mode 

    And guess what... When you have 10000+ files in a directory It's very slow.

    Is it possible to retrieve files by chunk, like 100 by 100 or something ?

    Thanks.
    Last edited by bunjee; 4th October 2009 at 18:57.

  2. #2
    Join Date
    Dec 2006
    Posts
    849
    Thanks
    6
    Thanked 163 Times in 151 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QDir entryList performing slowly

    Well, you could call entryList() repeatedly to get first all files starting with a, then b,...
    - doesn't help though, when all files start with a common prefix...

    A single call to entryList() takes as long as it takes.
    You can file a request for enhancement with the trolls if you think it is slower than it should/could be.

    HTH

  3. The following user says thank you to caduel for this useful post:

    bunjee (5th October 2009)

  4. #3
    Join Date
    Oct 2009
    Posts
    2
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QDir entryList performing slowly

    Have a look at QDirIterator: it will allow you to navigate directory entries once at a time, and might satisfy more to your needs.

  5. The following user says thank you to rix for this useful post:

    bunjee (8th October 2009)

  6. #4
    Join Date
    Jan 2007
    Location
    Paris
    Posts
    459
    Thanks
    98
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4 Qt5

    Default Re: QDir entryList performing slowly

    QDirIterator is the way to go for non blocking directory browsing.

Similar Threads

  1. qdir and entrylist
    By mattia in forum Newbie
    Replies: 1
    Last Post: 28th November 2007, 11:13

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.