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

View File

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