summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qscreen.h
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2020-06-15 14:07:48 +0200
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2020-07-01 07:09:24 +0200
commit980795dc557772d117ec03d16646557665eb895e (patch)
tree8708828ea362adabeb1f89202672ca3c1123f342 /src/gui/kernel/qscreen.h
parent836c0b5a24f5ceb8ed7dce0129f433bf23f58c25 (diff)
Let QScreen::grabWindow's winId parameter default to 0 and add test
The platform plugins are implemented to grab the entire screen if no window ID is provided. They do not grab the entire virtual screen, just the screen the method is called on. On macOS, the implementation ignored the window parameter, and always grabbed the entire virtual screen. This change fixes the cocoa implementation. The test passes in local tests (with two displays with different dpr). Since grabbing a screen returns an image with managed colors, we need to convert it to sRGB color spec first, otherwise displaying a grabbed image will produce different results. This will need to be changed once Qt supports a fully color managed flow. The test does not cover the case where a window spans multiple displays, since this is generally not supported at least on macOS. The code that exists in QCocoaScreen to handle that case is untested, but with the exception of the optimization it is also unchanged. Done-with: Morten Sørvig <morten.sorvig@qt.io> Change-Id: I8ac1233e56d559230ff9e10111abfb6227431e8c Fixes: QTBUG-84876 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src/gui/kernel/qscreen.h')
-rw-r--r--src/gui/kernel/qscreen.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/gui/kernel/qscreen.h b/src/gui/kernel/qscreen.h
index 039940f196..1bff3f4ec1 100644
--- a/src/gui/kernel/qscreen.h
+++ b/src/gui/kernel/qscreen.h
@@ -144,7 +144,7 @@ public:
bool isPortrait(Qt::ScreenOrientation orientation) const;
bool isLandscape(Qt::ScreenOrientation orientation) const;
- QPixmap grabWindow(WId window, int x = 0, int y = 0, int w = -1, int h = -1);
+ QPixmap grabWindow(WId window = 0, int x = 0, int y = 0, int w = -1, int h = -1);
qreal refreshRate() const;