[PyQt] Bug in QFileDialog for PyQt5 / Qt5.7 ?
Massimo Vassalli
massimo.vassalli at nanobioscience.eu
Thu Dec 1 12:26:42 GMT 2016
Dear all,
I found a strange behaviour (a bug ?) In the new implementation
of QFileDialog I'm using with Qt5.7 / PyQt5.7.
In short, the static function QFileDialog.getOpenFileNames() which is
expected to let the user selet more than one file and return a list, does
only half of the job. The dialog is executed with FileMode set to
QFileDialog.ExistingFiles (so that the user can select more than one file)
but the function returns only the first file of the list (the first clicked
file, to be precise). A workaround is to instantiate the class QFileDialog
and use it:
q = QtWidgets.QFileDialog()
q.setAcceptMode(QtWidgets.QFileDialog.AcceptOpen)
q.setFileMode(QtWidgets.QFileDialog.ExistingFiles)
fnames = q.selectedFiles()
Should it be considered a bug or was I wrong in using the static function ?
Massimo
--
Dr Massimo Vassalli
NanoBioScience Goup - www.nanobioscience.eu
Institute of Biophysics - National Research Council
Genova - Italy
T: +39 010 6475 571
--
--
Dr Massimo Vassalli
Institute of Biophysics
National Research Council
Genova - Italy
+39 010 6475 571
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20161201/a9326706/attachment.html>
More information about the PyQt
mailing list