From fa4a7fb7b8458f5a9b7f079c6a9a7ba56740b6b8 Mon Sep 17 00:00:00 2001 From: dismine Date: Fri, 29 Aug 2014 17:38:43 +0300 Subject: [PATCH] Show Error message when formula broken. --HG-- branch : feature --- src/app/dialogs/tools/dialogeditwrongformula.ui | 2 +- src/app/dialogs/tools/dialogtool.cpp | 6 ++++++ src/app/tools/drawTools/vdrawtool.cpp | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/app/dialogs/tools/dialogeditwrongformula.ui b/src/app/dialogs/tools/dialogeditwrongformula.ui index 1c240dfa3..c24142095 100644 --- a/src/app/dialogs/tools/dialogeditwrongformula.ui +++ b/src/app/dialogs/tools/dialogeditwrongformula.ui @@ -14,7 +14,7 @@ - Edit wrong formula + Edit formula diff --git a/src/app/dialogs/tools/dialogtool.cpp b/src/app/dialogs/tools/dialogtool.cpp index 515ab0109..444fec323 100644 --- a/src/app/dialogs/tools/dialogtool.cpp +++ b/src/app/dialogs/tools/dialogtool.cpp @@ -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 { diff --git a/src/app/tools/drawTools/vdrawtool.cpp b/src/app/tools/drawTools/vdrawtool.cpp index 2eda94d91..106025ada 100644 --- a/src/app/tools/drawTools/vdrawtool.cpp +++ b/src/app/tools/drawTools/vdrawtool.cpp @@ -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) {