From 47a13f1ed2d97d4bb2bc8082ffb64e5daa0c7f8a Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Thu, 28 Nov 2019 09:48:59 +0400 Subject: [PATCH] Do not use deprecated Qt API in the launcher --- apps/launcher/graphicspage.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/apps/launcher/graphicspage.cpp b/apps/launcher/graphicspage.cpp index 4ba164698..6bc22bad6 100644 --- a/apps/launcher/graphicspage.cpp +++ b/apps/launcher/graphicspage.cpp @@ -5,6 +5,10 @@ #include #include +#if QT_VERSION >= QT_VERSION_CHECK(5,0,0) +#include +#endif + #ifdef MAC_OS_X_VERSION_MIN_REQUIRED #undef MAC_OS_X_VERSION_MIN_REQUIRED // We need to do this because of Qt: https://bugreports.qt-project.org/browse/QTBUG-22154 @@ -311,6 +315,17 @@ QStringList Launcher::GraphicsPage::getAvailableResolutions(int screen) QRect Launcher::GraphicsPage::getMaximumResolution() { QRect max; + +#if QT_VERSION >= QT_VERSION_CHECK(5,0,0) + for (QScreen* screen : QGuiApplication::screens()) + { + QRect res = screen->geometry(); + if (res.width() > max.width()) + max.setWidth(res.width()); + if (res.height() > max.height()) + max.setHeight(res.height()); + } +#else int screens = QApplication::desktop()->screenCount(); for (int i = 0; i < screens; ++i) { @@ -320,6 +335,7 @@ QRect Launcher::GraphicsPage::getMaximumResolution() if (res.height() > max.height()) max.setHeight(res.height()); } +#endif return max; }