Show Error message when formula broken.

--HG--
branch : feature
This commit is contained in:
dismine 2014-08-29 17:38:43 +03:00
parent a251c9e378
commit fa4a7fb7b8
3 changed files with 8 additions and 1 deletions

View File

@ -14,7 +14,7 @@
</rect>
</property>
<property name="windowTitle">
<string>Edit wrong formula</string>
<string>Edit formula</string>
</property>
<property name="windowIcon">
<iconset resource="../../share/resources/icon.qrc">

View File

@ -377,11 +377,13 @@ void DialogTool::ValFormulaChanged(bool &flag, QLineEdit *edit, QTimer *timer)
SCASSERT(edit != nullptr);
SCASSERT(timer != nullptr);
SCASSERT(labelEditFormula != nullptr);
SCASSERT(labelResultCalculation != nullptr);
if (edit->text().isEmpty())
{
flag = false;
CheckState();
ChangeColor(labelEditFormula, Qt::red);
labelResultCalculation->setText(tr("Error"));
return;
}
timer->start(1000);
@ -392,11 +394,13 @@ void DialogTool::ValFormulaChanged(bool &flag, QPlainTextEdit *edit, QTimer *tim
SCASSERT(edit != nullptr);
SCASSERT(timer != nullptr);
SCASSERT(labelEditFormula != nullptr);
SCASSERT(labelResultCalculation != nullptr);
if (edit->toPlainText().isEmpty())
{
flag = false;
CheckState();
ChangeColor(labelEditFormula, Qt::red);
labelResultCalculation->setText(tr("Error"));
return;
}
timer->setSingleShot(true);
@ -423,6 +427,7 @@ void DialogTool::Eval(const QString &text, bool &flag, QTimer *timer, QLabel *la
{
flag = false;
ChangeColor(labelEditFormula, Qt::red);
label->setText(tr("Error"));
}
else
{
@ -441,6 +446,7 @@ void DialogTool::Eval(const QString &text, bool &flag, QTimer *timer, QLabel *la
{
flag = false;
ChangeColor(labelEditFormula, Qt::red);
label->setText(tr("Error"));
}
else
{

View File

@ -209,6 +209,7 @@ qreal VDrawTool::CheckFormula(const quint32 &toolId, QString &formula, VContaine
if (resultUndo == UndoButton::Fix)
{
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, qApp->getMainWindow());
dialog->setWindowTitle(tr("Edit wrong formula"));
dialog->setFormula(formula);
if (dialog->exec() == QDialog::Accepted)
{