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. Exclude files with QFileInfoList filter
Forum Updated to NodeBB v4.3 + New Features

Exclude files with QFileInfoList filter

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 1.8k Views 1 Watching
  • 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.
  • R Offline
    R Offline
    ranshalit
    wrote on last edited by
    #1

    Hello,
    When using QFileInfoList + QDir, can we filter anythinbg that should be excluded (or does the filtering is only on what is included) ?
    For example:

    1. Can I filter the . , .. files (so that they are excluded from list) ?
    2. Can I filter all files that have some substr in the name such as "garbage" string: xxx_garbage_xxx (so that they are excluded from list) ?

    Thank you,
    Ran

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      As the "documentation":http://doc.qt.io/qt-5/qdir.html#entryInfoList suggests: yes, you can filter the results as you wish.

      Example:
      @
      QFileInfoList list = dir.entryInfoList("*.exe", QDir::NoDotAndDotDot | QDir::Files);

      // or just
      QFileInfoList list = dir.entryInfoList(QDir::NoDotAndDotDot | QDir::Files);
      @

      (Z(:^

      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