setAttribute(Qt::AA_EnableHighDpiScaling) does not work proprly
-
My application runs on Windows 10 with Increased font sizes (125%) and scaling (150%) and after setting
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);it scales inadequate in windows because all sizes are multiplied by two even when I have a monitor with 72 DPI.
qDebug() << QGuiApplication::primaryScreen()->logicalDotsPerInch();
shows72still in QML
Screen.devicePixelRatiois2and that is the problemI tried
qputenv("QT_SCALE_FACTOR", QByteArray("0.5"));// it just scales whole app and does not affect scaling coefficients inside
i also tried adding qt.conf with[Platforms] WindowsArguments = dpiawareness=2and it make no effect at all
How to make right scaling of sizes in Windows 10 (not 2, rather 1)?
-
@kenchan I need to disable this for app because if you use for example
anchors.leftMargin: 9it will make margin twice greater with ratio 2
And it has no rationale if Qt::AA_EnableHighDpiScaling makes ratio 2 if windows scales up everything twice itself to scale sizes inside app along with Windows. -
@kenchan I need to disable this for app because if you use for example
anchors.leftMargin: 9it will make margin twice greater with ratio 2
And it has no rationale if Qt::AA_EnableHighDpiScaling makes ratio 2 if windows scales up everything twice itself to scale sizes inside app along with Windows.@Kofr According to the Q docs Window does not actually do any scaling itself...
Microsoft Windows Scaling
The user can choose a scaling factor from the control panel or via context menu. This works by making the functions for querying the system metrics return different values for standard font sizes, sizes of window borders, and so on. It does not perform any actual scaling.I don't use QML so I can't help you with that. Maybe someone else can.