Details
-
Bug
-
Resolution: Fixed
-
P2: Important
-
5.15, 6.2
-
XCode 12, iOS 14, iOS 15
-
-
ce20b8107 (dev), 9d4bd2c6d (6.5)
Description
nameFilters is not working in native FileDialog on iOS.
FileDialog { id: fileDialog visible: false title: "Select a Image" nameFilters: [ "Image files (*.jpg)" ] }
By lookin at Qt source code, Cocoa's UIDocumentPickerViewController is used for opening files. Initializing this controller with initWithDocumentTypes gives the possibility for filtering files by a list of "Uniform Type Identifier“.
Qt adds deprecated global identifiers to open any file type.
At least some specific type identifiers for jpg, txt etc. should be supported
("public.jpeg", "public.text") by converting the extension filter "*.jpg" to the UTI "public.jpeg".
An even better solution would be to just forward the nameFilters as UTI's, so
it could filter a custom file types with something like:
nameFilters: ["com.mycompany.myapp.myspecialextension", "public.jpeg"]
rather than nameFilters: [ "(.myspecialextension)", "(.jpeg)"]
Attachments
For Gerrit Dashboard: QTBUG-93624 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
448799,4 | iOS File Dialog: Support setting name filters | dev | qt/qtbase | Status: MERGED | +2 | 0 |
449117,2 | iOS File Dialog: Support setting name filters | 6.5 | qt/qtbase | Status: MERGED | +2 | 0 |
449226,1 | iOS File Dialog: Support setting name filters | 6.4 | qt/qtbase | Status: ABANDONED | 0 | 0 |
449227,1 | iOS File Dialog: Support setting name filters | 6.4 | qt/qtbase | Status: ABANDONED | 0 | 0 |