Scaling issues with Qt Apps on Gnome

Hi, after the last GNOME stable update, my Qt applications started to behave really funky.
The scaling of some Qt apps is completely off or they are not usable at all.

Hardware:

  • No HDPI screen

.profile Settings

  • export QT_QPA_PLATFORMTHEME="qt5ct"

Software Versions:

  • GNOME: 3.38.1
  • Qt: 5.15.1 in /usr/lib

Qt Apps, Version and Behavior:

  • kleiner-brauhelfer-2: 2.2.-1 After setting Exec=env QT_SCALE_FACTOR=1 kleiner-brauhelfer-2` in the .desktop file, it behaves and scales normally
  • Zoom 5.4 flatpak - way to small. Decided to not fiddle around with it and sticking to the Flatpak since I need Zoom for remote studying.
  • Kvantum 0.17.0-1 - totally unusable, see picture below
  • nextcloud-client 3.0.3-1 - The settings window is unusable like Kvantum and the “main dialog” is like zoom way to small. Editing the Qt Scale Factor in the .desktop file had no effects.
  • Manjaro-Settings-Manager 0.5.6-10 - I can enter the sub-setting pages, but it is not usable at all, can’t click on the hardware check-boxes for example. See screenshot below.

image
Kvantum


Manjaro-Settings

Does anyone have a clue how I can solve this?

Normally the qt configuration GUI isn’t included in the gnome editions, so to fix the HiDPI, there are other envs you can also try:

Qt 5

Since Qt 5.6, Qt 5 applications can be instructed to honor screen DPI by setting the QT_AUTO_SCREEN_SCALE_FACTOR environment variable:

export QT_AUTO_SCREEN_SCALE_FACTOR=1

If automatic detection of DPI does not produce the desired effect, scaling can be set manually per-screen ( QT_SCREEN_SCALE_FACTORS ) or globally ( QT_SCALE_FACTOR ).

Note:

  • If you manually set the screen factor, it is important to set QT_AUTO_SCREEN_SCALE_FACTOR=0 otherwise some applications which explicitly force high DPI enabling get scaled twice.
  • QT_SCALE_FACTOR scales fonts, but QT_SCREEN_SCALE_FACTORS does not scale fonts.
  • If you also set the font DPI manually in xrdb to support other toolkits, QT_SCALE_FACTORS will give you huge fonts.
  • If you have multiple screens of differing DPI ie: Side display you may need to do QT_SCREEN_SCALE_FACTORS="2;2"

An alternative is e.g.:

QT_FONT_DPI=96 vym

This link aggregates all the configuration for most graphical interfaces and is where the info above comes from:

Qt 5 - HiDPI - ArchWiki

1 Like

Thanks for the link, I already checked the ArchWiki.

I do not have an HDPI screen, so I don’t see how this should fix the issue.
Tried QT_AUTO_SCREEN_SCALE_FACTOR=0 though, had no effect on any of the above listed apps.

Other ideas?

Try this tutorial, After Install - DeLinuxCo Workstation

Remove that and remove qt5ct. QGnomePlatform is used now, see /etc/environment/

I also don’t have hidpi screen, but some apps like onlyoffice disagree. This solved the problem for me:

 export QT_AUTO_SCREEN_SCALE_FACTOR=1

It tells qt apps “No, this really is not a hidpi screen, stop acting like it is!”

I think that you must read this topic.

Thanks for all the tips.
The advices were a bit contradictory (qt5tc and QGnomePlatform), but I suspect the error lies somewhere in the change from qt5tc to QGnomePlatform.

So I removed all QT key value pairs from .profile and uninstalled qt5tc.

Also, I took a look at /etc/environment:

QT_AUTO_SCREEN_SCALE_FACTOR=1

QT_QPA_PLATFORMTHEME="gnome"

QT_STYLE_OVERRIDE="kvantum"

But still, none of these changes had an effect. Can it be that they are overwritten from some other file?

Since like @Yochanan pointed out Manjaro Gnome now uses QGnomePlatform, I’d like to go forward with it instead of qt5ct.

Have you tried setting the dpi with QT_FONT_DPI=96 vym ?

96 is usually what I go with for 1080p.

Also, if you create a new user, does it have the same issues?

I would recommend you create a new user and see what the defaults look like in that environment. This will isolate your issue to either your user account or the system in general, then go from there.

1 Like

Neither adding QT_FONT_DPI=96 vym to /etc/environment nor another user brought the desired result.
I have exactly the same issues with a freshly created user account.

In your home .profile you should have at least these;

export QT_QPA_PLATFORMTHEME="qt5ct"
export QT_SCALE_FACTOR=1.2
export GDK_SCALE_FACTOR=1.2

You can adjust the QT and GTK scaling by adjust the number value, 1.0 being nominal setting. I used these settings when installing my distro, which uses Cinnamon, to a 1080p 14" laptop and the entire desktop it scales perfectly.

Now, you must have QT5CT installed. then run QT5 Configuration Tool and make sure all settings are correct.

Also, have you tried an XFCE or Cinnamon ISO just to see how those look?

PS. It goes without saying, but you have to log out and back in for changes to take effect…

No, gnome is the default now as we now use QGnomePlatform instead of Qt5Ct.

But it could not hurt to have both installed for testing could it?
Does QGnome have a configuration tool as well?

It’s one or the other due to the environment variable. QT_QPA_PLATFORMTHEME will need to be set to qt5ct with Qt5Ct. The variable actually isn’t required at all on GTK platforms for QGnomePlatform, but setting it to gnome works as well.

No as it inherits the settings from the system.

PS. It goes without saying, but you have to log out and back in for changes to take effect…

Of course

So to get back to the issue:

  • The error descriptions in the original post are still true
  • It seems to be a system wide issue (new user doesn’t solves the issue)
  • I feel like it is not a theming issue (kleiner brauhelfer2 works just fine, see screenshoot), but maybe some Qt library issue (a library which is maybe not used in kleiner brauhelfer2 ?)

Cheers

I was able to find the error: in the folder /etc/profile.d/ was a file ‘qt-scaling.sh’ which set the QT_SCALE_FACTOR=0.5 globaly. I removed it and now all QT applications behave like they should.

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.