Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QDirIterator only dirs from one level without subdirs. How?

QDirIterator only dirs from one level without subdirs. How?

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 2 Posters 459 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    bogong
    wrote on last edited by
    #1

    Hello!
    Got confused on very simple issue.
    Need to get only dirs from one level without subdirs. How to get it?
    For now I am using this:

    QDirIterator oDirs(
    	pPath,
    	QDir::Dirs|QDir::NoDotAndDotDot,
    	QDirIterator::Subdirectories
    );
    

    What I need to change here for getting only dirs from first level without subdirs where path is defined?

    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Not possible with a plain QDirIterator - you have to do it by your own.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      B 1 Reply Last reply
      0
      • Christian EhrlicherC Christian Ehrlicher

        Not possible with a plain QDirIterator - you have to do it by your own.

        B Offline
        B Offline
        bogong
        wrote on last edited by
        #3

        @Christian-Ehrlicher ... it's pain ... :-) Issue closed painfully.

        1 Reply Last reply
        0
        • B Offline
          B Offline
          bogong
          wrote on last edited by
          #4

          Solution found:

          QDir oDir(inPath);
          QStringList oDirList = oDir.entryList(QDir::Dirs|QDir::NoDotAndDotDot);
          return oDirList;
          
          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved