diff --git a/src/Gui/InputField.cpp b/src/Gui/InputField.cpp index 19c5e9eda..f83f97ba7 100644 --- a/src/Gui/InputField.cpp +++ b/src/Gui/InputField.cpp @@ -450,9 +450,7 @@ void InputField::setHistorySize(int i) void InputField::selectNumber(void) { - QString input = text(); - fixup(input); - QByteArray str = input.toLatin1(); + QByteArray str = text().toLatin1(); unsigned int i = 0; for (QByteArray::iterator it = str.begin(); it != str.end(); ++it) { @@ -460,7 +458,7 @@ void InputField::selectNumber(void) i++; else if (*it == ',' || *it == '.') i++; - else if (*it == '-' ) + else if (*it == '-') i++; else // any non-number character break; @@ -531,10 +529,10 @@ void InputField::wheelEvent (QWheelEvent * event) void InputField::fixup(QString& input) const { input.remove(locale().groupSeparator()); - if(locale().negativeSign() != QChar::fromAscii('-')) - input.replace(locale().negativeSign(), QChar::fromAscii('-')); - if(locale().positiveSign() != QChar::fromAscii('+')) - input.replace(locale().positiveSign(), QChar::fromAscii('+')); + if (locale().negativeSign() != QLatin1Char('-')) + input.replace(locale().negativeSign(), QLatin1Char('-')); + if (locale().positiveSign() != QLatin1Char('+')) + input.replace(locale().positiveSign(), QLatin1Char('+')); } QValidator::State InputField::validate(QString& input, int& pos) const diff --git a/src/Gui/QuantitySpinBox.cpp b/src/Gui/QuantitySpinBox.cpp index 47cf3b03e..8425e46a4 100644 --- a/src/Gui/QuantitySpinBox.cpp +++ b/src/Gui/QuantitySpinBox.cpp @@ -326,9 +326,7 @@ void QuantitySpinBox::clear() void QuantitySpinBox::selectNumber() { - QString input = lineEdit()->text(); - fixup(input); - QByteArray str = input.toLatin1(); + QByteArray str = lineEdit()->text().toLatin1(); unsigned int i = 0; for (QByteArray::iterator it = str.begin(); it != str.end(); ++it) { @@ -336,7 +334,7 @@ void QuantitySpinBox::selectNumber() i++; else if (*it == ',' || *it == '.') i++; - else if (*it == '-' ) + else if (*it == '-') i++; else // any non-number character break; @@ -381,10 +379,10 @@ QValidator::State QuantitySpinBox::validate(QString &text, int &pos) const void QuantitySpinBox::fixup(QString &input) const { input.remove(locale().groupSeparator()); - if(locale().negativeSign() != QChar::fromAscii('-')) - input.replace(locale().negativeSign(), QChar::fromAscii('-')); - if(locale().positiveSign() != QChar::fromAscii('+')) - input.replace(locale().positiveSign(), QChar::fromAscii('+')); + if (locale().negativeSign() != QLatin1Char('-')) + input.replace(locale().negativeSign(), QLatin1Char('-')); + if (locale().positiveSign() != QLatin1Char('+')) + input.replace(locale().positiveSign(), QLatin1Char('+')); }