From 4b4475ea3f4833f231ced864ea78ce36f955c9ce Mon Sep 17 00:00:00 2001 From: tetektoza Date: Tue, 17 Jun 2025 00:25:16 +0200 Subject: [PATCH] Gui: Emit signal to EditableDatumLabel only if there's no digits Small regression of mine, basically this signal to remove set/locked state of EditableDatumLabel should be only sent out if current text in the label is empty or it doesn't contain digits. Previously it was emitted every intermediate wrong state, so stuff like "71." was also being matched, and it resulted in resetting the locked state of the label, which in turn resulted in keeping user from entering float values. --- src/Gui/QuantitySpinBox.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/Gui/QuantitySpinBox.cpp b/src/Gui/QuantitySpinBox.cpp index 333f89d9b8..8f4a1e49e3 100644 --- a/src/Gui/QuantitySpinBox.cpp +++ b/src/Gui/QuantitySpinBox.cpp @@ -572,10 +572,16 @@ void QuantitySpinBox::userInput(const QString & text) else { d->validInput = false; - // 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 - Q_EMIT valueChanged(d->quantity.getValue()); + // 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]")))) { + // 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 + Q_EMIT valueChanged(d->quantity.getValue()); + } return; }