From 83abef8f64409c2e84520f41b8820d8ac6d6dc7d Mon Sep 17 00:00:00 2001 From: Igor Malinovskiy Date: Wed, 16 Oct 2019 12:52:52 +0300 Subject: [PATCH] Scaling fixes --- src/main.cpp | 23 +++++++++++++++++++---- src/qml/ConnectionSettignsDialog.qml | 4 +++- src/qml/GlobalSettings.qml | 3 ++- 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 7a06a0209..c8dba6504 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #ifdef CRASHPAD_INTEGRATION #include "crashpad/handler.h" @@ -15,10 +16,7 @@ #define RESTART_CODE 1000 int main(int argc, char *argv[]) -{ -#if defined(Q_OS_WIN) || defined(Q_OS_LINUX) - QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling); -#endif +{ int returnCode = 0; #ifdef CRASHPAD_INTEGRATION @@ -27,10 +25,27 @@ int main(int argc, char *argv[]) startCrashpad(appDir); #endif + bool scalingSetup = false; + do { Application a(argc, argv); +#if defined(Q_OS_WIN) || defined(Q_OS_LINUX) + if (!scalingSetup) { + if (QGuiApplication::primaryScreen() && QGuiApplication::primaryScreen()->availableSize().width() <= 1920 + && QGuiApplication::primaryScreen()->devicePixelRatio() > 1 + && !QGuiApplication::testAttribute(Qt::AA_DisableHighDpiScaling)) { + QGuiApplication::setAttribute(Qt::AA_DisableHighDpiScaling); + } else { + QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling); + } + returnCode = RESTART_CODE; + scalingSetup = true; + continue; + } +#endif + #ifdef LINUX_SIGNALS UnixSignalWatcher sigwatch; sigwatch.watchForSignal(SIGINT); diff --git a/src/qml/ConnectionSettignsDialog.qml b/src/qml/ConnectionSettignsDialog.qml index 28c106d53..3edabdbdb 100644 --- a/src/qml/ConnectionSettignsDialog.qml +++ b/src/qml/ConnectionSettignsDialog.qml @@ -142,8 +142,10 @@ Dialog { width: settingsTabs.width - 20 height: settingsTabs.height + horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff + ColumnLayout { - width: mainSettingsScrollView.width - 20 + width: mainSettingsScrollView.width - 25 height: children.height GridLayout { diff --git a/src/qml/GlobalSettings.qml b/src/qml/GlobalSettings.qml index ee5db9411..89d500fa2 100644 --- a/src/qml/GlobalSettings.qml +++ b/src/qml/GlobalSettings.qml @@ -30,10 +30,11 @@ Dialog { id: globalSettingsScrollView width: parent.width height: parent.height + horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff ColumnLayout { id: innerLayout - width: globalSettingsScrollView.width - 20 + width: globalSettingsScrollView.width - 25 height: (dialogRoot.height - 50 > implicitHeight) ? dialogRoot.height - 50 : implicitHeight SettingsGroupTitle {