Skip to content

Commit

Permalink
Merge pull request #245 from Chrezm/244/add-starting-up-argument-nosc…
Browse files Browse the repository at this point in the history
…aling

Added -noscaling argument option
  • Loading branch information
TrickyLeifa authored Oct 29, 2021
2 parents f3c63ab + 54bad29 commit d725b1a
Showing 1 changed file with 28 additions and 4 deletions.
32 changes: 28 additions & 4 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,37 @@

#include "lobby.h"

#include <QDebug>

int main(int argc, char *argv[])
{
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
// High-DPI support is for Qt version >=5.6.
// However, many Linux distros still haven't brought their stable/LTS
// packages up to Qt 5.6, so this is conditional.
AOApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
bool l_dpi_scaling = true;

for (int i = 0; i < argc; ++i)
{
const QString l_arg(argv[i]);

if (l_arg == "-noscaling")
{
l_dpi_scaling = false;
}
}

if (l_dpi_scaling)
{
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
}
else
{
qputenv("QT_FONT_DPI", "96");
qputenv("QT_SCALE_FACTOR", "1");
qputenv("QT_AUTO_SCREEN_SCALE_FACTOR", "0");

QCoreApplication::setAttribute(Qt::AA_DisableHighDpiScaling);
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling, false);
}
#endif

#ifdef Q_OS_MACOS
Expand Down

0 comments on commit d725b1a

Please sign in to comment.