Skip to content

Commit

Permalink
Insure that autogenerated numerical fields are respected by the text …
Browse files Browse the repository at this point in the history
…edit widget
  • Loading branch information
nirvn committed Aug 2, 2024
1 parent 1eed24f commit d0efc43
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/qml/editorwidgets/TextEdit.qml
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,19 @@ EditorWidgetBase {
}

onTextChanged: {
if (field.isNumeric) {
let value = parseFloat(text);
valueChangeRequested(value, isNaN(value));
if (text !== '') {
if (field.isNumeric) {
let value = parseFloat(text);
// Only trigger value change for valid numerical values to insure we do not
// interfere with 'Autogenerate' value
if (!isNaN(value)) {
valueChangeRequested(value, false);
}
} else {
valueChangeRequested(text, false);
}
} else {
valueChangeRequested(text, text === '');
valueChangeRequested(text, true);
}
}
}
Expand Down

0 comments on commit d0efc43

Please sign in to comment.