diff --git a/src/Gui/FileDialog.cpp b/src/Gui/FileDialog.cpp index a07f13b2bb..f2ddf091e3 100644 --- a/src/Gui/FileDialog.cpp +++ b/src/Gui/FileDialog.cpp @@ -135,6 +135,7 @@ QString FileDialog::getSaveFileName (QWidget * parent, const QString & caption, const QString & filter, QString * selectedFilter, Options options) { QString dirName = dir; + bool hasFilename = false; if (dirName.isEmpty()) { dirName = getWorkingDirectory(); } else { @@ -144,6 +145,9 @@ QString FileDialog::getSaveFileName (QWidget * parent, const QString & caption, dirName += QLatin1String("/"); dirName += fi.fileName(); } + if (!fi.fileName().isEmpty()) { + hasFilename = true; + } // get the suffix for the filter: use the selected filter if there is one, // otherwise find the first valid suffix in the complete list of filters @@ -207,7 +211,8 @@ QString FileDialog::getSaveFileName (QWidget * parent, const QString & caption, dlg.setFileMode(QFileDialog::AnyFile); dlg.setAcceptMode(QFileDialog::AcceptSave); dlg.setDirectory(dirName); - dlg.selectFile(dirName); + if (hasFilename) + dlg.selectFile(dirName); dlg.setOptions(options); dlg.setNameFilters(filter.split(QLatin1String(";;"))); if (selectedFilter && !selectedFilter->isEmpty())