When having a setup of 2 screens, 4k monitor at 200% scaling and second one 1920x1200 at 150% scaling, with dpiawareness=2, the part of a window that spans to the second monitor yields a mismatch between QCursor::pos() and QMouseEvent::globalPos(). It seems that the QCursor::pos() does not take in to account the scaling of the first monitor and so the QCursor::pos() values are out of the actually workable area.
Steps to reproduce:
- Run attached sample
- Move the application window such that part of it is on second monitor, but it still reports it is on primary monitor
- Mouseclick on the area that spans to the second monitor
- EXPECTED: Sample app does not yield any debug output since QCursor::pos() and QMouseEvent::globalPos() give same values
- ACTUAL: QCursor::pos() values do not account for high dpi scaling and debug output shows this
Disabling the AA_EnableHighDpiScaling removes this issue. Using dpiawareness=1 or 0 also disables hides this problem.
Update: Things to look out for that will appear wrong are:
- Menus can open up on the wrong position.
- Tooltips in wrong position
- Toolbar button issues.
- Windows have the wrong size.