[PyQt] QFIleDialog.getSaveFileName get the selectedFilter

Phil Thompson phil at riverbankcomputing.com
Tue Mar 10 21:01:36 GMT 2009


On Tue, 10 Mar 2009 15:39:41 -0400, Darryl Wallace
<darryl.wallace at prosensus.ca> wrote:
> I prefer to use the static method for the getSaveFilename in the 
> QFileDialog so that the user sees the Windows/Mac native dialog.
> 
> My problem is that if the user doesn't type the file extension the in 
> the save file name (say when selecting an image type to save a file as), 
> then I don't have a way of checking to see what type of file they wanted 
> to save as.
> 
> Is there away to get the selectedFilter using this method?

If you pass a QString as the selectedFilter argument it will be updated on
return - not very Pythonic I know.

Phil


More information about the PyQt mailing list