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. [closed] adding another column to QFileSystemModel
QtWS25 Last Chance

[closed] adding another column to QFileSystemModel

Scheduled Pinned Locked Moved General and Desktop
7 Posts 4 Posters 5.0k 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.
  • P Offline
    P Offline
    phamtv
    wrote on last edited by
    #1

    Can I change the column header/values for the QFileSystemModel and add some custom columns as needed? I am deciding whether I should subclass QFileSystemModel vs QAbstractItemModel to solve the following scenario: I will need to populate a subdirectory to a treeview. The user will then click on a button to run the tests files that are check in the subdirectory. The treeview will update the status of the test as failed/complete/etc in one of column. I also want to add another column that will embed a progress bar to let the user see the progress of the test.

    thank you for your time and support!

    1 Reply Last reply
    0
    • G Offline
      G Offline
      giesbert
      wrote on last edited by
      #2

      What you can do is create q proxy model to add some coluimns. But this is a bit of effort, as you have to ahndle all the stuff from both sides, so also changes from the source model.

      Afaik, it's not so easy, to just derive from QFileSystemModel and add some columns, but you could try. Overwrite columnCount, data and index and check what happens. I'm not sure it works, but it's worth a try before creating a complete proxy model on your own. deriving from QSFPM and adding rows / columns is not really possible as there are meny things you can't handle in a subclass....

      Nokia Certified Qt Specialist.
      Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

      1 Reply Last reply
      0
      • P Offline
        P Offline
        phamtv
        wrote on last edited by
        #3

        Thank you for your response Gerolf. Is there another ItemModel you think I should consider subclassing to resolve my problem?

        1 Reply Last reply
        0
        • G Offline
          G Offline
          giesbert
          wrote on last edited by
          #4

          The point is you want the file system stuff, so you have to use QFileSystemModel or create your own model which will be much work if you want to achieve the same functionality as QFileSystemModel.

          I would go the way of a custom proxy, if deriving the file QFileSystemModel does not work which I would try first.

          Nokia Certified Qt Specialist.
          Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

          1 Reply Last reply
          0
          • A Offline
            A Offline
            andre
            wrote on last edited by
            #5

            A agree: a proxymodel seems to be what you need.

            1 Reply Last reply
            0
            • R Offline
              R Offline
              rturrentine
              wrote on last edited by
              #6

              phamtv - Did you ever come up with a solution? I need to do the same thing.

              1 Reply Last reply
              0
              • A Offline
                A Offline
                andre
                wrote on last edited by
                #7

                [quote author="rturrentine" date="1321455547"]phamtv - Did you ever come up with a solution? I need to do the same thing.[/quote]
                You asked the "same":http://developer.qt.nokia.com/forums/viewreply/63770/ thing already in another topic. Please don't do that. Closing this topic.

                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