Skip to content

Commit

Permalink
Merge pull request #1178 from ra3xdh/fix_1145
Browse files Browse the repository at this point in the history
Fix M units processing with tuner
  • Loading branch information
ra3xdh authored Jan 3, 2025
2 parents 88a4b11 + 7e61aa1 commit c56bb4f
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions qucs/dialogs/tuner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ tunerElement::tunerElement(QWidget *parent, Component *component, Property *pp,
if (magnitudeIndex != 5) unit = unit.mid(1);
has_unit = true;
}

//Finally, add the unit to the QStringList for adding it to the scale comboboxes later
if (has_unit) for (int i = 0; i < ScaleFactorList.length(); i++) ScaleFactorList[i] += unit;
originalValue = QString::number(numValue)+ScaleFactorList[magnitudeIndex];
Expand Down Expand Up @@ -302,8 +301,17 @@ void tunerElement::resetValue()
*/
void tunerElement::updateProperty()
{
prop->Value = value->text().append(ValueUnitsCombobox->currentText());
qDebug() << "Updated property: " << prop->Value;
QString new_value = value->text();
QString suffix = ValueUnitsCombobox->currentText();
if (QucsSettings.DefaultSimulator != spicecompat::simQucsator &&
suffix == "M") { // Process Mega suffix
QString unit;
double num,fac;
misc::str2num(new_value + suffix, num, unit, fac);
prop->Value = QString::number(num*fac, 'g', 3);
} else {
prop->Value = new_value + suffix;
}
}


Expand Down

0 comments on commit c56bb4f

Please sign in to comment.