Posted 3 months ago. Visible to the public.

HowTo: Scale Qt application KeePassXC

If you have a notebook with WQHD-display the scaling of Qt applications could be negatively affected. E.g. the KeepassXC icons and text could be rendered so large that KeePassXC is not usable and there aren't settings in the application for downscaling.

Fix with a .desktop file

The scaling of virtualbox, vlc and zoom wasn't an issue, therefore this fix is only for KeepassXC. The application was installed with snap, but the principle is the same when installed differently. Copy your keepassxc_keepassxc.desktop file in /var/lib/snapd/desktop/applications to ~/.local/share/applications. Then change the line with Exec and add your Qt scaling parameters. With QT_AUTO_SCREEN_SCALE_FACTOR=0 automatic scaling can be disabled Archive . Now it is also possible to add your own scale factors with QT_SCREEN_SCALE_FACTORS=0.9, but that wasn't necessary in this case.

Copy
[Desktop Entry] ... # Exec=env BAMF_DESKTOP_FILE_HINT=/var/lib/snapd/desktop/applications/keepassxc_keepassxc.desktop /snap/bin/keepassxc %f Exec=env BAMF_DESKTOP_FILE_HINT=/var/lib/snapd/desktop/applications/keepassxc_keepassxc.desktop QT_AUTO_SCREEN_SCALE_FACTOR=0 /snap/bin/keepassxc %f ...

To test your factors you can use your notebook with an external monitor and start KeepassXC or other Qt applications from your terminal:

Copy
$ QT_AUTO_SCREEN_SCALE_FACTOR=0 QT_SCREEN_SCALE_FACTORS=0.9 keepassxc

Wayland

If you are using wayland (in combination with fractional scaling) another possibility might be forcing the use of X11 or GTK themes Archive for your Qt applications in the wayland session. For this install e.g. the qt5ct package and add a configuration for systemd user environment variables Archive (e.g. ~/.config/environment.d/10-qt.conf) with the Qt theme you want:

Copy
QT_QPA_PLATFORMTHEME="qt5ct" # QT_QPA_PLATFORM="xcb" for X11

You can use the theme in combination with the aforementioned scaling factors.

Owner of this card:

Avatar
Simon Hofmann
Last edit:
3 months ago
by Simon Hofmann
Keywords:
Qt, KeePassXC, WQHD, Wayland
Posted by Simon Hofmann to makandra orga
This website uses short-lived cookies to improve usability.
Accept or learn more