[PyQt] Odd behaviour in QFileDialog.getOpenFileNames on Linux
JNie at roseninspection.net
Wed Jul 22 13:38:56 BST 2009
> 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:
> "Choose File(s)",
> "Python files (*.py)"
> for jobfilename in jobfilenames:
> print jobfilename
> What am I doing wrong here?
I found a workaround to my issue by explicitly setting the style to 'plastique' for example. I think the issue was caused by the single-click behavior of KDE. KDE is the environment I started the client on Linux. The style defaulted to 'OxygenStyle' which is the style my KDE desktop uses.
However the whole thing stays strange as I am not aware of any KDE application which behaves like that in the File Dialogs, so I still consider that behavior to be wrong ... Any thoughts?
More information about the PyQt