Fixed issue #798. Formula Wizard crashes with translated increments.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2018-01-15 19:53:17 +02:00
parent 76f93ca63e
commit f8b673d5eb
2 changed files with 47 additions and 50 deletions

View File

@ -82,6 +82,7 @@
- [#778] Calling Valentina with "-h" option opens information dialog instead of writing to console.
- [#788] Unhardcode icon path in GNU/Linux launcher.
- [#797] Custom seam allowance ignored in some cases.
- [#798] Formula Wizard crashes with translated increments.
# Version 0.5.0 May 9, 2017
- [#581] User can now filter input lists by keyword in function wizard.

View File

@ -169,60 +169,56 @@ void DialogEditWrongFormula::ValChanged(int row)
return;
}
QTableWidgetItem *item = ui->tableWidget->item( row, ColumnName );
const QString name = qApp->TrVars()->VarFromUser(item->text());
try
{
if (ui->radioButtonStandardTable->isChecked())
{
const QString name = qApp->TrVars()->VarFromUser(item->text());
const QSharedPointer<VMeasurement> stable = data->GetVariable<VMeasurement>(name);
SetDescription(item->text(), *data->DataVariables()->value(name)->GetValue(),
UnitsToStr(qApp->patternUnit(), true), stable->GetGuiText());
return;
SetDescription(item->text(), *stable->GetValue(), UnitsToStr(qApp->patternUnit(), true),
stable->GetGuiText());
}
if (ui->radioButtonIncrements->isChecked())
else if (ui->radioButtonIncrements->isChecked())
{
const QSharedPointer<VIncrement> incr = data->GetVariable<VIncrement>(item->text());
SetDescription(item->text(), *data->DataVariables()->value(item->text())->GetValue(),
UnitsToStr(qApp->patternUnit(), true), incr->GetDescription());
return;
const QSharedPointer<VIncrement> incr = data->GetVariable<VIncrement>(name);
SetDescription(item->text(), *incr->GetValue(), UnitsToStr(qApp->patternUnit(), true),
incr->GetDescription());
}
if (ui->radioButtonLengthLine->isChecked())
else if (ui->radioButtonLengthLine->isChecked())
{
SetDescription(item->text(),
*data->GetVariable<VLengthLine>(qApp->TrVars()->VarFromUser(item->text()))->GetValue(),
SetDescription(item->text(), *data->GetVariable<VLengthLine>(name)->GetValue(),
UnitsToStr(qApp->patternUnit(), true), tr("Line length"));
return;
}
if (ui->radioButtonLengthSpline->isChecked())
else if (ui->radioButtonLengthSpline->isChecked())
{
SetDescription(item->text(),
*data->GetVariable<VCurveLength>(qApp->TrVars()->VarFromUser(item->text()))->GetValue(),
SetDescription(item->text(), *data->GetVariable<VCurveLength>(name)->GetValue(),
UnitsToStr(qApp->patternUnit(), true), tr("Curve length"));
return;
}
if (ui->radioButtonAngleLine->isChecked())
else if (ui->radioButtonAngleLine->isChecked())
{
SetDescription(item->text(),
*data->GetVariable<VLineAngle>(qApp->TrVars()->VarFromUser(item->text()))->GetValue(),
degreeSymbol, tr("Line Angle"));
return;
SetDescription(item->text(), *data->GetVariable<VLineAngle>(name)->GetValue(), degreeSymbol,
tr("Line Angle"));
}
if (ui->radioButtonRadiusesArcs->isChecked())
else if (ui->radioButtonRadiusesArcs->isChecked())
{
SetDescription(item->text(),
*data->GetVariable<VArcRadius>(qApp->TrVars()->VarFromUser(item->text()))->GetValue(),
SetDescription(item->text(), *data->GetVariable<VArcRadius>(name)->GetValue(),
UnitsToStr(qApp->patternUnit(), true), tr("Arc radius"));
return;
}
if (ui->radioButtonAnglesCurves->isChecked())
else if (ui->radioButtonAnglesCurves->isChecked())
{
SetDescription(item->text(),
*data->GetVariable<VCurveAngle>(qApp->TrVars()->VarFromUser(item->text()))->GetValue(),
degreeSymbol, tr("Curve angle"));
return;
SetDescription(item->text(), *data->GetVariable<VCurveAngle>(name)->GetValue(), degreeSymbol,
tr("Curve angle"));
}
if (ui->radioButtonFunctions->isChecked())
else if (ui->radioButtonFunctions->isChecked())
{
ui->labelDescription->setText(item->toolTip());
}
}
catch (const VExceptionBadId &e)
{
qCritical() << qUtf8Printable(e.ErrorMessage());
}
}
//---------------------------------------------------------------------------------------------------------------------