Hi navi1084!
Yes, the native and non-native file dialogs behave differently, at least on windows. Note that the getSaveFileName function has a QString * selectedFilter parameter. In the selectedFilter you can select a default filter for the dialog, and after the function returns, the text will be changed to the selected filter. For example:
QString filter
="XML files (*.xml)";
"Images (*.png *.xpm *.jpg);;Text files (*.txt);;XML files (*.xml)"
QString filter="XML files (*.xml)";
QString fileName=QFileDialog::getSaveFileName(this, tr("m_Save As"), QDir::currentPath(),
"Images (*.png *.xpm *.jpg);;Text files (*.txt);;XML files (*.xml)"
, &filter, QFileDialog:: DontUseNativeDialog);
To copy to clipboard, switch view to plain text mode
In this case the xml filter will be selected by default, otherwise the default filter would be the first one in the list. Here comes the important part for us, after the function returns and in case you have selected the second filter the filter strings contents will be "Text files (*.txt)". By knowing the selected filter, you can decide which extension to append to the file name.
Bookmarks