I have getSaveFileName with some filters and I want one of them to be selected when user opens the "Save" dialog. Qt documentation says the following:
The default filter can be chosen by setting selectedFilter to the desired value.
I try the following variant:
QString selFilter="All files (*.*)";
QFileDialog::getSaveFileName(this,"Save file",QDir::currentPath(),
"Text files (*.txt);;All files (*.*)",&selFilter);
But when the dialog appears, the "Text files" filter (in general case, the first filter from the list) is selected. I also tried all of the following:
selFilter="All files";
selFilter="All files (*.*)\n";
selFilter="All files (*.*);;";
selFilter="All files (*.*)\0";
and different mixtures of this variants. The format of the filter list in my code is done according to the documentation (example line from Qt docs):
"Images (*.png *.xpm *.jpg);;Text files (*.txt);;XML files (*.xml)"
Note that output to selFilter variable works properly: after user press OK, selFilter variable contains the filter selected by the user.
Platform: Linux(OpenSUSE 12.1), Qt 4.7.4, gcc 4.6.2.
So how to set up the default filter?!