Details
-
Bug
-
Resolution: Duplicate
-
Not Evaluated
-
None
-
5.15.0
-
None
-
Debian testing (amd64), Qt self-compiled from 5.15 branch as of commit b3b21b1a30e5375a327cc09313ada8d42bdf2164.
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 in QFileDialog 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:
(precondition: have current development versions of xdg-desktop-portal and xdg-desktop-portal-gtk or xdg-desktop-portal-kde installed)
1. compile attached 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-portal) 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
- duplicates
-
QTBUG-85658 QXdgDesktopPortalFileDialog does not support preselecting and getting selected filter
- Closed