diff options
author | aavit <qt_aavit@ovi.com> | 2012-08-17 14:15:36 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-08-18 10:55:47 +0200 |
commit | 94ac17c2ccbe3b3f3671848afda9430be214f8d5 (patch) | |
tree | 2de3e6785846238c76ec35f0b75e0c0c78b579d0 /examples | |
parent | f6c58d242aa6c75d735ce9484c1f1acac3444ba6 (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 <gunnar.sletta@nokia.com>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/desktop/screenshot/screenshot.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/examples/desktop/screenshot/screenshot.cpp b/examples/desktop/screenshot/screenshot.cpp index c9310c9e2f..12c6bee6d4 100644 --- a/examples/desktop/screenshot/screenshot.cpp +++ b/examples/desktop/screenshot/screenshot.cpp @@ -115,7 +115,9 @@ void Screenshot::shootScreen() originalPixmap = QPixmap(); // clear image for low memory situations // on embedded devices. //! [5] - originalPixmap = QPixmap::grabWindow(QApplication::desktop()->winId()); + QScreen *screen = QGuiApplication::primaryScreen(); + if (screen) + originalPixmap = screen->grabWindow(0); updateScreenshotLabel(); newScreenshotButton->setDisabled(false); |