Can't add extension to file in QFileDialog
问题 I've got a problem with saving file with extension (get path to file and append extension) in PyQt4 with QFileDialog. My Python code looks like that: dialog = QtGui.QFileDialog() dialog.setDefaultSuffix(".json") file = dialog.getSaveFileName(None, "Title", "", "JSON (.json)") It works, path is correct, dialog title and filter are in dialog window, but second line was ignored. File doesn't have any extension. How to add extension by default? What am I doing wrong? 回答1: Calling setDefaultSuffix