Skip to content

Commit

Permalink
Gui: [skip ci] fixes #4422: PartDesign value input does not accept tr…
Browse files Browse the repository at this point in the history
…ailing slash
  • Loading branch information
wwmayer committed Sep 14, 2020
1 parent 2c74426 commit d205122
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/Gui/QuantitySpinBox.cpp
Expand Up @@ -227,7 +227,20 @@ class QuantitySpinBoxPrivate
state = QValidator::Intermediate;
}
else if (res.getUnit() != this->unit) {
state = QValidator::Invalid;
// If the user input is of the form "number * unit", "number + unit"
// or "number - unit" it's rejected by the quantity parser and it's
// assumed that the user input is not complete yet (Intermediate).
// However, if the user input is of the form "number / unit" it's accepted
// by the parser but because the units mismatch it's considered as invalid
// and the last valid input will be restored.
// See #0004422: PartDesign value input does not accept trailing slash
// To work around this issue of the quantity parser it's checked if the
// inversed unit matches and if yes the input is also considered as not
// complete.
if (res.getUnit().pow(-1) == this->unit)
state = QValidator::Intermediate;
else
state = QValidator::Invalid;
}
else {
state = QValidator::Acceptable;
Expand Down

0 comments on commit d205122

Please sign in to comment.