summaryrefslogtreecommitdiffstats
path: root/tests/manual/qscreen/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/manual/qscreen/main.cpp')
-rw-r--r--tests/manual/qscreen/main.cpp14
1 files changed, 5 insertions, 9 deletions
diff --git a/tests/manual/qscreen/main.cpp b/tests/manual/qscreen/main.cpp
index d2c9842365..e6f0dc9fd7 100644
--- a/tests/manual/qscreen/main.cpp
+++ b/tests/manual/qscreen/main.cpp
@@ -39,7 +39,6 @@
#include <QAction>
#include <QStatusBar>
#include <QLineEdit>
-#include <QDesktopWidget>
#include <QPushButton>
#include <QLabel>
#include <QMouseEvent>
@@ -229,14 +228,11 @@ void screenAdded(QScreen* screen)
(screen->virtualSiblings().isEmpty() ? "none" : qPrintable(screen->virtualSiblings().first()->name())));
ScreenWatcherMainWindow *w = new ScreenWatcherMainWindow(screen);
- // Set the screen via QDesktopWidget. This corresponds to setScreen() for the underlying
- // QWindow. This is essential when having separate X screens since the the positioning below is
- // not sufficient to get the windows show up on the desired screen.
- QList<QScreen *> screens = QGuiApplication::screens();
- int screenNumber = screens.indexOf(screen);
- Q_ASSERT(screenNumber >= 0);
- // ### Qt 6: Find a replacement for QDesktopWidget::screen()
- w->setParent(qApp->desktop()->screen(screenNumber));
+ // Set the screen; this corresponds to setScreen() for the underlying
+ // QWindow. This is essential when having separate X screens since the
+ // positioning below is not sufficient to get the windows show up on the
+ // desired screen.
+ w->setParent(qApp->desktop(screen));
w->show();