Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
5.15.0
-
None
-
Debian testing with Qt from Debian (5.14.2+dfsg-4) or self-compiled from Qt's 5.15 branch as of commit b3b21b1a30e5375a327cc09313ada8d42bdf2164
-
-
3e09c28101d1af1dd90a4b515d7edbe5a3737f97 (qt/qtbase/dev) 7bf2ca05b8b119f6a5d2081c72cc9b3362a1275e (qt/qtbase/5.15)
Description
When using the desktop portal, e.g. with environment variable QT_QPA_PLATFORMTHEME="xdgdesktopportal" set, preselecting a specific filter or retrieving the one that was selected does not work, i.e. the following methods don't work as expected:
QFileDialog::selectMimeTypeFilter QFileDialog::selectedMimeTypeFilter QFileDialog::selectNameFilter QFileDialog::selectedNameFilter
A sample program (main.cxx) to test this is attached.
Steps to reproduce:
1. compile attach sample program
2. run it, using the portal file chooser:
QT_QPA_PLATFORMTHEME="xdgdesktopportal" ./main
3. check what filter is preselected in the first file dialog that opens
4. select PDF for the filter, then select a file and click OK
5. check output of the program
6. check what MIME filter is preselected in the second file dialog
7. select PDF for the filter, then select a file and click OK
8. check output of the program
Actual result:
in step 3): PDF filter is preselected
in step 5): output is: selectedNameFilter(): ""
in step 6: PDF filter is preselected
in step 8: output is: selectedMimeTypeFilter(): ""
Expected result:
The behavior should be the same as when using the "normal" (i.e. non-desktop) file chooser, i.e. without env variable QT_QPA_PLATFORMTHEME="xdgdesktopportal" set:
in step 3): text filter is preselected (since set with QFileDialog::selectNameFilter)
in step 5): output is: selectedNameFilter(): "PDF (*.pdf)"
in step 6: text filter is preselected (since set with QFileDialog::selectMimeTypeFilter("text/plain"))
in step 8: output is: selectedMimeTypeFilter(): "application/pdf"
Further notes:
- The corresponding functionality is implemented by the current_filter option in the FileChooser portal (input and output option/param of that name exists).
- The corresponding bug reports (with implementation in all involved components) are these:
- I plan to submit a patch to implement this.
Attachments
Issue Links
- is duplicated by
-
QTBUG-85657 QXdgDesktopPortalFileDialog does not support preselecting and getting selected filter
- Closed