QSortFilterProxyModel - get root path



  • 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()
    @



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



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


Log in to reply
 

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