From: vsv Date: Wed, 1 Jul 2015 13:59:54 +0000 (+0300) Subject: Issue #694: Consider that only one of coordinates can contain a formula (not both... X-Git-Tag: V_1.3.0~131 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=fe94c2dd91946f3ad6d09b952a039395c4a31bb6;p=modules%2Fshaper.git Issue #694: Consider that only one of coordinates can contain a formula (not both as it is considered before) --- diff --git a/src/PartSet/PartSet_WidgetPoint2d.cpp b/src/PartSet/PartSet_WidgetPoint2d.cpp index 62709442b..ab596837d 100644 --- a/src/PartSet/PartSet_WidgetPoint2d.cpp +++ b/src/PartSet/PartSet_WidgetPoint2d.cpp @@ -184,16 +184,36 @@ bool PartSet_WidgetPoint2D::restoreValue() std::shared_ptr aData = myFeature->data(); std::shared_ptr aPoint = std::dynamic_pointer_cast( aData->attribute(attributeID())); - std::string aTextX = aPoint->textX(); - std::string aTextY = aPoint->textY(); - if (aTextX.empty() || aTextY.empty()) { - double aX = aPoint->x(); + QString aTextX = QString::fromStdString(aPoint->textX()); + QString aTextY = QString::fromStdString(aPoint->textY()); + + bool isDouble = false; + double aVal = 0; + if (aTextX.isEmpty()) { ModuleBase_Tools::setSpinValue(myXSpin, aPoint->x()); + } else { + aVal = aTextX.toDouble(&isDouble); + if (isDouble) + ModuleBase_Tools::setSpinValue(myXSpin, aVal); + else + ModuleBase_Tools::setSpinText(myXSpin, aTextX); + } + if (aTextY.isEmpty()) { ModuleBase_Tools::setSpinValue(myYSpin, aPoint->y()); } else { - ModuleBase_Tools::setSpinText(myXSpin, QString::fromStdString(aTextX)); - ModuleBase_Tools::setSpinText(myYSpin, QString::fromStdString(aTextY)); + aVal = aTextY.toDouble(&isDouble); + if (isDouble) + ModuleBase_Tools::setSpinValue(myYSpin, aVal); + else + ModuleBase_Tools::setSpinText(myYSpin, aTextY); } + //if (aTextX.empty() || aTextY.empty()) { + // ModuleBase_Tools::setSpinValue(myXSpin, aPoint->x()); + // ModuleBase_Tools::setSpinValue(myYSpin, aPoint->y()); + //} else { + // ModuleBase_Tools::setSpinText(myXSpin, QString::fromStdString(aTextX)); + // ModuleBase_Tools::setSpinText(myYSpin, QString::fromStdString(aTextY)); + //} return true; }