From 718de1bf787bf8047b8c012d238de2918316b038 Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Thu, 5 Oct 2023 10:05:37 +0200 Subject: [PATCH] App/Core: Only set DPI rounding options if default not "Unset" Instead of making the OS specific decision whether to set DPI rounding options or not in several places, leave the OS specific check to StyleHelper::defaultHighDpiScaleFactorRoundingPolicy() and test for "Unset". Change-Id: I37ab4a0c643d1b1597e5f45496510f2f36f1a386 Reviewed-by: Eike Ziller --- src/app/main.cpp | 4 +++- src/plugins/coreplugin/generalsettings.cpp | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/app/main.cpp b/src/app/main.cpp index 5acc468d9c5..036d169c063 100644 --- a/src/app/main.cpp +++ b/src/app/main.cpp @@ -281,7 +281,9 @@ static Utils::QtcSettings *createUserSettings() static void setHighDpiEnvironmentVariable() { - if (Utils::HostOsInfo::isMacHost() || qEnvironmentVariableIsSet("QT_SCALE_FACTOR_ROUNDING_POLICY")) + if (Utils::StyleHelper::defaultHighDpiScaleFactorRoundingPolicy() + == Qt::HighDpiScaleFactorRoundingPolicy::Unset + || qEnvironmentVariableIsSet("QT_SCALE_FACTOR_ROUNDING_POLICY")) return; std::unique_ptr settings(createUserSettings()); diff --git a/src/plugins/coreplugin/generalsettings.cpp b/src/plugins/coreplugin/generalsettings.cpp index e7da40832d7..3a8b90b57bd 100644 --- a/src/plugins/coreplugin/generalsettings.cpp +++ b/src/plugins/coreplugin/generalsettings.cpp @@ -135,7 +135,8 @@ GeneralSettingsWidget::GeneralSettingsWidget() form.addRow({Tr::tr("Toolbar style:"), m_toolbarStyleBox, st}); form.addRow({Tr::tr("Language:"), m_languageBox, st}); - if (!Utils::HostOsInfo::isMacHost()) { + if (StyleHelper::defaultHighDpiScaleFactorRoundingPolicy() + != Qt::HighDpiScaleFactorRoundingPolicy::Unset) { using Policy = Qt::HighDpiScaleFactorRoundingPolicy; m_policyComboBox = new QComboBox; m_policyComboBox->addItem(Tr::tr("Round up for .5 and above"), int(Policy::Round));