How to add another row to QFileSystemModel?



  • Can I add another row to QFileSystemModel for special file? I did a file browser with QFileSystemModel and QTreeView. It can display normal folder and files. I want to add a cutom row for package files (like: *.rar, *.fev). I have the ideas to get file informations of package files like this. But I don't know how to display these in a new custom row.

    +folder
    -normal files

    • ...
      +package
      -files in package
    • ...

    I try to subclass QFileSystemModel and reimplement canFetch FetchMore, but I found that QFileSystemModelPrivate was not exported. So I can't find the way to add file name to QFileSystemModel.

    Somebody suggested me to use proxymodel. I used it to filter and sorting, and have no idea to add new row.

    Sorry for my poor English.



  • You are probably interestested in "this":http://developer.qt.nokia.com/forums/viewthread/10715 related topic.

    You can use a proxy model to add content to your model, but it is not trivial to do. What you do is reimplement the rowCount and data methods (and possibly others) to return your new items at the right place in the tree.


Log in to reply
 

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