[Qgis-user] RE: newbie QGIS, pyQT and python question
karsten vennemann
karsten at terragis.net
Tue Apr 5 00:19:11 PDT 2011
Thanks I used
filename = QFileDialog.getOpenFileName(None, 'Open File', '.')
And it works.
Karsten
Terra GIS LTD
www.terragis.net
> -----Original Message-----
> Sent: Saturday, April 02, 2011 17:15
> To: 'karsten vennemann'
> Subject: QGIS - Ricardo Filipe Soares Garcia
> Hi Karsten
> I think these questions would be better suited for the
> qgis-developer mailing-list.
> Looking at pyqt's documentation[1], it seems the
> getOpenfileName method's, first argument is the parent
> widget, and must be a QWidget (or one of its subclasses) or None.
> So you have some options:
> 1 - make this dialog a child of your main plugin window
> (which is not present on the code snippet in your message).
> 2 - make this dialog a child of the main qgis window:
>
> # code example
> QgisMainWindow = qgis.utils.iface.mainWindow() filename =
> QFileDialog.getOpenFileName(QgisMainWindow, 'Open File', '.')
>
> 3 - leave the 'parent' argument as None:
>
> # code example
> filename = QFileDialog.getOpenFileName(None, 'Open File', '.')
>
>
> I think either option should work. Good luck with your plugin ;)
>
> [1] -
> http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qfi
> ledialog.html
> <http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qf
> iledialog.html>
More information about the Qgis-user
mailing list