QmlDesigner: Prevent rounding real numbers in Model Editor

Fixes: QDS-12021
Change-Id: I28215cc7a6ae9c388b3654799ef848a8002b0f13
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
Ali Kianian
2024-03-25 17:26:01 +02:00
parent 4e63bcb744
commit aa64a62e2f

View File

@@ -96,6 +96,16 @@ Item {
if (realField.activeFocus) if (realField.activeFocus)
realField.contentItem.focus = true realField.contentItem.focus = true
} }
textFromValue: function (value, locale) {
locale.numberOptions = Locale.OmitGroupSeparator
var decimals = realField.trailingZeroes ? realField.decimals : decimalCounter(realField.realValue)
if (decimals > 0) {
var text = Number(realField.realValue).toLocaleString(locale, 'f', decimals + 1)
return text.substring(0, text.length - 1)
}
return Number(realField.realValue).toLocaleString(locale, 'f', decimals)
}
} }
} }
} }