Replace deprecated QDesktop::numScreens() call

pull/3/head
Hleb Valoshka 2019-11-19 20:57:22 +03:00
parent c7432f10b2
commit 6e871064e4
1 changed files with 3 additions and 3 deletions

View File

@ -38,6 +38,7 @@
#include <QDesktopWidget> #include <QDesktopWidget>
#include <QInputDialog> #include <QInputDialog>
#include <QUrl> #include <QUrl>
#include <QScreen>
#include <vector> #include <vector>
#include <string> #include <string>
#include <cassert> #include <cassert>
@ -446,10 +447,9 @@ void CelestiaAppWindow::readSettings()
// Make sure that the saved size fits on screen; it's possible for the previous saved // Make sure that the saved size fits on screen; it's possible for the previous saved
// position to be off-screen if the monitor settings have changed. // position to be off-screen if the monitor settings have changed.
bool onScreen = false; bool onScreen = false;
for (int screenIndex = 0; screenIndex < desktop.numScreens(); screenIndex++) foreach (const QScreen *screen, QGuiApplication::screens())
{ {
QRect screenGeometry = desktop.screenGeometry(screenIndex); if (screen->geometry().contains(windowPosition))
if (screenGeometry.contains(windowPosition))
onScreen = true; onScreen = true;
} }