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. How to add another row to QFileSystemModel?
Qt 6.11 is out! See what's new in the release blog

How to add another row to QFileSystemModel?

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 4.7k 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.
  • H Offline
    H Offline
    hycoldrain
    wrote on last edited by
    #1

    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.

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

      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.

      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