Sketcher: Handle additional characters for OVP in regexp

Co-authored-by: Benjamin Nauck <benjamin@nauck.se>
This commit is contained in:
tetektoza
2025-06-20 00:33:48 +02:00
committed by GitHub
parent 4b4475ea3f
commit deff562dee

View File

@@ -575,8 +575,9 @@ void QuantitySpinBox::userInput(const QString & text)
// only emit signal to reset EditableDatumLabel if the input is truly empty or has
// no meaningful number don't emit for partially typed numbers like "71." which are
// temporarily invalid
QString trimmedText = text.trimmed();
if (trimmedText.isEmpty() || !trimmedText.contains(QRegularExpression(QStringLiteral("[0-9]")))) {
const QString trimmedText = text.trimmed();
static const QRegularExpression partialNumberRegex(QStringLiteral(R"([+-]?(\d+)?(\.,\d*)?)"));
if (trimmedText.isEmpty() || !trimmedText.contains(partialNumberRegex)) {
// we have to emit here signal explicitly as validator will not pass
// this value further but we want to check it to disable isSet flag if
// it has been set previously