summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Lemire <paul.lemire@kdab.com>2022-12-14 07:04:31 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-12-20 07:50:21 +0000
commit7ca2185ae79ebc143336bc9c377a9845f602f7b8 (patch)
treed199c2ed68a8ef0d8d30baa1a4f9aeba5a979557
parentc464b52d12660b80de8598e548702eb735c7f626 (diff)
downloadqt3d-7ca2185ae79ebc143336bc9c377a9845f602f7b8.tar.gz
quickwidget-switch: make it work in a single screen setup
Change-Id: I5f17169c106a70c38bcc29cc7758b2bb4b9ee793 Reviewed-by: Mike Krus <mike.krus@kdab.com> (cherry picked from commit 675bb0d0922253818e3efe4a207910bbcf40d9e7) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--tests/manual/quickwidget-switch/main.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/manual/quickwidget-switch/main.cpp b/tests/manual/quickwidget-switch/main.cpp
index 04b08c2a3..42e6d3466 100644
--- a/tests/manual/quickwidget-switch/main.cpp
+++ b/tests/manual/quickwidget-switch/main.cpp
@@ -35,7 +35,8 @@ int main(int argc, char* argv[])
QMainWindow w2;
w2.winId();
- w2.windowHandle()->setScreen(QGuiApplication::screens().at(1));
+ const int secondScreenIdx = QGuiApplication::screens().size() > 1 ? 1 : 0;
+ w2.windowHandle()->setScreen(QGuiApplication::screens().at(secondScreenIdx));
auto mdiArea2 = new QMdiArea;
auto button2 = new QPushButton("Switch to this window");
configureMainWindow(&w2, mdiArea2, button2);