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

Application::setAttribute(Qt::AA_EnableHighDpiScaling) does not work as expected.

    XMLWordPrintable

Details

    • Windows

    Description

      The attribute Qt::AA_EnableHighDpiScaling was introduced to solve scaling issues of the user interface for HiDPI displays. Under Windows, this flag has no effect at all. Even worse, fonts are scaled correctly - but the layout and the widgets are not scaled at all.

      See the attached sample application QtHiDpiTest.zip.

      This application enabled the high DPI scaling for windows and creates a simple main window with three buttons. The layout creates a 16 point margin around and 8 point spacing between the buttons.

      If you run this example application under Windows 10 and set the scaling 100%, 150%, 200% and 300%, you will get a result as shown in the following screenshots:

      100%:

      150%:

      200%:

      300%:

       

      You can see a number of issues with the scaling:

      • Only the font and windows frame is scaled.
      • The layout parameters margin=16 and spacing=16 are not scaled.
      • The button frames and widget elements are not scaled. The button frame is still one pixel, even at 300%.

      This lack of proper scaling leads to strange and not very friendly user interface layouts. Especially if there are icons and other fixed elements involved. E.g. if a label with an icon is set to the fixed size of 16x16, it will be that size, even at a scaling level of 300%.

      The Qt::AA_EnableHighDpiScaling flag seems to have no effect at all.

      Steps to Reproduce this Problem:

      • Use the latest Windows 10 Operating system.
      • Compile the Example Application.
      • Start the application at 100%, 150%, 200% or 300%

      Expected Behaviour:

      • The user interface with all its elements is scaled with the configured scale factor. This includes the following elements:
        • QLayout margin and spacing.
        • QWidget minimum/maximum width/height
        • Box padding margin from stylesheets.
        • Line widths of the widgets, like QPushButton, QRadioButton etc.
        • Line widths set in stylesheets (box model)

      Actual Behaviour:

      • Only the font is scaled to the correct size.

       

       

       

      Attachments

        1. 100.png
          10 kB
          Tobias Erbsland
        2. 150b.png
          13 kB
          Tobias Erbsland
        3. 200.png
          16 kB
          Tobias Erbsland
        4. 300.png
          22 kB
          Tobias Erbsland
        5. no-scaling.png
          1007 kB
          Tobias Erbsland
        6. QtHiDpiTest.zip
          1 kB
          Tobias Erbsland
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            drzoom Tobias Erbsland
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes