[PyKDE] Using QFileDialog

Andreas Pakulat apaku at gmx.de
Mon Jan 9 17:06:21 GMT 2006

On 09.01.06 17:12:48, piotr maliński wrote:
> I'm learning pyQT and I have a problem with QFileDialog - how can I
> get the selected filename? I've made a simple form: a pushbutton that
> onlick runs function "test" which opens the filedialog (in
> ------------------------------
> void Form1::test()
> {
> a = QFileDialog(self)
> QObject.connect(a, SIGNAL('fileSelected()') ,self , SLOT('test2()'))

There is no such signal, QFileDialog emits the signal fileSelected(const

> 2. how can I get the selected filename and display its name as
> pushButton1 text? Will something like: SLOT("test2(a.selectedFile())")
> work?

The selected filename is the parameter that the fileSelected Signal has,
your slot needs a parameter (besides self) too and that one will contain
the filename.

I'm not familiar enough with PyQt 3 and thus I can't show you the
correct code.


Save energy: be apathetic.

More information about the PyQt mailing list