Allow mouse selection in SpinBox

CURA-8684
This commit is contained in:
casper 2022-01-31 14:35:21 +01:00
parent 1ecc1ad753
commit 14767a92c6

View file

@ -266,6 +266,13 @@ OldControls.TabView
to: 100000000
editable: true
contentItem: TextField
{
text: spoolCostSpinBox.textFromValue(spoolCostSpinBox.value, spoolCostSpinBox.locale)
selectByMouse: true
background: Item {}
}
property int decimals: 2
valueFromText: function(text) {
@ -296,6 +303,13 @@ OldControls.TabView
to: 10000
editable: true
contentItem: TextField
{
text: spoolWeightSpinBox.textFromValue(spoolWeightSpinBox.value, spoolWeightSpinBox.locale)
selectByMouse: true
background: Item {}
}
valueFromText: function(text, locale) {
// remove all non-number tokens from input string so value can be parsed correctly
var value = Number(text.replace(",", ".").replace(/[^0-9.-]+/g, ""));