diff --git a/ChangeLog.txt b/ChangeLog.txt index 92bcc71bd..be0318d43 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -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. diff --git a/src/libs/vtools/dialogs/support/dialogeditwrongformula.cpp b/src/libs/vtools/dialogs/support/dialogeditwrongformula.cpp index da69688b1..300160bd5 100644 --- a/src/libs/vtools/dialogs/support/dialogeditwrongformula.cpp +++ b/src/libs/vtools/dialogs/support/dialogeditwrongformula.cpp @@ -169,59 +169,55 @@ void DialogEditWrongFormula::ValChanged(int row) return; } QTableWidgetItem *item = ui->tableWidget->item( row, ColumnName ); - if (ui->radioButtonStandardTable->isChecked()) + const QString name = qApp->TrVars()->VarFromUser(item->text()); + + try { - const QString name = qApp->TrVars()->VarFromUser(item->text()); - const QSharedPointer stable = data->GetVariable(name); - SetDescription(item->text(), *data->DataVariables()->value(name)->GetValue(), - UnitsToStr(qApp->patternUnit(), true), stable->GetGuiText()); - return; + if (ui->radioButtonStandardTable->isChecked()) + { + const QSharedPointer stable = data->GetVariable(name); + SetDescription(item->text(), *stable->GetValue(), UnitsToStr(qApp->patternUnit(), true), + stable->GetGuiText()); + } + else if (ui->radioButtonIncrements->isChecked()) + { + const QSharedPointer incr = data->GetVariable(name); + SetDescription(item->text(), *incr->GetValue(), UnitsToStr(qApp->patternUnit(), true), + incr->GetDescription()); + } + else if (ui->radioButtonLengthLine->isChecked()) + { + SetDescription(item->text(), *data->GetVariable(name)->GetValue(), + UnitsToStr(qApp->patternUnit(), true), tr("Line length")); + } + else if (ui->radioButtonLengthSpline->isChecked()) + { + SetDescription(item->text(), *data->GetVariable(name)->GetValue(), + UnitsToStr(qApp->patternUnit(), true), tr("Curve length")); + } + else if (ui->radioButtonAngleLine->isChecked()) + { + SetDescription(item->text(), *data->GetVariable(name)->GetValue(), degreeSymbol, + tr("Line Angle")); + } + else if (ui->radioButtonRadiusesArcs->isChecked()) + { + SetDescription(item->text(), *data->GetVariable(name)->GetValue(), + UnitsToStr(qApp->patternUnit(), true), tr("Arc radius")); + } + else if (ui->radioButtonAnglesCurves->isChecked()) + { + SetDescription(item->text(), *data->GetVariable(name)->GetValue(), degreeSymbol, + tr("Curve angle")); + } + else if (ui->radioButtonFunctions->isChecked()) + { + ui->labelDescription->setText(item->toolTip()); + } } - if (ui->radioButtonIncrements->isChecked()) + catch (const VExceptionBadId &e) { - const QSharedPointer incr = data->GetVariable(item->text()); - SetDescription(item->text(), *data->DataVariables()->value(item->text())->GetValue(), - UnitsToStr(qApp->patternUnit(), true), incr->GetDescription()); - return; - } - if (ui->radioButtonLengthLine->isChecked()) - { - SetDescription(item->text(), - *data->GetVariable(qApp->TrVars()->VarFromUser(item->text()))->GetValue(), - UnitsToStr(qApp->patternUnit(), true), tr("Line length")); - return; - } - if (ui->radioButtonLengthSpline->isChecked()) - { - SetDescription(item->text(), - *data->GetVariable(qApp->TrVars()->VarFromUser(item->text()))->GetValue(), - UnitsToStr(qApp->patternUnit(), true), tr("Curve length")); - return; - } - if (ui->radioButtonAngleLine->isChecked()) - { - SetDescription(item->text(), - *data->GetVariable(qApp->TrVars()->VarFromUser(item->text()))->GetValue(), - degreeSymbol, tr("Line Angle")); - return; - } - if (ui->radioButtonRadiusesArcs->isChecked()) - { - SetDescription(item->text(), - *data->GetVariable(qApp->TrVars()->VarFromUser(item->text()))->GetValue(), - UnitsToStr(qApp->patternUnit(), true), tr("Arc radius")); - return; - } - if (ui->radioButtonAnglesCurves->isChecked()) - { - SetDescription(item->text(), - *data->GetVariable(qApp->TrVars()->VarFromUser(item->text()))->GetValue(), - degreeSymbol, tr("Curve angle")); - return; - } - if (ui->radioButtonFunctions->isChecked()) - { - ui->labelDescription->setText(item->toolTip()); + qCritical() << qUtf8Printable(e.ErrorMessage()); } }