Please look at the standarddialog of Qt4's Examples and Demos, exactly in the dialog.cpp. Here is the code I mean.

Qt Code:
  1. void Dialog::setSaveFileName()
  2. {
  3. QFileDialog::Options options;
  4. if (!native->isChecked())
  5. options |= QFileDialog::DontUseNativeDialog;
  6. QString selectedFilter;
  7. QString fileName = QFileDialog::getSaveFileName(this,
  8. tr("QFileDialog::getSaveFileName()"),
  9. saveFileNameLabel->text(),
  10. tr("All Files (*);;Text Files (*.txt)"),
  11. &selectedFilter,
  12. options);
  13.  
  14. if (!fileName.isEmpty())
  15. saveFileNameLabel->setText(fileName);
  16. }
To copy to clipboard, switch view to plain text mode 

The problem lies on the parameter selectedFilter which is not returning the user selected filter.

What makes me wonder is that the problem occurs only in Linux OS, but not in Mac OS X. I don't know what happens in MS Windows.



In my case, I need the user selected filter in order to save the file correctly.

Such a problem does not occur if I use QFileDialog as a regular class without calling the static function. However, it is nice if I could use the static function also.


Any kind of helps would be highly appreciated.

Thx in advance.