X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModuleBase%2FModuleBase_WidgetExprEditor.cpp;h=346b324c810e66a937512785773a0ca3b7d9f66f;hb=cdc2caa21375bc96aaad9bb7c3ee1140dac1d738;hp=64ca2e312ca86254fae29a9ef714f6902c1a50da;hpb=33b3a43ad2266cb044e4232c902344842adbba7c;p=modules%2Fshaper.git diff --git a/src/ModuleBase/ModuleBase_WidgetExprEditor.cpp b/src/ModuleBase/ModuleBase_WidgetExprEditor.cpp index 64ca2e312..346b324c8 100644 --- a/src/ModuleBase/ModuleBase_WidgetExprEditor.cpp +++ b/src/ModuleBase/ModuleBase_WidgetExprEditor.cpp @@ -10,10 +10,12 @@ #include #include -#include #include #include #include +#include +#include +#include #include @@ -27,6 +29,7 @@ #include #include #include +#include #include #include @@ -149,6 +152,12 @@ ModuleBase_WidgetExprEditor::ModuleBase_WidgetExprEditor(QWidget* theParent, QVBoxLayout* aMainLay = new QVBoxLayout(this); ModuleBase_Tools::adjustMargins(aMainLay); + myResultLabel = new QLabel(this); + myResultLabel->setWordWrap(true); + QFontMetrics fm(myResultLabel->font()); + myResultLabel->setMinimumHeight(fm.height() * 2); // set 2 line height as minimum + myResultLabel->setAlignment(Qt::AlignLeft|Qt::AlignBottom); + aMainLay->addWidget(myResultLabel); myEditor = new ExpressionEditor(this); myEditor->setMinimumHeight(20); aMainLay->addWidget(myEditor); @@ -171,6 +180,25 @@ bool ModuleBase_WidgetExprEditor::storeValueCustom() const QString aWidgetValue = myEditor->toPlainText(); aStringAttr->setValue(aWidgetValue.toStdString()); updateObject(myFeature); + + // Try to get the value + QString aStateMsg; + std::string anErrorMessage = myFeature->error(); + if (anErrorMessage.empty()) { + ResultParameterPtr aParam = + std::dynamic_pointer_cast(myFeature->firstResult()); + if(aParam.get()) { + AttributeDoublePtr aValueAttr = + aParam->data()->real(ModelAPI_ResultParameter::VALUE()); + if (aValueAttr.get()) { + double aValue = aValueAttr->value(); + aStateMsg = "Result: " + QString::number(aValue); + } + } + } else { + aStateMsg = QString::fromStdString(anErrorMessage); + } + myResultLabel->setText(aStateMsg); return true; }