X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModuleBase%2FModuleBase_WidgetDoubleValue.cpp;h=fbe80ec1897a1c38369dcd1da4b4595c6d209573;hb=e48efe1ec56a7d7e0d8a57fc05f8220b846ea995;hp=5f9dc8a5b6d3cbf350ede6b4e0e9bfe43b027e87;hpb=bddbc598492a5dfa976d115200097724d7c6505e;p=modules%2Fshaper.git diff --git a/src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp b/src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp index 5f9dc8a5b..fbe80ec18 100644 --- a/src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp +++ b/src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp @@ -31,8 +31,6 @@ #include #endif -#define APPLY_BY_ENTER_OR_TAB - ModuleBase_WidgetDoubleValue::ModuleBase_WidgetDoubleValue(QWidget* theParent, const Config_WidgetAPI* theData, const std::string& theParentId) @@ -47,7 +45,10 @@ ModuleBase_WidgetDoubleValue::ModuleBase_WidgetDoubleValue(QWidget* theParent, if (!aLabelIcon.isEmpty()) myLabel->setPixmap(QPixmap(aLabelIcon)); + bool aAcceptVariables = theData->getBooleanAttribute(DOUBLE_WDG_ACCEPT_EXPRESSIONS, true); + mySpinBox = new ModuleBase_ParamSpinBox(this); + mySpinBox->setAcceptVariables(aAcceptVariables); QString anObjName = QString::fromStdString(attributeID()); mySpinBox->setObjectName(anObjName); @@ -88,21 +89,14 @@ ModuleBase_WidgetDoubleValue::ModuleBase_WidgetDoubleValue(QWidget* theParent, myLabel->setToolTip(aTTip); aControlLay->addRow(myLabel, mySpinBox); -#ifdef APPLY_BY_ENTER_OR_TAB - // Apply widget value change by enter/tab event. - connect(mySpinBox, SIGNAL(editingFinished()), this, SIGNAL(valuesChanged())); connect(mySpinBox, SIGNAL(valueChanged(const QString&)), this, SIGNAL(valuesModified())); - -#else - connect(mySpinBox, SIGNAL(valueChanged(const QString&)), this, SIGNAL(valuesChanged())); -#endif } ModuleBase_WidgetDoubleValue::~ModuleBase_WidgetDoubleValue() { } -bool ModuleBase_WidgetDoubleValue::reset() +bool ModuleBase_WidgetDoubleValue::resetCustom() { bool aDone = false; if (!isUseReset() || isComputedDefault() || mySpinBox->hasVariable()) { @@ -111,7 +105,7 @@ 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 - // 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); storeValue(); @@ -153,6 +147,11 @@ bool ModuleBase_WidgetDoubleValue::restoreValueCustom() return true; } +void ModuleBase_WidgetDoubleValue::selectContent() +{ + mySpinBox->selectAll(); +} + QList ModuleBase_WidgetDoubleValue::getControls() const { QList aList; @@ -160,7 +159,12 @@ QList ModuleBase_WidgetDoubleValue::getControls() const return aList; } -bool ModuleBase_WidgetDoubleValue::isEventProcessed(QKeyEvent* theEvent) +bool ModuleBase_WidgetDoubleValue::processEnter() { - return mySpinBox->isEventProcessed(theEvent); + bool isModified = getValueState() == ModifiedInPP; + if (isModified) { + emit valuesChanged(); + mySpinBox->selectAll(); + } + return isModified; }