]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #2626: Do not use non-initialized attribute for default value definition
authorvsv <vsv@opencascade.com>
Thu, 6 Sep 2018 13:46:11 +0000 (16:46 +0300)
committervsv <vsv@opencascade.com>
Thu, 6 Sep 2018 13:46:11 +0000 (16:46 +0300)
src/ModuleBase/ModuleBase_WidgetChoice.cpp

index ea04160b52f36ff0e1af50ffa770e24f68448f57..c2d15b828e4bccf2b70aa19a3f9f4fe429f39321 100644 (file)
@@ -133,16 +133,23 @@ bool ModuleBase_WidgetChoice::restoreValueCustom()
         myChoiceCtrl->setChoiceList(aChoiceList);
       }
     }
-    if (aIntAttr->isInitialized())
+    if (aIntAttr->isInitialized()) {
       myChoiceCtrl->setValue(aIntAttr->value());
+
+      myChoiceCtrl->blockSignals(isBlocked);
+      emit itemSelected(this, aIntAttr->value());
+      myDefValue = aIntAttr->value();
+    }
     else {
       bool aHasDefaultValue;
       int aDefaultVal = QString::fromStdString(getDefaultValue()).toInt(&aHasDefaultValue);
-      myChoiceCtrl->setValue(aHasDefaultValue ? aDefaultVal : 0);
+      int aVal = aHasDefaultValue ? aDefaultVal : 0;
+      myChoiceCtrl->setValue(aVal);
+
+      myChoiceCtrl->blockSignals(isBlocked);
+      emit itemSelected(this, aVal);
+      myDefValue = aVal;
     }
-    myChoiceCtrl->blockSignals(isBlocked);
-    emit itemSelected(this, aIntAttr->value());
-    myDefValue = aIntAttr->value();
     myIsFirst = false;
   }
   return true;