Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-65061

Uselessness of setAttribute(Qt::AA_EnableHighDpiScaling)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Out of scope
    • Icon: P5: Not important P5: Not important
    • None
    • 5.10.0
    • GUI: High-DPI
    • None

      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();
      shows 72

      still in QML
      Screen.devicePixelRatio is 2

      I 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=2
      and it make no effect at all

      It means that setAttribute(Qt::AA_EnableHighDpiScaling) is just useless for desktops as it for some reason takes in account windows scaling.
      And developers have to use old method with calculating coefficients for each explicit size in app like font.pixelSize: 12 * hlpr.dpF

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            sorvig Morten Sørvig
            kofr Konstantinr
            Votes:
            4 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes