Salome HOME
Fix for the issue #2753 : error when dump/load script
[modules/shaper.git] / src / ModuleBase / ModuleBase_ChoiceCtrl.cpp
index 4d915b80194f8a74e6e423f5b7562437cbcc14d6..67b5b6f186eb55d9b6b085ba783c921a4b63a74e 100644 (file)
@@ -132,6 +132,21 @@ void ModuleBase_ChoiceCtrl::setValue(int theVal)
   }
 }
 
+void ModuleBase_ChoiceCtrl::setValue(const QString& theVal)
+{
+  switch (myType) {
+  case RadioButtons:
+    foreach (QAbstractButton* aBtn, myButtons->buttons()) {
+      aBtn->setChecked(aBtn->toolTip() == theVal);
+    }
+    break;
+  case ComboBox:
+    myCombo->setCurrentText(theVal);
+    break;
+  }
+}
+
+
 void ModuleBase_ChoiceCtrl::setTooltip(QString theTip)
 {
   if (myType == ComboBox)
@@ -173,3 +188,14 @@ void ModuleBase_ChoiceCtrl::setChoiceList(const QStringList& theChoiceList)
     myCombo->addItems(theChoiceList);
   }
 }
+
+QString ModuleBase_ChoiceCtrl::textValue() const
+{
+  switch (myType) {
+  case RadioButtons:
+    return myButtons->checkedButton()->toolTip();
+  case ComboBox:
+    return myCombo->currentText();
+  }
+  return "";
+}