Reputation: 17223
I am attempting to give the user an option of saving a file using QFileDialog However if the file does not exist the File Dialog states that the file does not exist. I want the QfileDialog to simply tell me the name of the file the user typed so that I can create it. I am doing the following
QFileDialog::getOpenFileNames(this, tr("Save File"))
and then create a file using the returned string.
Upvotes: 6
Views: 15443
Reputation: 22157
Use QFileDialog::getSaveFileName instead getOpenFileNames
:
QString fileName = QFileDialog::getSaveFileName(this, tr("Save File"),
"/home/jana/untitled.png",
tr("Images (*.png *.xpm *.jpg)"));
Upvotes: 13