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
Show tool tip of shape multi selector. Remove an article.
[modules/shaper.git]
/
src
/
ModuleBase
/
ModuleBase_WidgetDoubleValue.cpp
diff --git
a/src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp
b/src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp
index 82a8800b3232b435e0ee7ca6928ffc0aa83a0b13..fbe80ec1897a1c38369dcd1da4b4595c6d209573 100644
(file)
--- a/
src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp
+++ b/
src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp
@@
-45,7
+45,10
@@
ModuleBase_WidgetDoubleValue::ModuleBase_WidgetDoubleValue(QWidget* theParent,
if (!aLabelIcon.isEmpty())
myLabel->setPixmap(QPixmap(aLabelIcon));
if (!aLabelIcon.isEmpty())
myLabel->setPixmap(QPixmap(aLabelIcon));
+ bool aAcceptVariables = theData->getBooleanAttribute(DOUBLE_WDG_ACCEPT_EXPRESSIONS, true);
+
mySpinBox = new ModuleBase_ParamSpinBox(this);
mySpinBox = new ModuleBase_ParamSpinBox(this);
+ mySpinBox->setAcceptVariables(aAcceptVariables);
QString anObjName = QString::fromStdString(attributeID());
mySpinBox->setObjectName(anObjName);
QString anObjName = QString::fromStdString(attributeID());
mySpinBox->setObjectName(anObjName);
@@
-83,16
+86,17
@@
ModuleBase_WidgetDoubleValue::ModuleBase_WidgetDoubleValue(QWidget* theParent,
QString aTTip = QString::fromStdString(theData->widgetTooltip());
mySpinBox->setToolTip(aTTip);
QString aTTip = QString::fromStdString(theData->widgetTooltip());
mySpinBox->setToolTip(aTTip);
+ myLabel->setToolTip(aTTip);
aControlLay->addRow(myLabel, mySpinBox);
aControlLay->addRow(myLabel, mySpinBox);
- connect(mySpinBox, SIGNAL(valueChanged(const QString&)), this, SIGNAL(values
Chang
ed()));
+ connect(mySpinBox, SIGNAL(valueChanged(const QString&)), this, SIGNAL(values
Modifi
ed()));
}
ModuleBase_WidgetDoubleValue::~ModuleBase_WidgetDoubleValue()
{
}
}
ModuleBase_WidgetDoubleValue::~ModuleBase_WidgetDoubleValue()
{
}
-bool ModuleBase_WidgetDoubleValue::reset()
+bool ModuleBase_WidgetDoubleValue::reset
Custom
()
{
bool aDone = false;
if (!isUseReset() || isComputedDefault() || mySpinBox->hasVariable()) {
{
bool aDone = false;
if (!isUseReset() || isComputedDefault() || mySpinBox->hasVariable()) {
@@
-101,10
+105,10
@@
bool ModuleBase_WidgetDoubleValue::reset()
bool isOk;
double aDefValue = QString::fromStdString(getDefaultValue()).toDouble(&isOk);
// reset the value just if there is a default value definition in the XML definition
bool isOk;
double aDefValue = QString::fromStdString(getDefaultValue()).toDouble(&isOk);
// reset the value just if there is a default value definition in the XML definition
- // if the
double
value can not be found by the default value, do nothing
+ // if the value can not be found by the default value, do nothing
if (isOk) {
ModuleBase_Tools::setSpinValue(mySpinBox, aDefValue);
if (isOk) {
ModuleBase_Tools::setSpinValue(mySpinBox, aDefValue);
- storeValue
Custom
();
+ storeValue();
aDone = true;
}
}
aDone = true;
}
}
@@
-115,22
+119,22
@@
bool ModuleBase_WidgetDoubleValue::storeValueCustom() const
{
DataPtr aData = myFeature->data();
AttributeDoublePtr aReal = aData->real(attributeID());
{
DataPtr aData = myFeature->data();
AttributeDoublePtr aReal = aData->real(attributeID());
- if (!mySpinBox->hasVariable()) {
+ if (mySpinBox->hasVariable()) {
+ // Here is a text of a real value or an expression.
+ std::string aText = mySpinBox->text().toStdString();
+ aReal->setText(aText);
+ } else {
// it is important to set the empty text value to the attribute before set the value
// it is important to set the empty text value to the attribute before set the value
- // because setValue tries to calculate the attr
ubyte baky
e according to the
+ // because setValue tries to calculate the attr
ibute valu
e according to the
// attribute current text
aReal->setText("");
aReal->setValue(mySpinBox->value());
// attribute current text
aReal->setText("");
aReal->setValue(mySpinBox->value());
- } else {
- // Here is a text of a real value or an expression.
- std::string aText = mySpinBox->text().toStdString();
- aReal->setText(aText);
}
updateObject(myFeature);
return true;
}
}
updateObject(myFeature);
return true;
}
-bool ModuleBase_WidgetDoubleValue::restoreValue()
+bool ModuleBase_WidgetDoubleValue::restoreValue
Custom
()
{
DataPtr aData = myFeature->data();
AttributeDoublePtr aRef = aData->real(attributeID());
{
DataPtr aData = myFeature->data();
AttributeDoublePtr aRef = aData->real(attributeID());
@@
-143,9
+147,24
@@
bool ModuleBase_WidgetDoubleValue::restoreValue()
return true;
}
return true;
}
+void ModuleBase_WidgetDoubleValue::selectContent()
+{
+ mySpinBox->selectAll();
+}
+
QList<QWidget*> ModuleBase_WidgetDoubleValue::getControls() const
{
QList<QWidget*> aList;
aList.append(mySpinBox);
return aList;
}
QList<QWidget*> ModuleBase_WidgetDoubleValue::getControls() const
{
QList<QWidget*> aList;
aList.append(mySpinBox);
return aList;
}
+
+bool ModuleBase_WidgetDoubleValue::processEnter()
+{
+ bool isModified = getValueState() == ModifiedInPP;
+ if (isModified) {
+ emit valuesChanged();
+ mySpinBox->selectAll();
+ }
+ return isModified;
+}