File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3462,9 +3462,12 @@ Item {
34623462
34633463 property string label
34643464 property string valueUnit: ""
3465- property int value: Number(textField.text)
3465+ property int value
34663466 property int sourceValue
34673467
3468+ property int minValue: 0
3469+ property int maxValue: 100
3470+
34683471 LText {
34693472 Layout.fillWidth: true
34703473 text: parent.label
@@ -3474,11 +3477,30 @@ Item {
34743477 id: textField
34753478 implicitWidth: 50
34763479
3477- maximumLength: 2
3480+ maximumLength: 4
34783481 horizontalAlignment: TextInput.AlignRight
34793482 inputMethodHints: Qt.ImhDigitsOnly
34803483 text: parent.sourceValue
3481- validator: IntValidator {bottom: 0; top: 99;}
3484+
3485+ property string prevText
3486+
3487+ onTextChanged: {
3488+ var number = Number(text);
3489+ if (text !== "" && (number > maxValue || number < minValue)) {
3490+ text = prevText;
3491+ } else {
3492+ if (text !== "") {
3493+ parent.value = number;
3494+ prevText = text;
3495+ }
3496+ }
3497+ }
3498+
3499+ onActiveFocusChanged: {
3500+ if (!activeFocus) {
3501+ text = parent.value;
3502+ }
3503+ }
34823504 }
34833505
34843506 LText {
@@ -3562,6 +3584,8 @@ Item {
35623584 label: "Speed dial max"
35633585 valueUnit: vescConfig.speedUnit
35643586 sourceValue: preferences.speedDialMax
3587+ minValue: 10
3588+ maxValue: 200
35653589 onValueChanged: {
35663590 preferences.speedDialMax = value
35673591 }
@@ -3641,6 +3665,8 @@ Item {
36413665 label: "Realtime plot maximum window"
36423666 valueUnit: "minutes"
36433667 sourceValue: preferences.plotMaxWindowMinutes
3668+ minValue: 1
3669+ maxValue: 1000
36443670 onValueChanged: {
36453671 preferences.plotMaxWindowMinutes = value
36463672 }
You can’t perform that action at this time.
0 commit comments