summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/widgets/qopenglwidget/tst_qopenglwidget.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/widgets/widgets/qopenglwidget/tst_qopenglwidget.cpp')
-rw-r--r--tests/auto/widgets/widgets/qopenglwidget/tst_qopenglwidget.cpp14
1 files changed, 5 insertions, 9 deletions
diff --git a/tests/auto/widgets/widgets/qopenglwidget/tst_qopenglwidget.cpp b/tests/auto/widgets/widgets/qopenglwidget/tst_qopenglwidget.cpp
index a18fd0299a..1e99bb4074 100644
--- a/tests/auto/widgets/widgets/qopenglwidget/tst_qopenglwidget.cpp
+++ b/tests/auto/widgets/widgets/qopenglwidget/tst_qopenglwidget.cpp
@@ -504,23 +504,19 @@ static inline QString msgRgbMismatch(unsigned actual, unsigned expected)
static QPixmap grabWidgetWithoutRepaint(const QWidget *widget, QRect clipArea)
{
- const QWidget *targetWidget = widget;
+ const QWindow *window = widget->window()->windowHandle();
+ Q_ASSERT(window);
+ WId windowId = window->winId();
+
#ifdef Q_OS_WIN
// OpenGL content is not properly grabbed on Windows when passing a top level widget window,
// because GDI functions can't grab OpenGL layer content.
// Instead the whole screen should be captured, with an adjusted clip area, which contains
// the final composited content.
- QWidget *desktopWidget = QApplication::desktop(QGuiApplication::primaryScreen());
- const QWidget *mainScreenWidget = desktopWidget;
- targetWidget = mainScreenWidget;
+ windowId = 0;
clipArea = QRect(widget->mapToGlobal(clipArea.topLeft()),
widget->mapToGlobal(clipArea.bottomRight()));
#endif
-
- const QWindow *window = targetWidget->window()->windowHandle();
- Q_ASSERT(window);
- WId windowId = window->winId();
-
QScreen *screen = window->screen();
Q_ASSERT(screen);