diff --git a/src/Gui/DlgUnitsCalculatorImp.cpp b/src/Gui/DlgUnitsCalculatorImp.cpp index 2a84ae88d0..c365fc321c 100644 --- a/src/Gui/DlgUnitsCalculatorImp.cpp +++ b/src/Gui/DlgUnitsCalculatorImp.cpp @@ -113,15 +113,14 @@ void DlgUnitsCalculator::valueChanged(const Base::Quantity& quant) ui->ValueOutput->setText(tr("unit mismatch")); ui->pushButton_Copy->setEnabled(false); } else { // the unit is valid and has the same type - Base::Quantity inputt = Base::Quantity(1.0, ui->UnitInput->text()); - // this gives us e.g. for "1 in" the value '25.4' because 1 in = 25.4 mm double convertValue = Base::Quantity::parse(QString::fromLatin1("1") + ui->UnitInput->text()).getValue(); - // the result is now just input / convertValue because the imput is always in a base unit - // (an input of "1 cm" will immediately be converted to "10 mm" by Gui::InputField from the dialog) + // we got now e.g. for "1 in" the value '25.4' because 1 in = 25.4 mm + // the result is now just quant / convertValue because the input is always in a base unit + // (an input of "1 cm" will immediately be converted to "10 mm" by Gui::InputField of the dialog) double value = quant.getValue() / convertValue; // determine how many decimals we will need to avoid an output like "0.00" - // at first use scientific notation, if there is no "e", we can round it to the user-defined decimals - // the user-defined decimals might be too low for cases like "10 um" in "in", + // at first use scientific notation, if there is no "e", we can round it to the user-defined decimals, + // but the user-defined decimals might be too low for cases like "10 um" in "in", // thus only if value > 0.005 because FC's default are 2 decimals QString val = QLocale::system().toString(value, 'g'); if (!val.contains(QChar::fromLatin1('e')) && (value > 0.005))