Unsolved Open UNC path as default in QFileDialog
-
I wanted to open QFileDialog for a specific path like //DC1/C$/Users/ but when QFileDialog opens it goes to a default path. When QFileDialog opens, I can change directory to the UNC path but I wanted to open this path as default. How can I do that? In the following code, g_absolutePath has been initialized with //DC1/C$/Users/ but it doesn't work.
#include "uploadfm.h" #include "ui_uploadfm.h" #include "mainwindow.h" UploadFM::UploadFM(QWidget *parent) : QMainWindow(parent), ui(new Ui::UploadFM) { ui->setupUi(this); QWidget::setFixedSize(600, 175); } UploadFM::~UploadFM() { delete ui; } void UploadFM::on_pushButtonSource_clicked() { QString fileName = QFileDialog::getOpenFileName(this, "Choose File", g_absolutePath); if(fileName.isEmpty()) return; ui->lineEditSourcePath->setText(fileName); } void UploadFM::on_pushButtonDestination_clicked() { QString fileName = QFileDialog::getExistingDirectory(this, "Choose Folder", g_absolutePath); if(fileName.isEmpty()) return; ui->lineEditDestinationPath->setText(fileName); } void UploadFM::on_pushButtonUpload_clicked() { QString l_sourceFileName = ui->lineEditSourcePath->text(); QString l_destinationFileName = ui->lineEditDestinationPath->text(); if(l_sourceFileName.isEmpty() || l_destinationFileName.isEmpty()) return; QFile file(l_sourceFileName); if(file.copy(l_destinationFileName)) { statusBar()->showMessage("Upload has been Successful ... "); } else { statusBar()->showMessage("Upload has failed ..."); } }
-
@Azadshahr
Ther's no point rasing a new duplicate of your https://forum.qt.io/topic/116104/set-a-default-unc-path-for-qfiledialog. Whatever answers will be there, and that has more information than here anyway. How does this differ? -
Hi
Please continue your other thread. This one will be locked.