Changeset e5acdde in OpenModelica


Ignore:
Timestamp:
2020-10-21T15:05:59+02:00 (3 years ago)
Author:
Adrian Pop <adrian.pop@…>
Children:
2332b51
Parents:
dbd3f0e4
git-author:
Adrian Pop <adrian.pop@…> (10/18/20 23:26:07)
git-committer:
Adrian Pop <adrian.pop@…> (10/21/20 15:05:59)
Message:

Fixes for #6127

  • add a line to remove the modifier
  • do not disable any item as it doesn't work properly
  • remove class comment quotes
  • TODO! use of setPlaceholderText to grey out the default doesn't work yet
File:
1 edited

Legend:

Unmodified
Added
Removed
  • OMEdit/OMEditLIB/Element/ElementProperties.cpp

    rfeadc57b re5acdde  
    314314  QString replaceable = "", replaceableText = "";
    315315  QStringList enumerationLiterals, replaceableChoices;
     316
    316317  switch (mValueType) {
    317318    case Parameter::Boolean:
     
    348349      if (!mDefaultValue.isEmpty()) {
    349350        mpValueComboBox->addItem(mDefaultValue, mDefaultValue);
     351        mpValueComboBox->lineEdit()->setPlaceholderText(mDefaultValue);
    350352      }
    351353      else {
     
    353355          QString str = (pOMCProxy->getClassInformation(className)).comment;
    354356          if (!str.isEmpty()) {
    355             str = " \"" + str + "\"";
     357            str = " - " + str;
    356358          }
    357359          replaceableText =  className + str;
    358360          mpValueComboBox->addItem(replaceableText, replaceableText);
     361          mpValueComboBox->lineEdit()->setPlaceholderText(replaceableText);
    359362        }
    360363        else {
    361364          replaceable = "redeclare " + className + " " + mpComponent->getName();
    362365          mpValueComboBox->addItem(replaceable, replaceable);
     366          mpValueComboBox->lineEdit()->setPlaceholderText(replaceable);
    363367        }
    364368      }
     369
    365370      if (constrainedByClassName.contains("$Any")) {
    366371        constrainedByClassName = className;
    367372      }
     373
    368374      replaceableChoices = pOMCProxy->getAllSubtypeOf(constrainedByClassName, mpComponent->getComponentInfo()->getParentClassName());
    369375      for (i = 0 ; i < replaceableChoices.size(); i++) {
     
    376382              QString str = (pOMCProxy->getClassInformation(replaceableChoices[i])).comment;
    377383              if (!str.isEmpty()) {
    378                 str = " \"" + str + "\"";
     384                str = " - " + str;
    379385              }
    380386              replaceableText = replaceableChoices[i] + str;
     
    390396      }
    391397
    392       QStandardItemModel *model = qobject_cast<QStandardItemModel *>(mpValueComboBox->model());
    393       if (model != NULL)
    394       {
    395         QStandardItem *item = model->item(0);
    396         if (item != NULL)
    397           item->setFlags(item->flags() & ~Qt::ItemIsEnabled);
    398       }
     398      // add a way to remove the modifiers
     399      mpValueComboBox->addItem("[remove modifier]", "");
    399400
    400401      connect(mpValueComboBox, SIGNAL(currentIndexChanged(int)), SLOT(valueComboBoxChanged(int)));
Note: See TracChangeset for help on using the changeset viewer.