[PyKDE] QFileDialog.getOpenFileName with multiple filters

Alexander Borghgraef alexander.borghgraef.rma at gmail.com
Fri Apr 21 11:11:27 BST 2006


Hi all,

 I'm trying to read in files in my PyQt app, so naturally I'm using
QFileDialog. The way I read
the Qt docs, you can use multiple file type filters in the dialog by using
;; as a separator between
the type lists in the filter string. Like this:

    def fileOpen(self):
      filename = QFileDialog.getOpenFileNames("", "JPG (*.jpg);;PGM
(*.pgm)"), self, "Read file", "Read file")
      ...

 I've found several examples on the net (C++ though, not Python) which do
this, so I figured it should work,
but what I got instead of three filters: "JPG (*.jpg)", "PGM (*.pgm)", and
the default "All Files (*)", were three filters
of which two were identical instances "JPG (*.jpg);;PGM (*.pgm)", and the
third the default one.  Any idea what
the problem is here? I'm using  Qt 3.3.3 and  PyQt  3.13.

--
Alex Borghgraef
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20060421/73177817/attachment.html


More information about the PyQt mailing list