diff --git a/src/Gui/InputField.cpp b/src/Gui/InputField.cpp index f447b9011f..cadad6df68 100644 --- a/src/Gui/InputField.cpp +++ b/src/Gui/InputField.cpp @@ -164,7 +164,8 @@ void InputField::updateText(const Base::Quantity& quant) } double dFactor; - QString txt = quant.getUserString(dFactor,actUnitStr); + QString unitStr; + QString txt = quant.getUserString(dFactor, unitStr); actUnitValue = quant.getValue()/dFactor; setText(txt); } @@ -286,7 +287,8 @@ void InputField::newInput(const QString & text) } double dFactor; - res.getUserString(dFactor,actUnitStr); + QString unitStr; + res.getUserString(dFactor, unitStr); actUnitValue = res.getValue()/dFactor; // Preserve previous format res.setFormat(this->actQuantity.getFormat()); @@ -512,7 +514,10 @@ void InputField::setUnitText(const QString& str) QString InputField::getUnitText(void) { - return actUnitStr; + double dFactor; + QString unitStr; + actQuantity.getUserString(dFactor, unitStr); + return unitStr; } int InputField::getPrecision() const @@ -597,7 +602,7 @@ void InputField::showEvent(QShowEvent * event) selectNumber(); } -void InputField::focusInEvent(QFocusEvent * event) +void InputField::focusInEvent(QFocusEvent *event) { if (event->reason() == Qt::TabFocusReason || event->reason() == Qt::BacktabFocusReason || diff --git a/src/Gui/InputField.h b/src/Gui/InputField.h index 3cf9ea17f0..cef27c5aa2 100644 --- a/src/Gui/InputField.h +++ b/src/Gui/InputField.h @@ -95,7 +95,7 @@ public: /// gives the current state of the user input, gives true if it is a valid input with correct quantity /// (shown by the green pixmap), returns false if the input is a unparsable string or has a wrong unit /// (shown by the red pixmap in the gui) - bool hasValidInput() { return validInput;}; + bool hasValidInput() { return validInput;} /** sets the Unit this field is working with. * After setting the Unit the field will only accept @@ -210,7 +210,6 @@ private: Base::Quantity actQuantity; Base::Unit actUnit; double actUnitValue; - QString actUnitStr; double Maximum; double Minimum;