Would like help on how to fix scaling of Qt6 apps on my kde desktop

On my 14" laptop that is p1080 I can run xdpyinfo and get:

resolution: 157x155 dots per inch

and my KDE looks great, monitor kcm set to 100%, nothing wrong.

Yet, when I start a Qt6 app, the window it opens is far too large. Googling leads me to the suggestion and this solves the issue:

export QT_SCREEN_SCALE_FACTORS=‘eDP=1.2’

Now, why it is smaller when I set the factor to 1.2 than when it is set to 1.0, I don’t understand. But I don’t ask questions if this works.

Problem is that I’ve tried to set this variable in various places and nothing helps starting apps from krunner or plasma actually not show up like the factor was set to 1, which is. Much too large. (ps, yes, I did log out and in again)

Any hints on how to make things look good?

Hi @tomz !

Have you tried from a konsole window? That’s th more direct way to test if setting that variable works and how.

Suppose you want to run myqt6.app, which is in your PATH, from a konsole window:

export QT_SCREEN_SCALE_FACTORS=eDP=1.2
myqt6.app

Then close the app and reopen with a different setting, say:

export QT_SCREEN_SCALE_FACTORS=eDP=0.8
myqt6.app

And so on.

Once you find a comfortable value for QT_SCREEN_SCALE_FACTORS you may set it globally, like from a file in /etc/profile.d/ (as root user), e.g.:

su -    ## input root's password
## replace 1.2 below with your desired value
cat > /etc/profile.d/qt_scale_factors.sh <<EOF
export QT_SCREEN_SCALE_FACTORS=eDP=1.2
EOF
chmod +x /etc/profile.d/qt_scale_factors.sh
logout  ## go back to normal user

After that, a reboot is probably required to make it work, which you can test again from a konsole window:

echo $QT_SCREEN_SCALE_FACTORS

That should print the value you set in the profile.d script, e.g.:

eDP=1.2
1 Like

Hi @richarson

so, I tried the idea.

Here is all the things I tried.

  • add the file as you suggested in /etc/profile.d
    zero effect. (yes, I logged out and in again)
  • add an export in my ~/.bash_profile
    zero effect.
  • add an export in my ~/.bashrc
    Ah, now this variable is properly set in a newly started konsole.

but it still has had no effect on starting such apps from plasma or krunner.

Somehow KDE sets these variables, stopping me from correcting their values.

$ set | grep QT_
QT_AUTO_SCREEN_SCALE_FACTOR=0
QT_SCREEN_SCALE_FACTORS='eDP=1;HDMI-A-0=1;'

Is there any way to correct them, or get KDE to stop doing that?

Set them via the screen kcm.

You can’t disable plasma doing that.

Note Qt will also use font dpi from xresources in addition to scaling.

To expand on that, On Wayland, we now automatically choose a scale factor for your screens based on their DPI value and form factor. But obviously sizing is a rather personal topic, and there’s no way we can satisfy everyone with the default value; some people prefer things smaller and more information-dense, and others prefer them larger and more readable.

If you’d like to change the scale factor to a value different from what the system has chosen automatically, do it in System Settings > Display and Monitor.

You can’t disable plasma doing that.

ok,

then maybe the real question is how do I make sure that a simple Qt5 (kde) app has about the same font sizes as a Qt6 app.

They looks insanely different. Like 30% bigger for Qt6 apps than Qt5 ones.

Changing things in the ‘screen’ kcm also changes things like Firefox in sizing and obviously KDE apps start to look very much out of proportion.

This isn’t so much about personal feeling, its more about two apps think that a 10pt font has very different actual physical size on screen.