[PyQt] User selected filter in QFileDialog
phil at riverbankcomputing.com
Tue Jun 30 16:06:17 BST 2009
On Tue, 30 Jun 2009 05:14:27 -0700 (PDT), barmanoo
<olivier.friard at gmail.com> wrote:
> I have a problem with QFileDialog to check what filter the user has
> My code is:
> projectFileName=fd.getSaveFileName(self,'Save the current
> project','','project type 1 (*.project1);;project type 2
> files (*)','project type 1 (*.project1)')
> Unfortunatly whatever filter the user had selected the selected_user
> variable always contains "All Files (*)". There is no way to know what
> filter was used by the user.
> Any idea?
getSaveFileName() is a static method that creates its own dialog. In other
words the dialog the user is using isn't the same one you have created.
selected_filter = QString()
projectFileName = QFileDialog.getSaveFileName(self, 'Save the current
selected_filter will be updated with the selected filter (a horribly
More information about the PyQt