summaryrefslogtreecommitdiff
blob: 84022d815b55ebaf3f403bb5c02f002fe489d802 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
From 26ae86dff198fbce05ba3824b89786224b3792a9 Mon Sep 17 00:00:00 2001
From: Nate Graham <nate@kde.org>
Date: Thu, 23 Jun 2022 12:47:32 -0600
Subject: [PATCH] Units: Fix sizeForLabels double-scaling icons with Plasma
 scaling

The sizeForLabels unit internally uses roundToIconSize(), giving it a
value and feeding that into devicePixelIconSize() to take into account
required icons size differences when using Plasma scaling. But
roundToIconSize() internally does that automatically! So as a result,
the size is double-scaled and looks too big. To fix this, we simply have
to stop using devicePixelIconSize() for this unit.

BUG: 454131
FIXED-IN: 5.96
---
 src/declarativeimports/core/units.cpp | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/declarativeimports/core/units.cpp b/src/declarativeimports/core/units.cpp
index 0cdffcbfd..8d655d11f 100644
--- a/src/declarativeimports/core/units.cpp
+++ b/src/declarativeimports/core/units.cpp
@@ -115,8 +115,9 @@ void Units::iconLoaderSettingsChanged()
     m_iconSizes->insert(QStringLiteral("large"), devicePixelIconSize(KIconLoader::SizeLarge));
     m_iconSizes->insert(QStringLiteral("huge"), devicePixelIconSize(KIconLoader::SizeHuge));
     m_iconSizes->insert(QStringLiteral("enormous"), devicePixelIconSize(KIconLoader::SizeEnormous));
-    // gridUnit is always the font height here
-    m_iconSizes->insert(QStringLiteral("sizeForLabels"), devicePixelIconSize(roundToIconSize(QFontMetrics(QGuiApplication::font()).height())));
+    // We deliberately don't feed the result into devicePixelIconSize() because
+    // roundToIconSize() already does that internally.
+    m_iconSizes->insert(QStringLiteral("sizeForLabels"), roundToIconSize(QFontMetrics(QGuiApplication::font()).height()));
 
     m_iconSizeHints->insert(QStringLiteral("panel"), devicePixelIconSize(KIconLoader::global()->currentSize(KIconLoader::Panel)));
     m_iconSizeHints->insert(QStringLiteral("desktop"), devicePixelIconSize(KIconLoader::global()->currentSize(KIconLoader::Desktop)));
-- 
GitLab