9

I installed Qt 5.10 SDK on Windows 10. I thought that the HiDPI issues were fixed in Qt 5.6, but Qt Creator still seems to be "too big":

enter image description here

Am I missing something? My resolution is 3840x2160 with the "recommended" 150% scaling. Visual Studio in the background is of the correct size.

dtech
  • 47,916
  • 17
  • 112
  • 190
juzzlin
  • 45,029
  • 5
  • 38
  • 50

3 Answers3

16

I guess the default HighDpiScaleFactorRoundingPolicy of QtCreator is Round. so you can only scale to 1 or 2 not 1.5.

The correct solution is set the environment variable:

export QT_SCALE_FACTOR_ROUNDING_POLICY=PassThrough
./qtcreator.exe
Bob Brown
  • 161
  • 1
  • 2
  • 4
    THIS is the correct answer. Qt supports high DPI scaling in Windows for a while now, it even uses that code path, it is only that it rounds the detected DPI to an integer. Thus, on Windows with 3840x2160 with 150% scaling it shows the UI scaled at 2x. Setting that environment variable alone solved the issue. Run "sysdm.cpl" -> Advanced - > Environment variables and "New" (either user, either system, your choice), name: "QT_SCALE_FACTOR_ROUNDING_POLICY", value: "PassThrough". In a batch script, you do "set QT_SCALE_FACTOR_ROUNDING_POLICY=PassThrough". Thanks @Bob Brown for the correct answer. – user1371019 Sep 22 '21 at 10:18
  • This works on GNU/linux also. – Thulashitharan D Dec 15 '21 at 13:25
  • Dude, THANK YOU!! I've been seeing this problem for years and didn't realize there was such an easy solution for it! – Moohasha Apr 17 '23 at 19:11
9

It probably has its own hidpi functionality, unlike the legacy windows stuff that's just a direct upscale, so it appears to look bigger on your display which is amplified by the scaling you have applied.

From the information here it seems that you can go about to either set a custom scale factor or a custom DPI awareness scheme.

You can set those as system environment variables or use some cmd basic scripting to set them at a per application level:

@echo off 
set QT_SCALE_FACTOR=1
qtcreator.exe
dtech
  • 47,916
  • 17
  • 112
  • 190
  • 2
    Yeah, setting environment variable `QT_SCALE_FACTOR=1.5` solved this issue. However this is not something that the end user should do.. – juzzlin Mar 14 '18 at 13:23
  • That's a side effect of Qt being portable - it has to work on platforms that have no notion of hidpi and platforms that supports it natively. Qt has supported "default" hidpi for some time - that is it attempts to look the same regardless of the DPI, which means things are actually larger on hidpi monitors, and when you add 150% scaling on top of that it becomes exaggerated. It will probably look OK without any scaling, but since the windows shell doesn't support hidpi it will look too small. – dtech Mar 14 '18 at 14:27
3

I had the same problem with the nextcloud-client on Windows 10 and a scaling of 150%, solved by

(a) setting a global enivronmental variable in Windows 10 called QT_SCALE_FACTOR_ROUNDING_POLICY with the value PassThrough: Windows-dialogue for setting variables You can do so by hitting the Windows-key and search for variables...

or (b) a batch-file containing:

@echo off
set QT_SCALE_FACTOR_ROUNDING_POLICY=PassThrough
start C:\path\to\nextcloud.exe
exit

and then starting that batch-file. (Of course you have to adapt the path to your actual nextcloud.exe location.)

[If you want this to be run on startup, hit the keys windows and r , enter shell:startup and leave a link to your batchfile in the now opened folder. (Deactivate "run at startup" inside the Nextcloud-App to be sure the batchfile really runs.)]

(a seems to be more convinient for me.)

Tobias Zeh
  • 31
  • 3