summaryrefslogtreecommitdiffstats
path: root/tests/manual/qscreen/main.cpp
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-10-17 01:01:01 +0200
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-10-17 01:01:01 +0200
commit6f27bb135246b7fe9d11ba58e05d2b7661bc2080 (patch)
tree9704e1c4ffb775472a9984872c3bd292faa999a5 /tests/manual/qscreen/main.cpp
parentdc4212b3a694e143595968419ae5ad695ab2aa03 (diff)
parentc222a9283d94ad1e29334bb2fba0beef7cc716c7 (diff)
Merge remote-tracking branch 'origin/5.15' into dev
Diffstat (limited to 'tests/manual/qscreen/main.cpp')
-rw-r--r--tests/manual/qscreen/main.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/tests/manual/qscreen/main.cpp b/tests/manual/qscreen/main.cpp
index 6fba872b12..0728d66bf9 100644
--- a/tests/manual/qscreen/main.cpp
+++ b/tests/manual/qscreen/main.cpp
@@ -61,8 +61,10 @@ public:
QLatin1String("Left-click to test QGuiApplication::topLevelAt(click pos)\nRight-click to ungrab\n") :
QLatin1String("Left-click to grab mouse\n");
if (!m_cursorPos.isNull()) {
+ const auto screen = QGuiApplication::screenAt(m_cursorPos);
+ const auto screenNum = screen ? QGuiApplication::screens().indexOf(screen) : 0;
txt += QString(QLatin1String("Current mouse position: %1, %2 on screen %3\n"))
- .arg(m_cursorPos.x()).arg(m_cursorPos.y()).arg(QApplication::desktop()->screenNumber(m_cursorPos));
+ .arg(m_cursorPos.x()).arg(m_cursorPos.y()).arg(screenNum);
if (QGuiApplication::mouseButtons() & Qt::LeftButton) {
QWindow *win = QGuiApplication::topLevelAt(m_cursorPos);
txt += QString(QLatin1String("Top-level window found? %1\n"))
@@ -234,6 +236,7 @@ void screenAdded(QScreen* 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));
w->show();