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

[HighDPI multi-monitor Mixed screen scale factors] QCursor::setPos setting incorrect positions on non-primary monitor



    • Windows


      Calling QCursor::setPos() will not position the cursor to the global coordinates passed in if the active window calling the code is presently on the non-primary monitor. Instead, it will position the cursor to the coordinates passed in, scaled using the devicePixelRatio of the primary monitor.

      Below are steps to reproduce with the attached example app QTBUG-78320-hidpi-nonprimary-setpos-getpos.zip:

      Main window has a button that if you click, will call QCursor::setPos(QCursor::pos());
      Click this to show the behavior.


      • Windows 10
      • Primary monitor resolution 3840x2160, scale factor 250%
      • Secondary monitor resolution 1920x1080, scale factor 100%
      • Tested with test app
        • Launched from primary display
        • Launched from primary display, window dragged to secondary display prior to clicking Set Mouse Position button.
        • Launched from secondary display (mouse pointer on secondary display prior to app launch)

      If you set the cursor position to it's current position - QCursor::setPos(QCursor::pos()) - which should be a no-op:

      • When the main window is on the primary monitor, it is a no-op as expected.
      • When the main window is on the non-primary monitor (no matter how it is started), it is scaled by the scale factor of the primary monitor.


        Issue Links

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



              Unassigned Unassigned
              kkyzivat Keith Kyzivat
              1 Vote for this issue
              7 Start watching this issue



                Gerrit Reviews

                  There are no open Gerrit changes