Fixed issue #379. Crash in Tape, Create/Edit when '(' in Formula field then

click f(x).

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2015-09-29 18:09:41 +03:00
parent 2e344b27b0
commit e6fec09905

View File

@ -786,7 +786,15 @@ void TMainWindow::Fx()
QString text = ui->plainTextEditFormula->toPlainText(); QString text = ui->plainTextEditFormula->toPlainText();
text.replace("\n", " "); text.replace("\n", " ");
try
{
text = qApp->TrVars()->FormulaFromUser(text, true); text = qApp->TrVars()->FormulaFromUser(text, true);
}
catch (qmu::QmuParserError &e) // Just in case something bad will happen
{
Q_UNUSED(e)
text = ui->plainTextEditFormula->toPlainText();
}
dialog->SetFormula(text); dialog->SetFormula(text);
const QString postfix = VDomDocument::UnitsToStr(mUnit, true);//Show unit in dialog lable (cm, mm or inch) const QString postfix = VDomDocument::UnitsToStr(mUnit, true);//Show unit in dialog lable (cm, mm or inch)
dialog->setPostfix(postfix); dialog->setPostfix(postfix);
@ -1229,7 +1237,7 @@ void TMainWindow::SaveMValue()
const QString formula = qApp->TrVars()->FormulaFromUser(text, true); const QString formula = qApp->TrVars()->FormulaFromUser(text, true);
m->SetMValue(nameField->data(Qt::UserRole).toString(), formula); m->SetMValue(nameField->data(Qt::UserRole).toString(), formula);
} }
catch (qmu::QmuParserError &e) // Just in case something bad happens catch (qmu::QmuParserError &e) // Just in case something bad will happen
{ {
Q_UNUSED(e) Q_UNUSED(e)
return; return;