Make grabWindow return pixmap with correct dpr

The devicePixelRatio on the returned pixmap should
be the product of the Qt and platform scale factors.

This handles the corner case of setting QT_SCALE_FACTOR
on macOS with a high-dpi display.

Change-Id: I3600165d47c03c4e043bcc5e375932cc3fc0c544
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
bb10
Morten Johan Sørvig 2018-09-25 12:20:37 +02:00 committed by Liang Qi
parent fbbe8aba9d
commit 8802826de6
1 changed files with 1 additions and 1 deletions

View File

@ -748,7 +748,7 @@ QPixmap QScreen::grabWindow(WId window, int x, int y, int width, int height)
QPixmap result =
platformScreen->grabWindow(window, nativePos.x(), nativePos.y(),
nativeSize.width(), nativeSize.height());
result.setDevicePixelRatio(factor);
result.setDevicePixelRatio(result.devicePixelRatio() * factor);
return result;
}