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

HiDPI Scaling gets positions wrong outside the first screen

    XMLWordPrintable

Details

    Description

      I had fixed this prior to 5.13 but the patch was never accepted:
      https://codereview.qt-project.org/c/qt/qtbase/+/188493

      The problem is that Qt is adding device-independent pixels to device-dependent ones when calculating the positions of anything outside the first screen and coming up with nonsense. This can be seen from these lines in qtdiag:

        Geometry: 1920x1080+3200+0 (native: 3840x2160+3200+0) Available: 1920x1080+3200+0
        Virtual geometry: 5120x1080+0+0 Available: 5120x1080+0+0
      

      The number 5120 is 1920+3200, but 1920 is a scaled number and 3200 isn't. That means 5120 is a nonsensical result. The end result is that positioning of many things are off.

      See the attachment for an example. Note the menu is flush to the right of the second screen, so it's not exactly where it should have been. The File menu (hidden below the ruler) thinks it's roughly at position +3200, so it tries to display the menu at that position. But the actual screen size is only 1920+1600 = 3520 scaled pixels wide.

      In the VirtualBox main window is in straddling both screens. Note the position of the menu drop-down.

      Another application affected is kmail. Interestingly, it appears only the main window is affected. See the screenshots 1 and 2 to see the menu. The main window is stable so long as I don't resize it. If I do, drawing errors accumulate (screenshot-kmail3.png). This all widgets on the main window's viewport (the message list and folder list do not update, but the scrollbars do).

      This does not happen in most other applications, notably Qt Creator and the main window examples. I'll keep trying to find an example that shows these issues.

      Attachments

        1. screenshot-vbox2.png
          screenshot-vbox2.png
          2.53 MB
        2. screenshot-vbox.png
          screenshot-vbox.png
          3.03 MB
        3. screenshot-kmail2.png
          screenshot-kmail2.png
          2.35 MB
        4. screenshot-kmail1.png
          screenshot-kmail1.png
          2.55 MB
        5. Screenshot_20200213_100723.png
          Screenshot_20200213_100723.png
          1.85 MB
        6. qtdiag.txt
          1 kB
        7. krdc-screen2.log
          421 kB
        8. krdc-screen1.log
          419 kB

        Issue Links

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

          Activity

            People

              sorvig Morten Sørvig
              thiago Thiago Macieira
              Veli-Pekka Heinonen Veli-Pekka Heinonen
              Votes:
              8 Vote for this issue
              Watchers:
              19 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes