From 3441112487e477e146f1ffd532725edcd285eba6 Mon Sep 17 00:00:00 2001 From: Stany MARCEL <stanypub@gmail.com> Date: Thu, 15 Sep 2016 17:47:25 +0200 Subject: [PATCH 03/21] Add a config option to enable high-DPI scaling (#701) The new EnableHiDPI boolean option permits to enable or not the activation of Qt::AA_EnableHighDpiScaling attribute. The default is enabled. [ChangeLog][Greeter] Enable Qt's automatic high dpi scaling based on configuration Signed-off-by: Stany MARCEL <stanypub@gmail.com> --- src/common/Configuration.h | 1 + src/greeter/GreeterApp.cpp | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/common/Configuration.h b/src/common/Configuration.h index f790343..f2e7ae1 100644 --- a/src/common/Configuration.h +++ b/src/common/Configuration.h @@ -42,6 +42,7 @@ namespace SDDM { Entry(Numlock, NumState, NUM_NONE, _S("Initial NumLock state. Can be on, off or none.\n" "If property is set to none, numlock won't be changed\n" "NOTE: Currently ignored if autologin is enabled.")); + Entry(EnableHiDPI, bool, true, _S("Enable Qt's automatic high-DPI scaling")); Entry(InputMethod, QString, QString(), _S("Input method module")); // Name Entries (but it's a regular class again) Section(Theme, diff --git a/src/greeter/GreeterApp.cpp b/src/greeter/GreeterApp.cpp index 9ec66e1..1926b30 100644 --- a/src/greeter/GreeterApp.cpp +++ b/src/greeter/GreeterApp.cpp @@ -242,7 +242,12 @@ int main(int argc, char **argv) { qInstallMessageHandler(SDDM::GreeterMessageHandler); // HiDPI - QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling); + if (SDDM::mainConfig.EnableHiDPI.get()) { + qDebug() << "High-DPI autoscaling Enabled"; + QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling); + } else { + qDebug() << "High-DPI autoscaling Not Enabled"; + } QStringList arguments; -- 2.10.2