我有一个UI,其中有两个按钮:
下面的代码适用于本地目录,但不适用于网络目录。当我将目录设置为网络路径//my.network.path.com/jon/
并尝试打开目录时,窗口目录不会出现,QT输出日志ShellExecute '//my.network.path.com/jon' failed (error 2).
QT无法访问网络驱动器吗?
QDir mSaveDirectory;
void setDirectory()
{
QWidget *widget;
QString directoryPath = QFileDialog::getExistingDirectory(widget, "Select Directory", "/", QFileDialog::ShowDirsOnly);
mSaveDirectory.setPath(directoryPath);
}
void openDirectory() const
{
QUrl url;
url.setScheme("file");
url.setPath(mSaveDirectory.absolutePath());
QDesktopServices::openUrl(url);
}