X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModuleBase%2FModuleBase_WidgetBoolValue.cpp;h=87e26a78f5c4b03a9a61ad35adc3e99e95929f08;hb=031fb5e7c551e695afa72a9de299f118a40d8d88;hp=e6bbdad250ee58087af360c81475676116dddd3f;hpb=8dc74f82810d5f597b78633b457efb0ef4f89f9f;p=modules%2Fshaper.git diff --git a/src/ModuleBase/ModuleBase_WidgetBoolValue.cpp b/src/ModuleBase/ModuleBase_WidgetBoolValue.cpp index e6bbdad25..87e26a78f 100644 --- a/src/ModuleBase/ModuleBase_WidgetBoolValue.cpp +++ b/src/ModuleBase/ModuleBase_WidgetBoolValue.cpp @@ -1,3 +1,5 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D + // File: ModuleBase_Widgets.h // Created: 04 June 2014 // Author: Vitaly Smetannikov @@ -24,11 +26,11 @@ ModuleBase_WidgetBoolValue::ModuleBase_WidgetBoolValue(QWidget* theParent, { QString aText = QString::fromStdString(theData->widgetLabel()); QString aToolTip = QString::fromStdString(theData->widgetTooltip()); - QString aDefault = QString::fromStdString(theData->getProperty("default")); + bool isChecked = theData->getBooleanAttribute(ATTR_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())); } @@ -45,19 +47,16 @@ QWidget* ModuleBase_WidgetBoolValue::getControl() const bool ModuleBase_WidgetBoolValue::storeValue() const { DataPtr aData = myFeature->data(); - boost::shared_ptr aBool = aData->boolean(attributeID()); - - if (aBool->value() != myCheckBox->isChecked()) { - aBool->setValue(myCheckBox->isChecked()); - updateObject(myFeature); - } + std::shared_ptr aBool = aData->boolean(attributeID()); + aBool->setValue(myCheckBox->isChecked()); + updateObject(myFeature); return true; } bool ModuleBase_WidgetBoolValue::restoreValue() { DataPtr aData = myFeature->data(); - boost::shared_ptr aRef = aData->boolean(attributeID()); + std::shared_ptr aRef = aData->boolean(attributeID()); bool isBlocked = myCheckBox->blockSignals(true); myCheckBox->setChecked(aRef->value());