fix numeric unit conversion in widget
This commit is contained in:
@@ -45,7 +45,7 @@ double parseWithUnits(const QString& text, double* factorOut, QString* suffixOut
|
||||
|
||||
double num = match.captured(1).toDouble();
|
||||
QString unit = match.captured(3);
|
||||
double factor = 1.0;
|
||||
double factor = factorOut ? *factorOut : 1.0;
|
||||
|
||||
if (!unit.isEmpty()) {
|
||||
QString u = unit.startsWith('_') ? unit.mid(1) : unit;
|
||||
@@ -101,10 +101,6 @@ void UnitLineEdit::onEditingFinished() {
|
||||
double factor = m_Factor;
|
||||
QString suffix = m_Suffix;
|
||||
double parsedVal = parseWithUnits(text(), &factor, &suffix);
|
||||
if (!suffix.isEmpty()) {
|
||||
m_Suffix = suffix;
|
||||
m_Factor = factor;
|
||||
}
|
||||
if (m_IsInteger) {
|
||||
parsedVal = std::round(parsedVal);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user