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 share one QFileSystemModel with two Views?
Qt 6.11 is out! See what's new in the release blog

How to share one QFileSystemModel with two Views?

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

    Dear all,

    I'm making a simple file manager. Firstly, I make two separate QFileSystemModel to show QTreeView & QListView respectively.

    But, I would like to share one QFileSystemModel between them. I try with make with QSortFilterProxyModel.

    But, I don't know how to filter just the folders with QSortFilterProxyModel, plz help me.

    Is there another method to get like that result.

    Thanks

    1 Reply Last reply
    0
    • C Offline
      C Offline
      Chuck Gao
      wrote on last edited by
      #2

      You can use Package, if you want to share one model with more than one views

      Chuck

      1 Reply Last reply
      0
      • Z Offline
        Z Offline
        zither
        wrote on last edited by
        #3

        What means Package?

        Plz explain or point to me..

        1 Reply Last reply
        0
        • EddyE Offline
          EddyE Offline
          Eddy
          wrote on last edited by
          #4

          Have a look at this "wiki page":http://developer.qt.nokia.com/faq/answer/how_can_i_implement_my_own_proxy_model_that_is_more_advanced_than_just_sort.

          It's almost what you want for the proxy. They use QStandardItemModel instead, but it can give you a good start.

          Qt Certified Specialist
          www.edalsolutions.be

          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