diff options
author | Friedemann Kleint <Friedemann.Kleint@nokia.com> | 2012-04-30 14:42:40 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-05-01 07:10:40 +0200 |
commit | 0b05e4cdd5800b9ea90eaface984dc21f506ac92 (patch) | |
tree | b5295bc8a4307c161508c3bedd24b8bab7e11ff4 /src/widgets | |
parent | 1767e21123a6b3d9bfa71027ad42cb16b43f7b4f (diff) |
Widgets: No longer use deprecated QPixmap::grabWindow(),grabWidget().
Change-Id: Icf0d6a672edcfd1d3d10275bb9a93bde29251e79
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
Diffstat (limited to 'src/widgets')
-rw-r--r-- | src/widgets/kernel/qwhatsthis.cpp | 5 | ||||
-rw-r--r-- | src/widgets/styles/qwindowsvistastyle.cpp | 18 |
2 files changed, 17 insertions, 6 deletions
diff --git a/src/widgets/kernel/qwhatsthis.cpp b/src/widgets/kernel/qwhatsthis.cpp index 9d3493dc8a..5df69be020 100644 --- a/src/widgets/kernel/qwhatsthis.cpp +++ b/src/widgets/kernel/qwhatsthis.cpp @@ -47,6 +47,7 @@ #include "qdesktopwidget.h" #include "qevent.h" #include "qpixmap.h" +#include "qscreen.h" #include "qpainter.h" #include "qtimer.h" #include "qhash.h" @@ -232,8 +233,8 @@ QWhatsThat::~QWhatsThat() void QWhatsThat::showEvent(QShowEvent *) { - background = QPixmap::grabWindow(QApplication::desktop()->internalWinId(), - x(), y(), width(), height()); + background = QGuiApplication::primaryScreen()->grabWindow(QApplication::desktop()->internalWinId(), + x(), y(), width(), height()); } void QWhatsThat::mousePressEvent(QMouseEvent* e) diff --git a/src/widgets/styles/qwindowsvistastyle.cpp b/src/widgets/styles/qwindowsvistastyle.cpp index 86574f2587..138f5dbf17 100644 --- a/src/widgets/styles/qwindowsvistastyle.cpp +++ b/src/widgets/styles/qwindowsvistastyle.cpp @@ -41,6 +41,8 @@ #include "qwindowsvistastyle.h" #include "qwindowsvistastyle_p.h" +#include <qscreen.h> +#include <qwindow.h> #include <private/qstylehelper_p.h> #include <private/qsystemlibrary_p.h> #include <private/qapplication_p.h> @@ -1655,10 +1657,18 @@ void QWindowsVistaStyle::drawComplexControl(ComplexControl control, const QStyle t->setStartImage(startImage); } else { QPoint offset(0, 0); - if (!widget->internalWinId()) - offset = widget->mapTo(widget->nativeParentWidget(), offset); - t->setStartImage(QPixmap::grabWindow(widget->effectiveWinId(), offset.x(), offset.y(), - option->rect.width(), option->rect.height()).toImage()); + QWindow *window = widget->windowHandle(); + if (!window) { + if (const QWidget *nativeParent = widget->nativeParentWidget()) { + offset = widget->mapTo(nativeParent, offset); + window = nativeParent->windowHandle(); + } + } + if (window && window->handle()) { + const QPixmap pixmap = window->screen()->grabWindow(window->winId(), + offset.x(), offset.y(), option->rect.width(), option->rect.height()); + t->setStartImage(pixmap.toImage()); + } } } else { startImage.fill(0); |