[PyQt] Odd behaviour in QFileDialog.getOpenFileNames on Linux

Jens Nie JNie at roseninspection.net
Tue Jul 21 16:04:13 BST 2009


Hi all.


I am working on a little helper for my job management system to insert jobs into it using a PyQt GUI that should be usable on both windows and linux.

I came over a rather odd behavior for the QFileDialog.getOpenFileNames method when running that helper under linux. Selecting a file within the dialog immediately closes the dialog returning a list containing exactly that one and only selected file. It feels like selecting one file and immediately clicking the OK Button afterwards. There seems to be no way to select more than one file using <Ctrl>+LeftMouseClick. However clicking in an area without files and selecting all using the accelerator <Ctrl>+<A> shows the expected behavior. All files get selected and I am able to commit using the OK-Button.

The helper on windows shows the expected behavior in all scenarios.

The behavior is the same for the getOpenFileName variant of the method.

Here is the code snippet I am using:

jobfilenames=QFileDialog.getOpenFileNames(self,
            "Choose File(s)",
            QDir.currentPath(),
            "Python files (*.py)"
            )

        for jobfilename in jobfilenames:
        print jobfilename

What am I doing wrong here?

Best regards

Jens


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20090721/eb1d9dc4/attachment.html


More information about the PyQt mailing list