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. QSortFilterProxyModel - get root path

QSortFilterProxyModel - get root path

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.6k 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

    How can I get the root path of a QSortFilterProxyModel that uses QFileSystemModel as its source model?

    I tried the following in an QSortFilterProxyModel-based class but it does not seem to work:
    @
    ((QFileSystemModel)sourceModel()).rootPath()
    @

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

      Iterate up to the root node, and get the path there through the appropriate role?

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

        I tried but I cannot seem to get the string rootpath correctly. Thus I connected a slot to the rootPathChanged signal for the QFileStringModel and set a QString rootPath variable I delcared.

        @
        void MainWindow::fsModel_rootPathChanged(QString str)
        {
        m_checkProxy->rootPath = str;
        }
        @

        NOTE: still don't know why I was unable to get it using the rootPath

        Thanks for your response...

        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