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
This commit is contained in:
parent
dc73d622c0
commit
40d708f9c5
1 changed files with 12 additions and 1 deletions
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue