Hello,
I'm working on a Qt application and need to show a file dialog for user to save a file. To make it convenient for the user, i need to show a default filename when the file dialog opens so the user just have to click on save and the file will be saved.
This is the code block:
QString fileName
= dialog
->getSaveFileName
(0,dialog
->tr
("Save Logs"),
"myfile.zip",dialog
->tr
("Logs (*.zip);;All Files (*)"));
QFileDialog *dialog;
dialog = new QFileDialog;
QString fileName = dialog->getSaveFileName(0,dialog->tr("Save Logs"),"myfile.zip",dialog->tr("Logs (*.zip);;All Files (*)"));
To copy to clipboard, switch view to plain text mode
When the dialog opens, the filename box is blank there instead it should contain "myfile.zip" as filename.
Also, note that this same function is working on Ubuntu 20.04 and not on Fedora 33.
For Ubuntu 20.04 I'm using Qt : Qt Creator 4.11.1 Based on Qt 5.14.1
For Fedora 33: Qt Creator 4.13.2 Based on Qt 5.15.2
I'm guessing the version difference between Qt creator might have caused this issue. But i dont know what changed in the getSaveFileName() function. Could anyone please help ?
Bookmarks