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. Supporting data models for file lists
Forum Updated to NodeBB v4.3 + New Features

Supporting data models for file lists

Scheduled Pinned Locked Moved Unsolved General and Desktop
data modelsfile listssoftware designfile managementqfileinfo
9 Posts 4 Posters 1.9k Views 2 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.
  • E Offline
    E Offline
    elfring
    wrote on 8 Oct 2018, 08:55 last edited by
    #1

    A lot of software applications will usually work with file lists.
    The construction of customised data models can be performed by some design approaches then.

    I have got the impression that additional programming interfaces will be more helpful for this use case than a class like “QFileSystemModel”. QFileInfo objects can be combined into other data structures.

    Would you like to point any information sources out for reusable class libraries in this software area?

    1 Reply Last reply
    0
    • V Offline
      V Offline
      VRonin
      wrote on 8 Oct 2018, 09:08 last edited by
      #2

      It's not totally clear what you are trying to achieve. Do you want a QFileSystemModel that filters by extension type?

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      E 1 Reply Last reply 8 Oct 2018, 11:10
      1
      • V VRonin
        8 Oct 2018, 09:08

        It's not totally clear what you are trying to achieve. Do you want a QFileSystemModel that filters by extension type?

        E Offline
        E Offline
        elfring
        wrote on 8 Oct 2018, 11:10 last edited by
        #3

        It's not totally clear what you are trying to achieve.

        This can be usual.

        Do you want a QFileSystemModel that filters by extension type?

        Such data processing can be also useful occasionally.

        But I am looking more for class libraries which will take care of the properties that are shared between files (and their names).

        Examples:

        • Case-insensitive iteration through file lists
        • Performing an action on each element in a list
        • Determination of directory hierarchies
        • Development challenges around the handling of symbolic links
        M V 2 Replies Last reply 8 Oct 2018, 12:51
        0
        • E elfring
          8 Oct 2018, 11:10

          It's not totally clear what you are trying to achieve.

          This can be usual.

          Do you want a QFileSystemModel that filters by extension type?

          Such data processing can be also useful occasionally.

          But I am looking more for class libraries which will take care of the properties that are shared between files (and their names).

          Examples:

          • Case-insensitive iteration through file lists
          • Performing an action on each element in a list
          • Determination of directory hierarchies
          • Development challenges around the handling of symbolic links
          M Offline
          M Offline
          mrjj
          Lifetime Qt Champion
          wrote on 8 Oct 2018, 12:51 last edited by
          #4

          @elfring
          Hi
          there is http://doc.qt.io/qt-5/qfileinfo.html
          for file handling.

          E 1 Reply Last reply 8 Oct 2018, 13:20
          0
          • M mrjj
            8 Oct 2018, 12:51

            @elfring
            Hi
            there is http://doc.qt.io/qt-5/qfileinfo.html
            for file handling.

            E Offline
            E Offline
            elfring
            wrote on 8 Oct 2018, 13:20 last edited by
            #5

            for file handling

            I mentioned the QFileInfo class already in my clarification request.
            I would appreciate if some comom file processing operations can be provided by a known class library (instead of repeating similar programming efforts).

            M 1 Reply Last reply 8 Oct 2018, 13:26
            0
            • E elfring
              8 Oct 2018, 13:20

              for file handling

              I mentioned the QFileInfo class already in my clarification request.
              I would appreciate if some comom file processing operations can be provided by a known class library (instead of repeating similar programming efforts).

              M Offline
              M Offline
              mrjj
              Lifetime Qt Champion
              wrote on 8 Oct 2018, 13:26 last edited by
              #6

              @elfring
              well enumerating containers is covered by std so it would be few lines of code
              to have a list of QFileInfo and loop over them.
              Also Qt provides http://doc.qt.io/qt-5/qdiriterator.html
              to handle the directories.

              1 Reply Last reply
              1
              • E elfring
                8 Oct 2018, 11:10

                It's not totally clear what you are trying to achieve.

                This can be usual.

                Do you want a QFileSystemModel that filters by extension type?

                Such data processing can be also useful occasionally.

                But I am looking more for class libraries which will take care of the properties that are shared between files (and their names).

                Examples:

                • Case-insensitive iteration through file lists
                • Performing an action on each element in a list
                • Determination of directory hierarchies
                • Development challenges around the handling of symbolic links
                V Offline
                V Offline
                VRonin
                wrote on 8 Oct 2018, 14:50 last edited by
                #7

                @elfring said in Supporting data models for file lists:

                Case-insensitive iteration through file lists

                Iteration has nothing to do with case sensitivity. You can use QDirIterator

                Searching can be case-insensitive using QDir::entryInfoList and passing the QDir::CaseSensitive filter flag

                Performing an action on each element in a list

                that's a for loop using QDirIterator there's nothing fancy

                Determination of directory hierarchies

                Again, QDirIterator can do it: iterator.fileInfo().isDir()

                Development challenges around the handling of symbolic links

                Just pass QDirIterator::FollowSymlinks or not. alternatively you can always use iterator.fileInfo().isSymLink()

                "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
                ~Napoleon Bonaparte

                On a crusade to banish setIndexWidget() from the holy land of Qt

                1 Reply Last reply
                2
                • E Offline
                  E Offline
                  elfring
                  wrote on 8 Oct 2018, 15:45 last edited by
                  #8

                  Do you get any further software development ideas for the mapping of the following class member variable to a Qt model class when the keys will be file names?

                      std::map<std::string, std::pair<std::vector<error_attributes>, bool>> records;
                  
                  1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on 8 Oct 2018, 20:36 last edited by
                    #9

                    Hi,

                    QAbstractListModel

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    1 Reply Last reply
                    3

                    1/9

                    8 Oct 2018, 08:55

                    • Login

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