QFile dialog to save a file
Solved
General and Desktop
-
QString path_file = QString("%1\\%2\\%3").arg(ROOT_ACQUISITION,cartella,text_file_da_copiare ); QString path_nuovo= QString("%1\\%2").arg("C:\\cartella\\",nome_file); QDir dir; if (!dir.exists("C:\\cartella\\")) { dir.mkpath("C:\\cartella\\"); } // if (QFile::exists(path_file)) // QFile::remove(path_nuovo); //QFile::copy(path_file, path_nuovo); QList<QUrl> urls; urls << QUrl::fromLocalFile("C://Acquisizione"); QFileDialog dialog; dialog.setSidebarUrls(urls); QFileDialog::getSaveFileName(&dialog,tr("Copia File"), path_file, tr("(*.txt)"), nullptr, QFileDialog::DontUseNativeDialog); dialog.exec();
I have to save a file that I select but when I choice the path an other window opens and the file isn't saved
-
Hi
QFileDialog::getSaveFileName
only gets a filename/path so it will not save anything for you.
so you need some code to save data. -
Yes. if the file you select should be copied to path_nuovo