diff options
author | Määttä Antti <antti.maatta@qt.io> | 2017-11-21 14:15:30 +0200 |
---|---|---|
committer | Antti Määttä <antti.maatta@qt.io> | 2017-11-23 08:25:57 +0000 |
commit | 85b51f5a91d356a80f1ec942247e77f28566d0e9 (patch) | |
tree | f43bc55535bac644bcf72330fe252de99c6b9a85 | |
parent | 0571cb18a8adde98fb411cd13a69ed6f97dcd933 (diff) |
Fix keypad input of comma ',' in input boxes
Task-number: QT3DS-395
Change-Id: Ief92ea87a8f0ae575c98504f2bf2d9e9f98269c3
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
-rw-r--r-- | src/Authoring/Studio/Palettes/Action/HandlerPropertyBaseSlider.qml | 11 | ||||
-rw-r--r-- | src/Authoring/Studio/Palettes/controls/FloatTextField.qml | 5 |
2 files changed, 16 insertions, 0 deletions
diff --git a/src/Authoring/Studio/Palettes/Action/HandlerPropertyBaseSlider.qml b/src/Authoring/Studio/Palettes/Action/HandlerPropertyBaseSlider.qml index 2cbe19b8..544aa75f 100644 --- a/src/Authoring/Studio/Palettes/Action/HandlerPropertyBaseSlider.qml +++ b/src/Authoring/Studio/Palettes/Action/HandlerPropertyBaseSlider.qml @@ -108,6 +108,7 @@ Row { if (!rateLimiter.running) { rateLimiter.start(); } + textField.setTextFieldValue() } onPressedChanged: { @@ -168,6 +169,12 @@ Row { validator: intSlider ? intValidator : doubleValidator + onTextEdited: { + if (!intSlider && text.search(",")) { + text = text.replace(",",".") + } + } + onEditingFinished: { if (textField.text > sliderMax) textField.text = sliderMax @@ -176,5 +183,9 @@ Row { slider.value = textField.text root.editingFinished() } + + function setTextFieldValue() { + text = intSlider ? slider.value.toFixed(0) : slider.value.toFixed(decimalSlider) + } } } diff --git a/src/Authoring/Studio/Palettes/controls/FloatTextField.qml b/src/Authoring/Studio/Palettes/controls/FloatTextField.qml index d18cd1e1..b046e329 100644 --- a/src/Authoring/Studio/Palettes/controls/FloatTextField.qml +++ b/src/Authoring/Studio/Palettes/controls/FloatTextField.qml @@ -48,6 +48,11 @@ TextField { bottomPadding: 0 rightPadding: 6 + onTextEdited: { + if (text.search(",")) + text = text.replace(",",".") + } + activeFocusOnPress: false horizontalAlignment: TextInput.AlignRight |