Details
-
Suggestion
-
Resolution: Out of scope
-
Not Evaluated
-
None
-
all
-
None
-
64-bit Windows 11 running Python 3.11.2 and using PySide6 v6.4.3.
Description
The QFileDialog.getOpenFileName() static function accepts a filter argument. This argument must be given as a string.
On the other hand, the QFileDialog class has a method named setFilter() that must be given a filters argument as a QDir.Filter enum, so something like this:
QDir.Filter.Files | QDir.Filter.Executable
I can't use the getOpenFileName() static function in a platform-independent manner, because I can't have a filter such as
"EXE (*.exe)"
that would work on Linux and macOS, besides Windows.
The issue is that Windows uses file extensions, whereas Linux and macOS don't. How can I, therefore, use the getOpenFileName() static function in a way to filter executable (binary) files that would work correctly on all platforms?
The QDir.Filter way of doing it is, however, platform independent, but can't be applied to the getOpenFileName() static function.
So, my suggestion or improvement is to make the getOpenFileName() static function accept a QDir.Filter enum for its filter argument, rather than a string.
Attachments
Issue Links
- relates to
-
QTBUG-106385 QFileDialog static functions (getOpenFileUrl, etc.) should support mime type filters
-
- Reported
-
-
QTBUG-106386 QFileDialog static functions (getOpenFileUrl, etc.) could try to stay in the same dir if dir is not given
-
- Reported
-