[PyKDE] Using QFileDialog
Giovanni Bajo
rasky at develer.com
Mon Jan 9 17:25:39 GMT 2006
piotr malinski <riklaunim at gmail.com> 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
> qtdesigner):
> ------------------------------
> void Form1::test()
> {
> a = QFileDialog(self)
> QObject.connect(a, SIGNAL('fileSelected()') ,self , SLOT('test2()'))
> a.show()
> }
> -------------------------------
> But when the widgets shows i get:
> QObject::connect: No such signal QFileDialog::fileSelected()
> QObject::connect: (sender name: 'unnamed')
> QObject::connect: (receiver name: 'Form1')
>
> test2 function looks like this:
> --------------------------------------
> void Form1::test2()
> {
> self.pushButton1.setText("aaaaaa")
> }
> --------------------------------------
> 1. how can I make it work?
> 2. how can I get the selected filename and display its name as
> pushButton1 text? Will something like: SLOT("test2(a.selectedFile())")
> work?
> I'm using QT 3.3.4 and pyQT 3.15.1
Unless you have special needs:
fn = QFileDialog.getOpenFileName()
--
Giovanni Bajo
More information about the PyQt
mailing list