X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModuleBase%2FModuleBase_WidgetBoolValue.cpp;h=f260939e540c9a26a2c522e1a48d85322eb5f9d7;hb=5303dd1fa6ad4411e38f8d36103c72109957e05c;hp=6cd23ff9794843c679d57f36f9beda1196a8b134;hpb=2b0773dd16ddc859eb8d4cbb52afded33eb25c97;p=modules%2Fshaper.git diff --git a/src/ModuleBase/ModuleBase_WidgetBoolValue.cpp b/src/ModuleBase/ModuleBase_WidgetBoolValue.cpp index 6cd23ff97..f260939e5 100644 --- a/src/ModuleBase/ModuleBase_WidgetBoolValue.cpp +++ b/src/ModuleBase/ModuleBase_WidgetBoolValue.cpp @@ -1,8 +1,11 @@ -// File: ModuleBase_Widgets.h +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D + +// File: ModuleBase_WidgetBoolValue.cpp // Created: 04 June 2014 // Author: Vitaly Smetannikov #include +#include #include #include @@ -24,11 +27,16 @@ 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 = new QCheckBox(aText, this); myCheckBox->setToolTip(aToolTip); - myCheckBox->setChecked(aDefault == "true"); + myCheckBox->setChecked(isChecked); + + QVBoxLayout* aMainLayout = new QVBoxLayout(this); + ModuleBase_Tools::adjustMargins(aMainLayout); + aMainLayout->addWidget(myCheckBox); + setLayout(aMainLayout); connect(myCheckBox, SIGNAL(toggled(bool)), this, SIGNAL(valuesChanged())); } @@ -37,24 +45,19 @@ ModuleBase_WidgetBoolValue::~ModuleBase_WidgetBoolValue() { } -QWidget* ModuleBase_WidgetBoolValue::getControl() const -{ - return myCheckBox; -} - -bool ModuleBase_WidgetBoolValue::storeValue() const +bool ModuleBase_WidgetBoolValue::storeValueCustom() const { DataPtr aData = myFeature->data(); - boost::shared_ptr aBool = aData->boolean(attributeID()); + std::shared_ptr aBool = aData->boolean(attributeID()); aBool->setValue(myCheckBox->isChecked()); updateObject(myFeature); return true; } -bool ModuleBase_WidgetBoolValue::restoreValue() +bool ModuleBase_WidgetBoolValue::restoreValueCustom() { 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()); @@ -69,3 +72,8 @@ QList ModuleBase_WidgetBoolValue::getControls() const aList.append(myCheckBox); return aList; } + +void ModuleBase_WidgetBoolValue::setHighlighted(bool) +{ + return; +}