Getting only the folder path to a line edit without selecting any file
Solved
General and Desktop
-
In my Qt c++ application I want to get a folder path into a line edit without selecting anyfile!
void MainWindow::on_button_clicked()
{filePath=QFileDialog::getOpenFileName(this, "Get Any File"); QDir d = QFileInfo(filePath).absoluteDir(); QString absolute=d.absolutePath(); ui->lineEdit->setText(absolute);
}
currently I use the above code to achieve it! Though the folder path only appears(without the file name) in the line edit a file in the relevant folder should be selected for it! I want to get folder path without selecting any file. (folder path should appear by opening the folder only)how can I get this done?