Skip to content

Commit 83abef8

Browse files
committed
Scaling fixes
1 parent 9aee4b2 commit 83abef8

File tree

3 files changed

+24
-6
lines changed

3 files changed

+24
-6
lines changed

src/main.cpp

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include <QDir>
22
#include <QFileInfo>
33
#include <QGuiApplication>
4+
#include <QScreen>
45

56
#ifdef CRASHPAD_INTEGRATION
67
#include "crashpad/handler.h"
@@ -15,10 +16,7 @@
1516
#define RESTART_CODE 1000
1617

1718
int main(int argc, char *argv[])
18-
{
19-
#if defined(Q_OS_WIN) || defined(Q_OS_LINUX)
20-
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
21-
#endif
19+
{
2220
int returnCode = 0;
2321

2422
#ifdef CRASHPAD_INTEGRATION
@@ -27,10 +25,27 @@ int main(int argc, char *argv[])
2725
startCrashpad(appDir);
2826
#endif
2927

28+
bool scalingSetup = false;
29+
3030
do
3131
{
3232
Application a(argc, argv);
3333

34+
#if defined(Q_OS_WIN) || defined(Q_OS_LINUX)
35+
if (!scalingSetup) {
36+
if (QGuiApplication::primaryScreen() && QGuiApplication::primaryScreen()->availableSize().width() <= 1920
37+
&& QGuiApplication::primaryScreen()->devicePixelRatio() > 1
38+
&& !QGuiApplication::testAttribute(Qt::AA_DisableHighDpiScaling)) {
39+
QGuiApplication::setAttribute(Qt::AA_DisableHighDpiScaling);
40+
} else {
41+
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
42+
}
43+
returnCode = RESTART_CODE;
44+
scalingSetup = true;
45+
continue;
46+
}
47+
#endif
48+
3449
#ifdef LINUX_SIGNALS
3550
UnixSignalWatcher sigwatch;
3651
sigwatch.watchForSignal(SIGINT);

src/qml/ConnectionSettignsDialog.qml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,10 @@ Dialog {
142142
width: settingsTabs.width - 20
143143
height: settingsTabs.height
144144

145+
horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff
146+
145147
ColumnLayout {
146-
width: mainSettingsScrollView.width - 20
148+
width: mainSettingsScrollView.width - 25
147149
height: children.height
148150

149151
GridLayout {

src/qml/GlobalSettings.qml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,11 @@ Dialog {
3030
id: globalSettingsScrollView
3131
width: parent.width
3232
height: parent.height
33+
horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff
3334

3435
ColumnLayout {
3536
id: innerLayout
36-
width: globalSettingsScrollView.width - 20
37+
width: globalSettingsScrollView.width - 25
3738
height: (dialogRoot.height - 50 > implicitHeight) ? dialogRoot.height - 50 : implicitHeight
3839

3940
SettingsGroupTitle {

0 commit comments

Comments
 (0)