Skip to content

Commit

Permalink
Restrict unit selector to displayUnit and internal unit, ticket:4031 (#…
Browse files Browse the repository at this point in the history
…33)

This avoids wrong options, like Bq for Hz or sr for rad and V/V.
  • Loading branch information
rfranke authored and adrpo committed Oct 8, 2016
1 parent f063a54 commit a03d35a
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions OMEdit/OMEditGUI/Component/ComponentProperties.cpp
Expand Up @@ -106,12 +106,9 @@ Parameter::Parameter(Component *pComponent, bool showStartAttribute, QString tab
mpUnitComboBox = new QComboBox;
if (!mUnit.isEmpty()) {
mpUnitComboBox->addItem(mUnit);
mpUnitComboBox->addItems(pOMCProxy->getDerivedUnits(mUnit));
}
if (mUnit.compare(mDisplayUnit) != 0) {
int index = mpUnitComboBox->findText(mDisplayUnit, Qt::MatchExactly);
if (index > -1) {
mpUnitComboBox->setCurrentIndex(index);
if (mDisplayUnit.compare(mUnit) != 0) {
mpUnitComboBox->addItem(mDisplayUnit);
mpUnitComboBox->setCurrentIndex(1);
}
}
connect(mpUnitComboBox, SIGNAL(currentIndexChanged(QString)), SLOT(unitComboBoxChanged(QString)));
Expand Down

0 comments on commit a03d35a

Please sign in to comment.