Skip to content

armgit / krita

Public Imported from GitHub
0

Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.

C++

Explicit Windows in fractional scaling conditions

Carsten Hartenfels7c47712cb9bd
diff --git a/krita/main.cc b/krita/main.cc
index 02a45ace99..7bf3c79958 100644
--- a/krita/main.cc
+++ b/krita/main.cc
@@ -259,7 +259,7 @@ extern "C" MAIN_EXPORT int MAIN_FN(int argc, char **argv)
QImageReader::setAllocationLimit(0);
#endif
-#ifdef HAVE_HIGH_DPI_SCALE_FACTOR_ROUNDING_POLICY
+#if defined(Q_OS_WIN) && defined(HAVE_HIGH_DPI_SCALE_FACTOR_ROUNDING_POLICY)
// This rounding policy depends on a series of patches to Qt related to
// https://bugreports.qt.io/browse/QTBUG-53022. These patches are applied
// in ext_qt for WIndows (patches 0031-0036).
@@ -390,7 +390,7 @@ extern "C" MAIN_EXPORT int MAIN_FN(int argc, char **argv)
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
}
#endif
-#ifdef HAVE_HIGH_DPI_SCALE_FACTOR_ROUNDING_POLICY
+#if defined(Q_OS_WIN) && defined(HAVE_HIGH_DPI_SCALE_FACTOR_ROUNDING_POLICY)
if (kritarc.value("EnableHiDPIFractionalScaling", false).toBool()) {
QGuiApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough);
}
diff --git a/libs/ui/dialogs/kis_dlg_preferences.cc b/libs/ui/dialogs/kis_dlg_preferences.cc
index ff6291e109..58ff4dfc31 100644
--- a/libs/ui/dialogs/kis_dlg_preferences.cc
+++ b/libs/ui/dialogs/kis_dlg_preferences.cc
@@ -346,7 +346,7 @@ GeneralTab::GeneralTab(QWidget *_parent, const char *_name)
const QString configPath = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation);
QSettings kritarc(configPath + QStringLiteral("/kritadisplayrc"), QSettings::IniFormat);
m_chkHiDPI->setChecked(kritarc.value("EnableHiDPI", true).toBool());
-#ifdef HAVE_HIGH_DPI_SCALE_FACTOR_ROUNDING_POLICY
+#if defined(Q_OS_WIN) && defined(HAVE_HIGH_DPI_SCALE_FACTOR_ROUNDING_POLICY)
m_chkHiDPIFractionalScaling->setChecked(kritarc.value("EnableHiDPIFractionalScaling", false).toBool());
#else
m_wdgHiDPIFractionalScaling->setEnabled(false);
@@ -796,7 +796,7 @@ void GeneralTab::setDefault()
m_chkTrimFramesImport->setChecked(cfg.trimFramesImport(true));
chkZip64->setChecked(cfg.useZip64(true));
m_chkHiDPI->setChecked(true);
-#ifdef HAVE_HIGH_DPI_SCALE_FACTOR_ROUNDING_POLICY
+#if defined(Q_OS_WIN) && defined(HAVE_HIGH_DPI_SCALE_FACTOR_ROUNDING_POLICY)
m_chkHiDPIFractionalScaling->setChecked(true);
#endif
chkUsageLogging->setChecked(true);
@@ -2820,7 +2820,7 @@ bool KisDlgPreferences::editPreferences()
const QString configPath = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation);
QSettings kritarc(configPath + QStringLiteral("/kritadisplayrc"), QSettings::IniFormat);
kritarc.setValue("EnableHiDPI", m_general->m_chkHiDPI->isChecked());
-#ifdef HAVE_HIGH_DPI_SCALE_FACTOR_ROUNDING_POLICY
+#if defined(Q_OS_WIN) && defined(HAVE_HIGH_DPI_SCALE_FACTOR_ROUNDING_POLICY)
kritarc.setValue("EnableHiDPIFractionalScaling", m_general->m_chkHiDPIFractionalScaling->isChecked());
#endif
kritarc.setValue("LogUsage", m_general->chkUsageLogging->isChecked());