Details
-
Bug
-
Resolution: Done
-
P2: Important
-
4.5.2
-
None
-
0de487a10f3a54c46f30042b96c321f982e01a90
Description
Steps to reproduce / test case
When using QFileDialog::getSaveFileName, if you pass QFileDialog::HideNameFilterDetails as the flag the filter extensions are properly omitted but the default filter is not auto selected when the save dialog is shown. For example, say we used QFileDialog::getSaveFileName like so:
QString filename = defaultFilename;
filename = QFileDialog::getSaveFileName(this, tr("Foo"), filename,
filtersStr, &chosenFilterString,
QFileDialog::HideNameFilterDetails);
In this situation chosenFilterString is a QString that was automatically set to something like "PNG (*.png)". That filter is one of many (but not the first) filters in the filtersStr, separated by ;;. When the Save As dialog is shown the 1st filter, not the proper default filter, is shown. If you omit the QFileDialog::HideNameFilterDetails flag the correct default filter is shown. This may also effect other QFileDialog functions like getting a file to open etc.