Commit 79ff49f4 authored by Ismael Asensio's avatar Ismael Asensio
Browse files

kcm/kwinrules: Adapt spinbox width to actual text

Use FontMetrics to calculate the expected max text width so it
doesn't overflow with wider fonts, specially in some languages
like pt_BR

BUG: 438193
FIXED-IN: 5.22.1
(cherry picked from commit 40d708f9)
parent d0a5fb07
......@@ -107,13 +107,24 @@ ScrollViewKCM {
QQC2.SpinBox {
id: delaySpin
enabled: detectButton.enabled
Layout.preferredWidth: Kirigami.Units.gridUnit * 8
Layout.preferredWidth: Math.max(metricsInstant.advanceWidth, metricsAfter.advanceWidth) + Kirigami.Units.gridUnit * 2
from: 0
to: 30
textFromValue: (value, locale) => {
return (value == 0) ? i18n("Instantly")
: i18np("After %1 second", "After %1 seconds", value)
}
TextMetrics {
id: metricsInstant
font: delaySpin.font
text: i18n("Instantly")
}
TextMetrics {
id: metricsAfter
font: delaySpin.font
text: i18np("After %1 second", "After %1 seconds", 99)
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment