path: root/doc/src
diff options
authoraavit <>2012-08-17 14:15:36 +0200
committerQt by Nokia <>2012-08-18 10:55:47 +0200
commit94ac17c2ccbe3b3f3671848afda9430be214f8d5 (patch)
tree2de3e6785846238c76ec35f0b75e0c0c78b579d0 /doc/src
parentf6c58d242aa6c75d735ce9484c1f1acac3444ba6 (diff)
Clean up QScreen::grabWindow()
Handle 0 WId parameter as meaning "desktop window"/whole screen. Also, re-add the default values for the grab area, both for convenience and compatibility with QPixmap::grabWindow() in Qt4. Update the screenshot example so it doesn't comlain about usage of deprecated QPixmap::grabWindow(). Change-Id: I2ad229113ddb8ded0388f2ebc0e8c703c6657f1f Reviewed-by: Gunnar Sletta <>
Diffstat (limited to 'doc/src')
1 files changed, 7 insertions, 8 deletions
diff --git a/doc/src/examples/screenshot.qdoc b/doc/src/examples/screenshot.qdoc
index cf6e68b6df..4723d3d43c 100644
--- a/doc/src/examples/screenshot.qdoc
+++ b/doc/src/examples/screenshot.qdoc
@@ -172,16 +172,15 @@
\snippet examples/desktop/screenshot/screenshot.cpp 5
- We take the screenshot using the static QPixmap::grabWindow()
+ Using the static function QApplication::primaryScreen(), we
+ obtain the QScreen object for the application's main screen.
+ We take the screenshot using the QScreen::grabWindow()
function. The function grabs the contents of the window passed as
an argument, makes a pixmap out of it and returns that pixmap.
- We identify the argument window using the QWidget::winID()
- function which returns the window system identifier. Here it
- returns the identifier of the current QDesktopWidget retrieved by
- the QApplication::desktop() function. The QDesktopWidget class
- provides access to screen information, and inherits
- QWidget::winID().
+ The window id can be obtained with QWidget::winId() or QWindow::winId().
+ Here, however, we just pass 0 as the window id, indicating that we
+ want to grab the entire screen.
We update the screenshot preview label using the private \c
updateScreenshotLabel() function. Then we enable the \uicontrol {New