Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Qt Creator scaling problems on hidpi screens #4902

Closed
PhilJd opened this issue Dec 1, 2015 · 14 comments

Comments

Projects
None yet
@PhilJd
Copy link

commented Dec 1, 2015

Qt Creator doesn't scale some UI elements correctly on hidpi screens (tested on 2560x1600 Macbook retina + 3840x2160 Dell 4K screen).
Scaling is set to "double" in the cinnamon settings and $QT_DEVICE_PIXEL_RATIO is 2.
I'm not sure if this issue is related to cinnamon or qt, but with Gnome (3.18) the scaling works correctly.
I'm running Cinnamon 2.8.5-2 on arch linux, qtcreator is 3.5.1-1.
Cheers,
Phil
2015-12-01-144821_2560x1600_scrot
2015-12-01-151541_2560x1600_scrot

@PhilJd PhilJd changed the title Qt Creator Scaling not correct on hidpi Qt Creator scaling problems on hidpi screens Dec 1, 2015

@kamilsaigol

This comment has been minimized.

Copy link

commented Dec 6, 2015

Confirmed 2560 x 1440
QtCreator 3.5.1
Cinnamon 2.8.5
Arch

@JosephMcc

This comment has been minimized.

Copy link
Contributor

commented Sep 5, 2016

Is this still an issue under Cinnamon3?

@PhilJd

This comment has been minimized.

Copy link
Author

commented Sep 5, 2016

Yes, this still is an issue. I'm on Cinnamon 3.0.7, using Qt 5.7.0.
QT_AUTO_SCREEN_SCALE_FACTOR variable is set to 1.
By the way, this is not connected to Qt creator, this affects all apps using qt, for example albert (settings) and texmaker. Gnome and Openbox display the fonts correctly.
As under Gnome the gtk theme is also correctly set, it might be worth trying to fix QT_STYLE_OVERRIDE first (#5440) and see if this also affects the scaling behaviour?

@JosephMcc JosephMcc added BUG and removed CLOSE IF NO RESPONSE labels Sep 5, 2016

@PhilJd

This comment has been minimized.

Copy link
Author

commented Nov 21, 2016

Issue persists in Cinnamon 3.2.1, Qt 5.7.0.

@alialparslan

This comment has been minimized.

Copy link

commented Aug 28, 2017

my screen is 3200x1600
this setting works perfectly for me:

#!/bin/bash
export QT_SCALE_FACTOR=1
export QT_AUTO_SCREEN_SCALE_FACTOR=0
export QT_SCREEN_SCALE_FACTORS=2
/home/username/Qt/Tools/QtCreator/bin/qtcreator "$@"

(ubuntu 16.04)

@leigh123linux leigh123linux removed the BUG label Aug 29, 2017

@leigh123linux

This comment has been minimized.

Copy link
Member

commented Aug 29, 2017

QT5 scaling sucks, the issue should be reported to them so they can fix it.

@soshiant1992

This comment has been minimized.

Copy link

commented Nov 10, 2017

thank you @alialparslan
i was waiting for this about two years

@Goddard

This comment has been minimized.

Copy link

commented Feb 6, 2018

Works great now @alialparslan thanks.

I made a slight change for KDE/Plasma. Add these lines to /home/username/Qt/Tools/QtCreator/bin/qtcreator.sh

export QT_SCALE_FACTOR=1
export QT_AUTO_SCREEN_SCALE_FACTOR=0
export QT_SCREEN_SCALE_FACTORS=2

Switch your launcher location to /home/username/Qt/Tools/QtCreator/bin/qtcreator.sh

@timxx

This comment has been minimized.

Copy link

commented Oct 6, 2018

Thanks @alialparslan, add QT_AUTO_SCREEN_SCALE_FACTOR=1 (no need other env) works perfectly for me.

@sloth1

This comment has been minimized.

Copy link

commented Nov 1, 2018

me also, QT_AUTO_SCREEN_SCALE_FACTOR=1 works on openSUSE Leap 15

@johannestophoj

This comment has been minimized.

Copy link

commented Dec 1, 2018

On my 3840x2160 display I had a problem that whenever I select an item the rightmost panel would resize (shrink) to a default size where I could only see part of the content. The above script solved this issue (and made the fonts readable). KDE Neon 5.14.3

@leigh123linux

This comment has been minimized.

Copy link
Member

commented Dec 1, 2018

QT5 should auto scale if it doesn't file the issue against qt5.

@sindhusweety

This comment has been minimized.

Copy link

commented Jun 7, 2019

where to mention
QT_AUTO_SCREEN_SCALE_FACTOR=1

@haoyun

This comment has been minimized.

Copy link

commented Jun 15, 2019

I think this issue may be related to the following bug
https://bugreports.qt.io/browse/QTBUG-64738
in gnome-settings-daemon, also in cinnamon-settings-daemon.

https://github.com/GNOME/gnome-settings-daemon/blob/7f26c2ac06712cc8834d23826eb153b07c222a12/plugins/xsettings/gsd-xsettings-manager.c#L817-L818

        update_property (add_string, "Xft.dpi",
                                g_ascii_dtostr (dpibuf, sizeof (dpibuf), (double) settings->scaled_dpi / 1024.0));

https://github.com/linuxmint/cinnamon-settings-daemon/blob/48156a7a2b1b0515fe2ef9f5d1201e158d5bd948/plugins/xsettings/csd-xsettings-manager.c#L685-L686

        update_property (add_string, "Xft.dpi",
                                g_ascii_dtostr (dpibuf, sizeof (dpibuf), (double) settings->scaled_dpi / 1024.0));

Reference https://unix.stackexchange.com/a/472168/350644


In cinnamon, the value settings -> font selection -> text scaling factor has to be a multiple of 0.1, If one sets it via settings -> font selection.

widget = GSettingsSpinButton(_("Text scaling factor"), "org.cinnamon.desktop.interface", "text-scaling-factor", step=0.1, size_group=size_group)

On the other hand, on a HiDPI screen, when settings -> accessibility -> Large Text is enabled, it will set text scaling factor to '1.25`



settings.set_double(KEY_TEXT_SCALING_FACTOR,
DPI_FACTOR_LARGE);


Now the problem is, if the text scaling factor is set to be e.g., 1.2 by any change, i.e., not a .25 multiple, then the Xft.dpi will be set to a floating number, by gnome-settings-daemon, e.g., in my case,

$  xrdb -query | grep dpi
----------------------------------------------
Xft.dpi:        230.3994140625

This will cause QT_AUTO_SCREEN_SCALE_FACTOR=1 having no effect.
To fix it, one can set Xft.dpi manually to an integer number.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.