1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-02-19 17:09:40 +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 <QDir>
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
#include <QScreen>
#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;
}