QFileSystemModel + QTreeView with UNC path on Windows problem
-
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.
-
(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.
-
Is there anybody know answer ?