Salome HOME
projects
/
modules
/
shaper.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
WidgetMultiSelector preparation to use ModelAPI_AttributeRefAttrList.
[modules/shaper.git]
/
src
/
ModuleBase
/
ModuleBase_WidgetBoolValue.cpp
diff --git
a/src/ModuleBase/ModuleBase_WidgetBoolValue.cpp
b/src/ModuleBase/ModuleBase_WidgetBoolValue.cpp
index e6bbdad250ee58087af360c81475676116dddd3f..f260939e540c9a26a2c522e1a48d85322eb5f9d7 100644
(file)
--- 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 <ModuleBase_WidgetBoolValue.h>
// Created: 04 June 2014
// Author: Vitaly Smetannikov
#include <ModuleBase_WidgetBoolValue.h>
+#include <ModuleBase_Tools.h>
#include <ModelAPI_AttributeBoolean.h>
#include <ModelAPI_Data.h>
#include <ModelAPI_AttributeBoolean.h>
#include <ModelAPI_Data.h>
@@
-24,11
+27,16
@@
ModuleBase_WidgetBoolValue::ModuleBase_WidgetBoolValue(QWidget* theParent,
{
QString aText = QString::fromStdString(theData->widgetLabel());
QString aToolTip = QString::fromStdString(theData->widgetTooltip());
{
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, th
eParent
);
+ myCheckBox = new QCheckBox(aText, th
is
);
myCheckBox->setToolTip(aToolTip);
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()));
}
connect(myCheckBox, SIGNAL(toggled(bool)), this, SIGNAL(valuesChanged()));
}
@@
-37,27
+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();
{
DataPtr aData = myFeature->data();
- boost::shared_ptr<ModelAPI_AttributeBoolean> aBool = aData->boolean(attributeID());
-
- if (aBool->value() != myCheckBox->isChecked()) {
- aBool->setValue(myCheckBox->isChecked());
- updateObject(myFeature);
- }
+ std::shared_ptr<ModelAPI_AttributeBoolean> aBool = aData->boolean(attributeID());
+ aBool->setValue(myCheckBox->isChecked());
+ updateObject(myFeature);
return true;
}
return true;
}
-bool ModuleBase_WidgetBoolValue::restoreValue()
+bool ModuleBase_WidgetBoolValue::restoreValue
Custom
()
{
DataPtr aData = myFeature->data();
{
DataPtr aData = myFeature->data();
-
boost
::shared_ptr<ModelAPI_AttributeBoolean> aRef = aData->boolean(attributeID());
+
std
::shared_ptr<ModelAPI_AttributeBoolean> aRef = aData->boolean(attributeID());
bool isBlocked = myCheckBox->blockSignals(true);
myCheckBox->setChecked(aRef->value());
bool isBlocked = myCheckBox->blockSignals(true);
myCheckBox->setChecked(aRef->value());
@@
-72,3
+72,8
@@
QList<QWidget*> ModuleBase_WidgetBoolValue::getControls() const
aList.append(myCheckBox);
return aList;
}
aList.append(myCheckBox);
return aList;
}
+
+void ModuleBase_WidgetBoolValue::setHighlighted(bool)
+{
+ return;
+}