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

A list of per-monitor high DPI support issues on Windows

    XMLWordPrintable

Details

    Description

      Update (Dec 13 2018): I have tested the suggested fix, which is to add

      QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);

      before creating QApplication instance. It seems to solve all the problems except for #4 and a new issue with the icons inside QTreeWidget.

      Here's what the test application looks like on the primary monitor with 175% scale:

      Bug: the triangle icons are blurry. One could think it's simply due to up-scaling, but you can see below that without `AA_EnableHighDpiScaling` they're very crisp.

      And here's the secondary monitor with 100% scale. The up/down arrows in the spinbox are still oversized. I also don't like how the QRadioButton circles are rendered.

       

      -----------------------------------------------------------------------------------

      Qt has decent high DPI support (good, even), but there's one class of issues still present. When there is more than one monitor in the system, and they have different display scaling factors, Qt always calculates some UI elements based on the primary monitor instead of the monitor the window is on.

      I have made a tiny demo to illustrate all the issues that I've noticed at once (hDPI-demo.zip). Steps to reproduce:

      1. Use a Windows computer with more than one display; set different scaling factors for primary and secondary displays. In the following example the primary display is 4K with 200% scale, the secondary is Full HD with 100% (no scaling).
      2. Run the attached demo and move it to the secondary monitor. It doesn't matter which monitor the applications starts on initially.

       

      Screenshot from the primary monitor (good):

       

      Secondary monitor (bad):

      The size of the text items is correct, while some other elements are over-sized. Namely:

      1. The radiobutton circles are oversized compared to the text labels.
      2. The checkbox checkmark is oversized compared to the text labels.
      3. The button is oversized compared to its caption text.
      4. The spinbox up/down arrows are oversized.
      5. The combobox is oversized.
      6. The icons inside QTreeWidget are oversized.
      7. The left margin is too large between QTreeWidget edge and the column 0 text label.
      8. The menu items are oversized, except the top-level menu which is rendered correctly.
      9. The scroll bars are oversized.
      10. The layout spacing between adjacent elements (e. g. between the spinbox and the combobox) has equal pixel size on both monitors - 6 px. Probably should be 12 on the primary monitor (the one with 200% scaling).

      Attachments

        1. diag_with_scaling.txt
          8 kB
        2. diag.txt
          8 kB
        3. hDPI-demo.zip
          3 kB
        4. image-2017-11-30-14-13-10-846.png
          image-2017-11-30-14-13-10-846.png
          11 kB
        5. image-2017-11-30-14-14-40-874.png
          image-2017-11-30-14-14-40-874.png
          11 kB
        6. image-2017-11-30-14-32-30-431.png
          image-2017-11-30-14-32-30-431.png
          18 kB
        7. image-2017-11-30-14-34-04-054.png
          image-2017-11-30-14-34-04-054.png
          9 kB
        8. image-2017-11-30-14-38-25-905.png
          image-2017-11-30-14-38-25-905.png
          4 kB
        9. image-2017-11-30-14-38-42-415.png
          image-2017-11-30-14-38-42-415.png
          4 kB
        10. image-2018-12-13-13-03-58-213.png
          image-2018-12-13-13-03-58-213.png
          19 kB
        11. image-2018-12-13-13-05-38-227.png
          image-2018-12-13-13-05-38-227.png
          6 kB
        12. image-2018-12-14-10-07-03-128.png
          image-2018-12-14-10-07-03-128.png
          28 kB
        13. image-2018-12-14-10-07-20-013.png
          image-2018-12-14-10-07-20-013.png
          11 kB
        14. image-2018-12-14-10-07-36-358.png
          image-2018-12-14-10-07-36-358.png
          25 kB
        15. qtbug64890.zip
          3 kB

        Issue Links

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

          Activity

            People

              Unassigned Unassigned
              alexium Alex
              Veli-Pekka Heinonen Veli-Pekka Heinonen
              Votes:
              9 Vote for this issue
              Watchers:
              17 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes