Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.6.3, 5.9.8, 5.12.4, 5.12.5, 5.13.0
-
Windows 10, Visual Studio 2017
Description
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.
Scenario:
- 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.
Attachments
Issue Links
- duplicates
-
QTBUG-55038 QCursor::setPos(const QPoint &p) fails when the point is not on the primary screen.
- Open
- is duplicated by
-
QTBUG-99009 QCursor::setPos X coordinates is wrong when DPI scaling is used
- Reported
- relates to
-
QTBUG-77086 Context menus mis-positioned in dual HighDPI screens
- Reported
-
QTBUG-73231 When a menubar spans across displays using different DPIs then opening menus on either display can show the menu in the wrong place
- In Progress
-
QTBUG-79630 tooltip global position wrong with dual screen different highDPI
- Closed
-
QTBUG-55038 QCursor::setPos(const QPoint &p) fails when the point is not on the primary screen.
- Open
-
QTBUG-77307 [HighDPI multi-monitor Mixed screen scale factors] window frame shows with incorrect scaling
- Closed