Errors after merging.
--HG-- branch : DialogTools
This commit is contained in:
parent
6f009a8ee4
commit
6f7a30f3a7
|
@ -163,7 +163,6 @@ void DialogEndLine::SaveData()
|
||||||
formula.replace("\n"," ");
|
formula.replace("\n"," ");
|
||||||
angle = ui->doubleSpinBoxAngle->value();
|
angle = ui->doubleSpinBoxAngle->value();
|
||||||
basePointId = getCurrentObjectId(ui->comboBoxBasePoint);
|
basePointId = getCurrentObjectId(ui->comboBoxBasePoint);
|
||||||
emit DialogClosed(QDialog::Accepted);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -415,23 +415,31 @@ void DialogTool::Eval(QPlainTextEdit *edit, bool &flag, QTimer *timer, QLabel *l
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Calculator cal(data);
|
try
|
||||||
QString errorMsg;
|
{
|
||||||
// Replace line return with spaces for calc
|
// Replace line return with spaces for calc
|
||||||
QString formula = edit->toPlainText();
|
QString formula = edit->toPlainText();
|
||||||
formula.replace("\n"," ");
|
formula.replace("\n"," ");
|
||||||
qreal result = cal.eval(formula, &errorMsg);
|
formula = qApp->FormulaFromUser(formula);
|
||||||
if (errorMsg.isEmpty() == false)
|
Calculator cal(data);
|
||||||
|
const qreal result = cal.EvalFormula(formula);
|
||||||
|
|
||||||
|
label->setText(QString().setNum(result));
|
||||||
|
flag = true;
|
||||||
|
palette.setColor(labelEditFormula->foregroundRole(), QColor(76, 76, 76));
|
||||||
|
emit ToolTip("");
|
||||||
|
}
|
||||||
|
catch(qmu::QmuParserError &e)
|
||||||
{
|
{
|
||||||
label->setText(tr("Error"));
|
label->setText(tr("Error"));
|
||||||
flag = false;
|
flag = false;
|
||||||
palette.setColor(labelEditFormula->foregroundRole(), Qt::red);
|
palette.setColor(labelEditFormula->foregroundRole(), Qt::red);
|
||||||
}
|
emit ToolTip("Parser error: "+e.GetMsg());
|
||||||
else
|
qDebug() << "\nMath parser error:\n"
|
||||||
{
|
<< "--------------------------------------\n"
|
||||||
label->setText(QString().setNum(result));
|
<< "Message: " << e.GetMsg() << "\n"
|
||||||
flag = true;
|
<< "Expression: " << e.GetExpr() << "\n"
|
||||||
palette.setColor(labelEditFormula->foregroundRole(), QColor(76, 76, 76));
|
<< "--------------------------------------";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CheckState();
|
CheckState();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user