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

[Reg 5.12.4 -> 5.12.5] Mapping between local and global screen coordinates is broken when window on non-primary HighDPI display

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P1: Critical
    • 5.12.5, 5.13.1, 5.14.0 Alpha
    • 5.12.5
    • GUI: Window management
    • None
    • Qt 5.12.5 (qtbase commit 1d8c9978fa)
      Windows 10
    • Windows
    • 174061f9f32ac76c6b8a6d155d772e37708d8cfc (qt/qtbase/5.12)

    Description

      We are using a self-built version of Qt built in mid July from the tip of the 5.12 branch (qtbase commit 1d8c9978fa). Our version of qtbase is unpached relative to the official version. Mapping between local and global coordinates fails when a window is on the non-primary display on a system with two identical High DPI displays. If I build the attached test application with the official 5.12.4, I don't see this behavior, so it seems that it must have been recently introduced.

      I haven't verified which commit caused this problem, but I suspect it's https://code.qt.io/cgit/qt/qtbase.git/commit/src/gui/kernel/qhighdpiscaling.cpp?id=b6ded193ee64ffe67df6d22e7a23aa1ea9e02ec7 based on the file that was changed and the time frame. That commit was related to QTBUG-73231.

      My configuration is two identical 24" high DPI displays running at 200% scaling (configured in the OS) on Windows 10. The left screen is the primary display.

      If I build the attached project with Qt 5.12.4, I get the same correct behavior when I have the main window on either display. If I click within the window, the coordinates in the top group box are the same, and those in the bottom group box are the same (see SecondaryDisplay_Qt5_12_4.PNG). Also, the combo box works correctly in that if I click on it, I can hover over other items and those are displayed as highlighted. Clicking on an item selects it.

      If I build with my version of qt 5.12.5 described above, I still get the expected behavior when the main window is on the primary display. However when I move the main window to the secondary display and click within the window, the position returned by QWidget::mapFromGlobal doesn't agree with the other two coordinates in the upper group box, and the coordinates in the lower group box are different. Also, if I pop up the combo box and move the mouse over the different items, the highlighted item does not change. If I click on one of the items, the click is ignored (instead of being treated as a selection of a different item). This can be seen in SecondaryDisplay_Qt5_12_5.PNG. I have circled the values that do not agree. The red arrow is approximately where the mouse cursor was when I took the screen shot.

      In my case, only the x values of the coordinates disagree. I assume that this is because the monitors are the same height and are arranged next to one another horizontally. If the monitors were stacked on one another, I would expect the y coordinates to disagree instead of the x coordinates.

       

      I have attached the screen information from qtdiag. It's the same for both the official 5.12.4 build and my 5.12.5 build.

      Attachments

        1. qtbug72555_diag.diff
          2 kB
        2. qtbug77255.zip
          3 kB
        3. QTBUG-77255-GlobalPositionBug.zip
          2 kB
        4. qtdiag.txt
          1.0 kB
        5. SecondaryDisplay_Qt5_12_4.PNG
          SecondaryDisplay_Qt5_12_4.PNG
          32 kB
        6. SecondaryDisplay_Qt5_12_5.PNG
          SecondaryDisplay_Qt5_12_5.PNG
          44 kB

        Issue Links

          For Gerrit Dashboard: QTBUG-77255
          # Subject Branch Project Status CR V

          Activity

            People

              kleint Friedemann Kleint
              aclight Adam Light
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes