diff options
author | hjk <hjk@qt.io> | 2023-08-10 10:03:04 +0200 |
---|---|---|
committer | hjk <hjk@qt.io> | 2023-08-10 10:03:04 +0200 |
commit | 0be0772fc9d449de6f4f40043beec38854c36e50 (patch) | |
tree | 9822b9fac4558e025f7a6b585bedc01cc18b9467 /src/app/main.cpp | |
parent | 0e4710b70853067cca222face6cfb329bae47326 (diff) | |
parent | d1deeb2c0d2c3f22be7d970e5e0f166f5101667b (diff) |
Merge remote-tracking branch 'origin/11.0'
Change-Id: Ib67c8ecb1865ee31ca6485c9287039ba877c68cd
Diffstat (limited to 'src/app/main.cpp')
-rw-r--r-- | src/app/main.cpp | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/src/app/main.cpp b/src/app/main.cpp index 741b85b714..b4ac0dfee9 100644 --- a/src/app/main.cpp +++ b/src/app/main.cpp @@ -280,26 +280,16 @@ static Utils::QtcSettings *createUserSettings() static void setHighDpiEnvironmentVariable() { - if (Utils::HostOsInfo::isMacHost()) + if (Utils::HostOsInfo::isMacHost() || qEnvironmentVariableIsSet("QT_SCALE_FACTOR_ROUNDING_POLICY")) return; std::unique_ptr<QSettings> settings(createUserSettings()); const bool defaultValue = Utils::HostOsInfo::isWindowsHost(); const bool enableHighDpiScaling = settings->value("Core/EnableHighDpiScaling", defaultValue).toBool(); - - static const char ENV_VAR_QT_DEVICE_PIXEL_RATIO[] = "QT_DEVICE_PIXEL_RATIO"; - if (enableHighDpiScaling - && !qEnvironmentVariableIsSet(ENV_VAR_QT_DEVICE_PIXEL_RATIO) // legacy in 5.6, but still functional - && !qEnvironmentVariableIsSet("QT_AUTO_SCREEN_SCALE_FACTOR") - && !qEnvironmentVariableIsSet("QT_SCALE_FACTOR") - && !qEnvironmentVariableIsSet("QT_SCREEN_SCALE_FACTORS")) { - return; - } - - if (!qEnvironmentVariableIsSet("QT_SCALE_FACTOR_ROUNDING_POLICY")) - QGuiApplication::setHighDpiScaleFactorRoundingPolicy( - Qt::HighDpiScaleFactorRoundingPolicy::Floor); + const auto policy = enableHighDpiScaling ? Qt::HighDpiScaleFactorRoundingPolicy::PassThrough + : Qt::HighDpiScaleFactorRoundingPolicy::Floor; + QGuiApplication::setHighDpiScaleFactorRoundingPolicy(policy); } void setPixmapCacheLimit() |