Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. setAttribute(Qt::AA_EnableHighDpiScaling) does not work proprly
Qt 6.11 is out! See what's new in the release blog

setAttribute(Qt::AA_EnableHighDpiScaling) does not work proprly

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 8.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Kofr
    wrote on last edited by Kofr
    #1

    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 and that is the problem

    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

    How to make right scaling of sizes in Windows 10 (not 2, rather 1)?

    1 Reply Last reply
    0
    • K Offline
      K Offline
      kenchan
      wrote on last edited by
      #2

      in my experience on Windows 10 if you scale to 150% the dpr will be 2.

      K 1 Reply Last reply
      0
      • K kenchan

        in my experience on Windows 10 if you scale to 150% the dpr will be 2.

        K Offline
        K Offline
        Kofr
        wrote on last edited by Kofr
        #3

        @kenchan I need to disable this for app because if you use for example anchors.leftMargin: 9 it 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.

        K 1 Reply Last reply
        0
        • K Kofr

          @kenchan I need to disable this for app because if you use for example anchors.leftMargin: 9 it 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.

          K Offline
          K Offline
          kenchan
          wrote on last edited by
          #4

          @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.

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved