Kde: add kinfocenter patches

This commit is contained in:
Toast 2025-03-04 14:31:15 +01:00
parent f3ee33177f
commit 92a6c20c18
2 changed files with 498 additions and 0 deletions

View file

@ -0,0 +1,72 @@
From 7cc7fe9783a68e086369bd0b96b280082097d60a Mon Sep 17 00:00:00 2001
From: Oliver Beard <olib141@outlook.com>
Date: Thu, 20 Feb 2025 22:49:25 +0000
Subject: [PATCH] kcms/about-distro: Fix hint expanding height of parent layout
Instead, use an label with padding to match the height of normal text. A
background is used to fill this padded area.
If smallFont is larger than normal text, the text will draw outside the label which would be restricted to the same height as normal text by negative padding. I don't see this as worth fixing - if the small font is larger than normal text, that would be the problem, not this...
When valueLabel spans multiple lines, it will be vertically centered.
CCBUG: 500355
---
kcms/about-distro/src/ui/main.qml | 35 +++++++++++++++++++------------
1 file changed, 22 insertions(+), 13 deletions(-)
diff --git a/kcms/about-distro/src/ui/main.qml b/kcms/about-distro/src/ui/main.qml
index 7a3f72bfb..80fbc2c13 100644
--- a/kcms/about-distro/src/ui/main.qml
+++ b/kcms/about-distro/src/ui/main.qml
@@ -136,26 +136,35 @@ KCMUtils.SimpleKCM {
}
}
- QQC2.Control {
+ QQC2.Label {
+ Kirigami.Theme.colorSet: Kirigami.Theme.Window
visible: hint !== ""
- topPadding: Kirigami.Units.smallSpacing
- rightPadding: Kirigami.Units.smallSpacing
- bottomPadding: Kirigami.Units.smallSpacing
- leftPadding: Kirigami.Units.smallSpacing
- Kirigami.Theme.colorSet: Kirigami.Theme.Window
+ // Vertical padding accounts for the difference in normal label height and the content height of this small label
+ readonly property real verticalPadding: (hintMetrics.height - contentHeight) / 2
+ // Horizontal padding also accounts for the difference in content height and the font's pixelSize to better balance the text
+ readonly property real horizontalPadding: ((hintMetrics.height - contentHeight) + (contentHeight - font.pixelSize)) / 2
+
+ TextMetrics {
+ // Necessary as valueLabel could be multiple lines
+ id: hintMetrics
+ text: " "
+ }
+
+ topPadding: verticalPadding
+ bottomPadding: verticalPadding
+ leftPadding: horizontalPadding
+ rightPadding: horizontalPadding
+
+ text: hint
+ color: hintColorForeground
+ font.bold: true
+ font.pixelSize: Kirigami.Theme.smallFont.pixelSize
background: Rectangle {
color: hintColorBackground
radius: Kirigami.Units.cornerRadius
}
-
- contentItem: QQC2.Label {
- text: hint
- color: hintColorForeground
- font.bold: true
- font.pixelSize: Kirigami.Theme.smallFont.pixelSize
- }
}
QQC2.Button {
--
GitLab