Select file OR directory?
-
I need to allow the user to select a path; it could be a file OR a directory. Entirely up to the user. It looks like QFileDialog will allow the user to select a file, or a directory, but not either.
That is, if I set it to allow the user to select a file they can't pick a directory, and vice-versa; I need to allow them to pick either a file, or a directory.
Is there a way to do this with QFileDialog, or am I going to have to create a custom widget for this?
-
Hi,
QFileDialog uses the native file dialog by default and that option it is not something that they provide (Not windows nor OS X at least). If you want that behavior, you'll have to go custom.
-
Hi,
in which platform you have this issue?
As you said QFileDialog is not able to select both files and directories.
In our project (both for Windows and OS X) we have implemented this feature in OS X using native Objective-C API but we didn't found a way to do the same in Windows. -
Thank you.
Having had a hissy fit about it, I've decided that the best way to handle this is to go back up the line to the requirements monkeys and demand that they split out this particular requirement so I can identify cases that want a file, and cases that want a directory.
Bad requirements are the root of so much trouble :)
-
Wise decision
-
I forgot to double check but indeed it looks like that's the case