I'm seeing an aggravating difference in the behavior of QFileDialog::getSaveFileName on Windows vs. Linux. The difference is and whether or not the correct file name extension is automatically appended to the filename that the user enters. For example:

Qt Code:
  1. QString fileName = QFileDialog::getSaveFileName(parent,
  2. "Select save location",
  3. "Text Files (*.txt)");
To copy to clipboard, switch view to plain text mode 

On Windows, if the user enters "temp" as the filename and clicks okay, the variable "fileName" will contain the string "temp.txt". On Linux, it will only contain the string "temp".

I would much prefer the behavior that I see on Windows, so that I don't have to implement this behavior myself every time I use this method. Does anyone have any ideas about how to get the correct behavior on Linux, or is this just a bug have to deal with for the time being?

I'm using Qt 4.5.1.