summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qscreen.cpp
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.cpp
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.cpp')
-rw-r--r--src/gui/kernel/qscreen.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/gui/kernel/qscreen.cpp b/src/gui/kernel/qscreen.cpp
index 3fd1548d04..1d11358b3d 100644
--- a/src/gui/kernel/qscreen.cpp
+++ b/src/gui/kernel/qscreen.cpp
@@ -703,10 +703,11 @@ QScreen *QScreen::virtualSiblingAt(QPoint point)
/*!
Creates and returns a pixmap constructed by grabbing the contents
of the given \a window restricted by QRect(\a x, \a y, \a width,
- \a height).
+ \a height). If \a window is 0, then the entire screen will be
+ grabbed.
The arguments (\a{x}, \a{y}) specify the offset in the window,
- whereas (\a{width}, \a{height}) specify the area to be copied. If
+ whereas (\a{width}, \a{height}) specify the area to be copied. If
\a width is negative, the function copies everything to the right
border of the window. If \a height is negative, the function
copies everything to the bottom of the window.