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.
Use QFileDialog::getSaveFileName instead getOpenFileNames
:
QString fileName = QFileDialog::getSaveFileName(this, tr("Save File"),
"/home/jana/untitled.png",
tr("Images (*.png *.xpm *.jpg)"));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With