Skip to content

Commit

Permalink
Automatically add each prefix to displayUnit of arrays (#11999)
Browse files Browse the repository at this point in the history
#11715
Do not show `each` in the displayUnit drop down for arrays.
  • Loading branch information
adeas31 committed Feb 23, 2024
1 parent 9f40725 commit df73b10
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions OMEdit/OMEditLIB/Element/ElementProperties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,11 @@ Parameter::Parameter(ModelInstance::Element *pElement, ElementParameters *pEleme
mpUnitComboBox->setCurrentIndex(1);
}
connect(mpUnitComboBox, SIGNAL(currentIndexChanged(int)), SLOT(unitComboBoxChanged(int)));
mpDisplayUnitFinalEachMenuButton = new FinalEachToolButton(mpModelInstanceElement->getDimensions().isArray());
/* Issue #11715.
* Do not add each menu item to displayUnit modifiers.
* We will automatically add the each prefix for arrays.
*/
mpDisplayUnitFinalEachMenuButton = new FinalEachToolButton(false);
// comment
const QString comment = mpModelInstanceElement->getComment();
mpCommentLabel = new Label(comment);
Expand Down Expand Up @@ -1844,7 +1848,10 @@ void ElementParameters::updateElementParameters()
// if displayUnit is changed OR if we already have the displayUnit modifier then set it
if (pParameter->getUnitComboBox()->isEnabled() && !unit.isEmpty() && (pParameter->hasDisplayUnit() || pParameter->getDisplayUnit().compare(unit) != 0)) {
QString displayUnitModifier;
if (pParameter->getDisplayUnitFinalEachMenu()->isEach()) {
/* Issue #11715.
* Add each prefix if parameter is an array.
*/
if (pParameter->getModelInstanceElement()->getDimensions().isArray()) {
displayUnitModifier.append("each ");
}
if (pParameter->getDisplayUnitFinalEachMenu()->isFinal()) {
Expand Down

0 comments on commit df73b10

Please sign in to comment.