example: Fix the RibbonSpinBox's 'Binding loop detected for property text' warning.

This commit is contained in:
Mentalflow 2024-05-01 22:39:27 +08:00
parent 8c10f7a463
commit f730eb0ee3
Signed by: Mentalflow
GPG Key ID: 5AE68D4401A2EE71
1 changed files with 3 additions and 1 deletions

View File

@ -407,12 +407,14 @@ RibbonWindow {
validator: DoubleValidator { validator: DoubleValidator {
bottom: Math.min(spinbox.from, spinbox.to) bottom: Math.min(spinbox.from, spinbox.to)
top: Math.max(spinbox.from, spinbox.to) top: Math.max(spinbox.from, spinbox.to)
decimals: 2
notation: DoubleValidator.StandardNotation
} }
textFromValue: function(value, locale) { textFromValue: function(value, locale) {
return Number(value / 100).toLocaleString(locale, 'f', 2) return Number(value / 100).toLocaleString(locale, 'f', 2)
} }
valueFromText: function(text, locale) { valueFromText: function(text, locale) {
return Number.fromLocaleString(locale, text) * 100 return Math.round(Number.fromLocaleString(locale, text) * 100)
} }
} }
} }