[closed] adding another column to QFileSystemModel



  • 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!



  • 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....



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



  • 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.



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



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



  • [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.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.