How can I make my app ignore window's "HIGH DPI SCALING"?
-
@Curtwagner1984 said in How can I make my app ignore window's "HIGH DPI SCALING"?:
it doesn't really seem to have an effect.
Try running your app in "DPI Unaware" mode: https://doc.qt.io/qt-5/highdpi.html#migrate-existing-applications
-
Thanks,
I made a file named qt.conf with the line<application> -platform windows:dpiawareness=0
And put it in the the folder of the executable. Nothing changed.
Is this correct? Should
application
be the name of the application? -
@Curtwagner1984 said in How can I make my app ignore window's "HIGH DPI SCALING"?:
I made a file named qt.conf with the line
<application> -platform windows:dpiawareness=0
Those are command line arguments. You pass the extra arguments while launching your .exe from the Command Prompt .
-
Thank you! This works!
Is there a way to set it up in the application itself, without the need to provide extra command line arguments? -
@Curtwagner1984
good old putenv, probably -
@JonB admittedly
the official way to do it, is apparently the creation and deployment of aqt.conf
file, same level as the executable with this content:[Platforms]
WindowsArguments = dpiawareness=0that said:
qputenv("dpiawareness", "0"); or qputenv("windows:dpiawareness", "0");
I'm unsure, I'm not using it often enough :D
-
@J-Hilk said in How can I make my app ignore window's "HIGH DPI SCALING"?:
qputenv("dpiawareness", "0"); or qputenv("windows:dpiawareness", "0");
I'm unsure, I'm not using it often enough :DThere is/I can see no evidence that a Qt program would recognise either of these proposed environment variable names. Unless you can see where it says it does.... I see only the command line or
qt.conf
file approaches so far. -
@J-Hilk said in How can I make my app ignore window's "HIGH DPI SCALING"?:
[Platforms]
WindowsArguments = dpiawareness=0Thank you! I tried to used this before but I've put incorrect syntax in this file. This works.
-
@Curtwagner1984 @JonB @J-Hilk @JKSH
I used Python PyQt5-5.15 for my application
I have guimain.exe and panelgui.ui files . Made qt.conf file
But when I change windows scaling to 125% or 150% the text fonts and other ui widgets get messed up...how to make it work i.e disable windows scaling for application -
In Qt 6 you can override the scale factor with the QT_SCALE_FACTOR env variable, but there is a problem: it doesn't set the factor to your value, it multiplies it. For example, if the system has 150% and you want 100%, you need to set QT_SCALE_FACTOR to 0.666667 (and even then it might not end up exactly 1.0 but rather 1.0001).
Is this intentional? There is a number of problems resulting from this multiplicative behavior, the primary one being when the application is moved between screens with different scale factors. I want to have 1.0 everywhere, not 0.66!
Also,
-platform windows:dpiawareness=0
DOES NOT WORK!
Or, rather, it does the wrong thing. It disables too much,devicePixelRatio()
reports 1.0 but the window is stretched and blurry. -
Found the proper option:
QT_ENABLE_HIGHDPI_SCALING=0
.