diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/manual/quickwidget-switch/main.cpp | 3 |
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); |