Qt snap can't select a folder via portal file picker on KDE but can on GNOME

I recently had to update a Qt snap I maintain (yuzu) to use a newer version of Qt than what’s available in focal. To do do this I used ppa:beineri/opt-qt-5.15.2-focal, which works fine on GNOME and I’m able to select Game directories using the portal GTK file picker. In KDE I can click on menu items to select a folder which will bring up the portal KDE file picker but when I try to confirm selection of a folder by clicking the ‘Open’ button nothing will happen and the portal window doesn’t disappear. Using Qt from the focal repo in conjunction with the desktop-helpers allows me to select folder on KDE but the file picker isn’t spawned by xdg-portal.

I took a look at the obs-studio snap maintained by snapcrafters, which also uses a newer Qt version from the PPA and when trying to choose a new output path for recordings I get the same result of being unable to choose a directory.

Finally I tried using the kde-neon extension (kde-frameworks-5-qt-5-15-3-core20) but this showed the same problem as well as bad application theming.

Tested on KDE-Neon in a VM. The yuzu snap that fails to open directories on KDE is in the candidate channel (revision 442 v778), in case anyone want’s to confirm this on their end. Alternatively you can use obs-studio to confirm. Yuzu snap on the stable channel (revision 438 v767) is able to open directories on KDE.

There’s this bug: https://bugs.kde.org/show_bug.cgi?id=437505

[…] portal apps (the ones installed via flatpak, for example) trigger a folder selector that is a bit confusing because it looks like file open/save dialogs and it can have a preview panel (if it is enabled via Options button in the upper right corner)[…]

So does it not work at all, or does it display that misleading dialog as described in the bug?

The portal dialog is slightly misleading it does have have the confirmation button labelled as “Open” in contrast to the native version being “Ok” as described in the bug.

I just tested Kubuntu 21.10 and 20.04.3 in addition to the previous testing on KDE neon.

  • KDE neon (xdg-desktop-portal-kde v5.23.1-0xneon+20.04+focal+release+build33): unable to select directory from portal dialog
  • Kubuntu 21.10 (xdg-desktop-portal-kde v5.22.5-0ubuntu1): Able to select a folder with caveats
  • Kubuntu 20.04.3 (xdg-desktop-portal-kde v5.18.5-0ubuntu0.1): Unable to select folder

To further expand on the behaviour I see with the portal file pickers, On Kubuntu 21.10 where I am able to select a folder, the portal allows selecting a folder when for example the portal displays /home, if I single click on a child directory such as Documents (so not navigating into the folder) when clicking on ‘Open’ it selects the folder and the portal dialog disappears as would be expected, but if I navigate into the folder intended for selection and click ‘Open’ then the button has no effect and the portal window remains still waiting for a directory selection. On both KDE-neon and Kubuntu 20.04 when single clicking on a folder in the file picker it will instantly take you into the folder selected and doesn’t allow you to select the folder with the Open button.