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. QFileSystemModel + QTreeView with UNC path on Windows problem
Forum Updated to NodeBB v4.3 + New Features

QFileSystemModel + QTreeView with UNC path on Windows problem

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

    I can't get my QTreeView to show the filesystem in a shared folder using an UNC path. Non-UNC paths are no problem.

    The following code is from my QTreeView subclass (I have not reimplemented any protected functions).

    @
    QDir dir = QDir("//vmware-host/Shared Folders/Downloads");
    qDebug() << "setting root path to " << dir.canonicalPath();

    QFile f(dir.absoluteFilePath("testfile.txt"));
    f.open(QFile::WriteOnly);
    f.write("testing testing");
    f.close();

    QModelIndex index = m_model.setRootPath(dir.canonicalPath()); // m_model is a QFileSystemModel
    setRootIndex(index);

    qDebug() << "Model root path:" << m_model.rootPath();
    qDebug() << "TreeView root index: " << rootIndex();
    @

    The test file created by QFile does get created, no problems there. The program prints the following output:

    setting root path to "//vmware-host/Shared Folders/Downloads"
    Model root path: "//vmware-host/Shared Folders/Downloads"
    TreeView root index: QModelIndex(-1,-1,0x0,QObject(0x0) )

    Note that the root index obtained from the view is invalid.

    I've had a look at QFilesystemModel, and it at least mentions UNC paths, even though I haven't read and understand the code.

    I'd appreciate any help on getting UNC paths working! Thanks in advance.

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

      I have the same problem.
      It seems that QFileSystemModel is only made for local drives.

      Did you find any solution for the problem?

      1 Reply Last reply
      0
      • A Offline
        A Offline
        Apelsinsaft
        wrote on last edited by
        #3

        (sorry for the late answer)

        No, I never did, unfortunately. I'm still interested in a solution, but I don't have time to read and understand, let alone fix, the source right now.

        1 Reply Last reply
        0
        • I Offline
          I Offline
          iskenderoguz
          wrote on last edited by
          #4

          Is there anybody know answer ?

          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