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> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Edit wrong formula</string> <string>Edit formula</string>
</property> </property>
<property name="windowIcon"> <property name="windowIcon">
<iconset resource="../../share/resources/icon.qrc"> <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(edit != nullptr);
SCASSERT(timer != nullptr); SCASSERT(timer != nullptr);
SCASSERT(labelEditFormula != nullptr); SCASSERT(labelEditFormula != nullptr);
SCASSERT(labelResultCalculation != nullptr);
if (edit->text().isEmpty()) if (edit->text().isEmpty())
{ {
flag = false; flag = false;
CheckState(); CheckState();
ChangeColor(labelEditFormula, Qt::red); ChangeColor(labelEditFormula, Qt::red);
labelResultCalculation->setText(tr("Error"));
return; return;
} }
timer->start(1000); timer->start(1000);
@ -392,11 +394,13 @@ void DialogTool::ValFormulaChanged(bool &flag, QPlainTextEdit *edit, QTimer *tim
SCASSERT(edit != nullptr); SCASSERT(edit != nullptr);
SCASSERT(timer != nullptr); SCASSERT(timer != nullptr);
SCASSERT(labelEditFormula != nullptr); SCASSERT(labelEditFormula != nullptr);
SCASSERT(labelResultCalculation != nullptr);
if (edit->toPlainText().isEmpty()) if (edit->toPlainText().isEmpty())
{ {
flag = false; flag = false;
CheckState(); CheckState();
ChangeColor(labelEditFormula, Qt::red); ChangeColor(labelEditFormula, Qt::red);
labelResultCalculation->setText(tr("Error"));
return; return;
} }
timer->setSingleShot(true); timer->setSingleShot(true);
@ -423,6 +427,7 @@ void DialogTool::Eval(const QString &text, bool &flag, QTimer *timer, QLabel *la
{ {
flag = false; flag = false;
ChangeColor(labelEditFormula, Qt::red); ChangeColor(labelEditFormula, Qt::red);
label->setText(tr("Error"));
} }
else else
{ {
@ -441,6 +446,7 @@ void DialogTool::Eval(const QString &text, bool &flag, QTimer *timer, QLabel *la
{ {
flag = false; flag = false;
ChangeColor(labelEditFormula, Qt::red); ChangeColor(labelEditFormula, Qt::red);
label->setText(tr("Error"));
} }
else else
{ {

View File

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