1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-03-01 12:09:50 +00:00

Do not use deprecated Qt API in the launcher

This commit is contained in:
Andrei Kortunov 2019-11-28 09:48:59 +04:00
parent e44021b369
commit 47a13f1ed2

View file

@ -5,6 +5,10 @@
#include <QMessageBox> #include <QMessageBox>
#include <QDir> #include <QDir>
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
#include <QScreen>
#endif
#ifdef MAC_OS_X_VERSION_MIN_REQUIRED #ifdef MAC_OS_X_VERSION_MIN_REQUIRED
#undef 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 // 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 Launcher::GraphicsPage::getMaximumResolution()
{ {
QRect max; 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(); int screens = QApplication::desktop()->screenCount();
for (int i = 0; i < screens; ++i) for (int i = 0; i < screens; ++i)
{ {
@ -320,6 +335,7 @@ QRect Launcher::GraphicsPage::getMaximumResolution()
if (res.height() > max.height()) if (res.height() > max.height())
max.setHeight(res.height()); max.setHeight(res.height());
} }
#endif
return max; return max;
} }