Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
6.5.6, 6.7.2
Description
Reproducer attached. One needs 2 monitors with one extending the other to see the problem.
On Windows, it is going to take screenshots for each of the screens. And one can see "screen0.png" and "screen1.png" for the result, that both screens are properly captured, i.e. origin at top-left corner of each screen and size of each screen.
On macOS, the screenshot for the secondary monitor looks weird. It captures with origin at top-level corner of primary screen but still the size of secondary screen. One has to do something like
screen->grabWindow(0, screen->geometry().x(), screen->geometry().y(), screen->geometry().width(), screen->geometry().height());
to compensate the offset of secondary screen w.r.t primary screen.
Nevertheless, the seemingly correct behavior on Windows is said to be the one with bug. Because on both platforms the coordinate should be w.r.t primary screen. However, the solution on macOS, i.e.
screen->grabWindow(0, screen->geometry().x(), screen->geometry().y(), screen->geometry().width(), screen->geometry().height());
produces nonsense pixmap on Windows.
Anyway, the inconsistency is troublesome. A workaround is to just use
screen->grabWindow(0);
and let Qt decides the rest by itself.
Attachments
Issue Links
- duplicates
-
QTBUG-100412 tst_qsrceen::grabWindow is flaky on Windows
- Closed
- is duplicated by
-
QTBUG-58111 QScreen::grabWindow(0) for grabbing whole screen is undocumented
- Closed
- relates to
-
QTBUG-94748 QScreen::grabWindow(0, ...) isn't working on second display
- Open