From: vsv Date: Thu, 6 Sep 2018 13:46:11 +0000 (+0300) Subject: Issue #2626: Do not use non-initialized attribute for default value definition X-Git-Tag: V9_2_0a1~52 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=4830a0f80bd3b0ec58bc43cdbba0418f169952a9;p=modules%2Fshaper.git Issue #2626: Do not use non-initialized attribute for default value definition --- diff --git a/src/ModuleBase/ModuleBase_WidgetChoice.cpp b/src/ModuleBase/ModuleBase_WidgetChoice.cpp index ea04160b5..c2d15b828 100644 --- a/src/ModuleBase/ModuleBase_WidgetChoice.cpp +++ b/src/ModuleBase/ModuleBase_WidgetChoice.cpp @@ -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;