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)"));
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.