Ok, as zeljko has introduced some new stuff to both Qt5 and Qt6 (needing, incidentally, new libraries) I thought I'd summarize where we are with this problem using my favorite recently released distros.
Tested against Ubuntu 23.04 and Debian 12 Bookworm (both using Qt5 5.15.8 and Qt6 6.4.2) using Gnome, KDE, XFCe, Mate, Cinnamon and Budgie
Firstly, on all tested systems, in the Font Dialog, we cannot set the Preview Text Programmatically.
Here is the results using the TSaveDialog with a file name filter set :
UbuntuU23.04 - Gnome. Qt5 and Qt5 slow, use qt5ct/qt6ct and its fast. Or install qt6-wayland and Qt6 is fast.
U23.04 - XFCe, Mate, Cinnamon, Budgie. Qt5 and Qt6 slow, using qt5ct or qt6ct fixes.
U23.04 - KDE Plasma. Qt5 and Qt6 fast out of the box.
.
Debian12 Bookworm - Gnome. Qt5 and Qt5 slow, use qt5ct/qt6ct fixes. Or install qt6-wayland and Qt6 is fast.
12 Bookworm - KDE Plasma. Qt5 and Qt6 fast out of the box.
12 Bookworm - XFCe, Mate, Cinnamon, Budgie. Qt5 and Qt6 slow, using qt5ct or qt6ct fixes.
Terms"using qt5ct or qt6ct fixes" - qt5ct or qt6ct must be installed and app started with the environment variable,eg, QT_QPA_PLATFORM=qt5ct set. Setting, from with in the qt5ct or qt6ct app, Dialogs=gtk3 will break the fix.
"qt6-wayland" is a package that brings in some 18Meg of dependencies but does fix the TSaveDialog problem on Gnome systems. Does not help on non-Wayland. Its not installed by default as part of Qt6 libraries and is not a dependency of the libQt5/6Pas libraries because its useful only on Gnome. Maybe its worth adding as a dependency ?? Comments ?
Conclusions- If you know your users will only use Gnome then add qt6-wayland to your app dependencies list, all good.
- If you know your users will only use KDE Plasma, no problems.
- For a general solution, add qt5ct or qt6ct to your dependencies list and in the desktop file start your app with something like "QT_QPA_PLATFORMTHEME=qt5ct /some/path/myapp". The user has now lost the opportunity to select a gtk2 or gtk3 theme and if they start you app in some other way, well, bad luck !
Be nice if users of other distributions could add what ever their favorite is, I have attached my test app.
Davo