X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModuleBase%2FModuleBase_WidgetBoolValue.cpp;h=cc0197d577d18d90a5876633cfdf4ce348c92262;hb=9585dccdd4d56657ced8ef9b25797979ea237f76;hp=1c3b68d1d9bcbb87029802de5b55f24aefb53eba;hpb=c57e24940c832457343b4fa2b36e0aee85e2238b;p=modules%2Fshaper.git diff --git a/src/ModuleBase/ModuleBase_WidgetBoolValue.cpp b/src/ModuleBase/ModuleBase_WidgetBoolValue.cpp index 1c3b68d1d..cc0197d57 100644 --- a/src/ModuleBase/ModuleBase_WidgetBoolValue.cpp +++ b/src/ModuleBase/ModuleBase_WidgetBoolValue.cpp @@ -17,18 +17,18 @@ #include #include -ModuleBase_WidgetBoolValue::ModuleBase_WidgetBoolValue(QWidget* theParent, - const Config_WidgetAPI* theData, - const std::string& theParentId) - : ModuleBase_ModelWidget(theParent, theData, theParentId) +ModuleBase_WidgetBoolValue::ModuleBase_WidgetBoolValue(QWidget* theParent, + const Config_WidgetAPI* theData, + const std::string& theParentId) + : ModuleBase_ModelWidget(theParent, theData, theParentId) { QString aText = QString::fromStdString(theData->widgetLabel()); QString aToolTip = QString::fromStdString(theData->widgetTooltip()); - QString aDefault = QString::fromStdString(theData->getProperty("default")); + bool isChecked = theData->getBooleanAttribute(ANY_WDG_DEFAULT, false); myCheckBox = new QCheckBox(aText, theParent); myCheckBox->setToolTip(aToolTip); - myCheckBox->setChecked(aDefault == "true"); + myCheckBox->setChecked(isChecked); connect(myCheckBox, SIGNAL(toggled(bool)), this, SIGNAL(valuesChanged())); } @@ -37,26 +37,23 @@ ModuleBase_WidgetBoolValue::~ModuleBase_WidgetBoolValue() { } -QWidget* ModuleBase_WidgetBoolValue::getControl() const -{ - return myCheckBox; +QWidget* ModuleBase_WidgetBoolValue::getControl() const +{ + return myCheckBox; } -bool ModuleBase_WidgetBoolValue::storeValue(ObjectPtr theObject) const +bool ModuleBase_WidgetBoolValue::storeValue() const { - DataPtr aData = theObject->data(); + DataPtr aData = myFeature->data(); boost::shared_ptr aBool = aData->boolean(attributeID()); - - if (aBool->value() != myCheckBox->isChecked()) { - aBool->setValue(myCheckBox->isChecked()); - Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_UPDATED)); - } + aBool->setValue(myCheckBox->isChecked()); + updateObject(myFeature); return true; } -bool ModuleBase_WidgetBoolValue::restoreValue(ObjectPtr theObject) +bool ModuleBase_WidgetBoolValue::restoreValue() { - DataPtr aData = theObject->data(); + DataPtr aData = myFeature->data(); boost::shared_ptr aRef = aData->boolean(attributeID()); bool isBlocked = myCheckBox->blockSignals(true);