#include "qdesktopwidget.h"
#include "qevent.h"
#include "qpixmap.h"
+#include "qscreen.h"
#include "qpainter.h"
#include "qtimer.h"
#include "qhash.h"
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)
#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>
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);