From c8d2ae494b3eddfd0e15d9d75c8fa88ab311d065 Mon Sep 17 00:00:00 2001 From: tetektoza Date: Fri, 20 Jun 2025 00:33:48 +0200 Subject: [PATCH] Sketcher: Handle additional characters for OVP in regexp Co-authored-by: Benjamin Nauck --- src/Gui/QuantitySpinBox.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Gui/QuantitySpinBox.cpp b/src/Gui/QuantitySpinBox.cpp index 8f4a1e49e3..98749a06b0 100644 --- a/src/Gui/QuantitySpinBox.cpp +++ b/src/Gui/QuantitySpinBox.cpp @@ -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