fixed 'additional double quotes in saving string persistent values into the system setting' bug

This commit is contained in:
granzuglia 2018-01-08 11:00:14 +11:00
parent a6f56c21fe
commit a4f45b29be
2 changed files with 15 additions and 1 deletions

View File

@ -523,7 +523,13 @@ void XMLStdParFrame::savePersistentParameterValue(QString name)
{
XMLMeshLabWidget* widg = it.value();
if (widg != nullptr)
emit savePersistentParameterValueRequested(name, widg->getWidgetExpression());
{
/*WARNING!!!! In order to be coherent with the scripting evaluation environment at the value of the XMLStringWidget a pair of double quotes is added at the beginning and at the end of the string*/
/*The best, and safest way to remove them (if they are not needed), is to let the scripting environment to evaluate the resulting string: Env e; QString st = e.evaluate(string_widg->getWidgetExpr).toString(); */
Env e;
QString expr = e.evaluate(widg->getWidgetExpression()).toString();
emit savePersistentParameterValueRequested(name,expr);
}
}
}
@ -831,6 +837,9 @@ void XMLStringWidget::updateVisibility( const bool vis )
}
/*WARNING!!!! In order to be coherent with the scripting evaluation environment at the value of the XMLStringWidget a pair of double quotes is added at the beginning and at the end of the string*/
/*The best, and safest way to remove them (if they are not needed), is to let the scripting environment to evaluate the resulting string: Env e; QString st = e.evaluate(string_widg->getWidgetExpr).toString(); */
QString XMLStringWidget::getWidgetExpression()
{
return QString("\"")+this->lineEdit->text()+QString("\"");

View File

@ -54,6 +54,7 @@ public:
//virtual void collectWidgetValue() = 0;
//void reset();
virtual void set(const QString& nwExpStr) = 0;
virtual QString getWidgetExpression() = 0;
//virtual void updateWidget(const XMLFilterInfo::XMLMap& xmlWidgetTag) = 0;
void setVisibility(const bool vis);
@ -169,6 +170,10 @@ public:
void set(const QString& nwExpStr);
//void updateWidget(const XMLFilterInfo::XMLMap& xmlWidgetTag);
void updateVisibility(const bool vis);
/*WARNING!!!! In order to be coherent with the scripting evaluation environment at the value of the XMLStringWidget a pair of double quotes is added at the beginning and at the end of the string*/
/*The best, and safest way to remove them (if they are not needed), is to let the scripting environment to evaluate the resulting string: Env e; QString st = e.evaluate(string_widg->getWidgetExpr).toString(); */
QString getWidgetExpression();
void addWidgetToGridLayout(QGridLayout* lay,const int r);