summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorten Johan Sørvig <morten.sorvig@qt.io>2018-09-25 12:20:37 +0200
committerLiang Qi <liang.qi@qt.io>2018-11-11 09:10:05 +0000
commit8802826de6d8a87ad6f29b98eff1eb36964c3e60 (patch)
tree4d3eb7c9249063e6c11f5ed85359fe5cb9f7ad97
parentfbbe8aba9d70a3c13d1cd7797eb4dbbd1f05ade5 (diff)
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>
-rw-r--r--src/gui/kernel/qscreen.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/gui/kernel/qscreen.cpp b/src/gui/kernel/qscreen.cpp
index 479e228e27..0ff439abea 100644
--- a/src/gui/kernel/qscreen.cpp
+++ b/src/gui/kernel/qscreen.cpp
@@ -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;
}