File Dialog 'Save as type' selection
-
wrote on 20 May 2013, 23:59 last edited by
I'm using a Qt File dialog to save files, but haven't been able to find how to set the 'Save as type' option. I can specify a default path which includes an extension, but this doesn't populate 'Save as type'. I'm using the Windows native file dialog. Python. Example code:
@f_qt = QtGui.QFileDialog.getSaveFileName(self, 'Save', default_path) @
The closest I could find is the defaultSuffix property of QFileDialog, but this doesn't appear to be what I'm looking for. I'd like to be able to specify one or more file types the user can save as, as is standard with this type of dialog. Currently, it's showing only 'All files(.)'.
-
I don;t know if it works the same in python, but please take a look at "the documentation":http://qt-project.org/doc/qt-4.8/qfiledialog.html#getSaveFileName. Notice the filter parameter.
-
wrote on 21 May 2013, 19:25 last edited by
Thank you - that worked.
Example code using this:
@f_qt = QtGui.QFileDialog.getSaveFileName(self, 'Save', default_path, filter='*.pdf')@Tangental - in general, I wish the docs would include plain English explanations of what each property/function etc does.
3/3