Formula that calculate angle can be equal zero.
--HG-- branch : develop
This commit is contained in:
parent
318517d3d7
commit
3af2859980
|
@ -335,7 +335,7 @@ void DialogArc::EvalRadius()
|
|||
void DialogArc::EvalF1()
|
||||
{
|
||||
labelEditFormula = ui->labelEditF1;
|
||||
Eval(ui->plainTextEditF1->toPlainText(), flagF1, timerF1, ui->labelResultF1);
|
||||
Eval(ui->plainTextEditF1->toPlainText(), flagF1, timerF1, ui->labelResultF1, false);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -345,7 +345,7 @@ void DialogArc::EvalF1()
|
|||
void DialogArc::EvalF2()
|
||||
{
|
||||
labelEditFormula = ui->labelEditF2;
|
||||
Eval(ui->plainTextEditF2->toPlainText(), flagF2, timerF2, ui->labelResultF2);
|
||||
Eval(ui->plainTextEditF2->toPlainText(), flagF2, timerF2, ui->labelResultF2, false);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -425,8 +425,9 @@ void DialogTool::ValFormulaChanged(bool &flag, QPlainTextEdit *edit, QTimer *tim
|
|||
* @param flag flag state of formula
|
||||
* @param timer timer of formula
|
||||
* @param label label for signal error
|
||||
* @param checkZero true - if formula can't be equal zero
|
||||
*/
|
||||
void DialogTool::Eval(const QString &text, bool &flag, QTimer *timer, QLabel *label)
|
||||
void DialogTool::Eval(const QString &text, bool &flag, QTimer *timer, QLabel *label, bool checkZero)
|
||||
{
|
||||
SCASSERT(timer != nullptr);
|
||||
SCASSERT(label != nullptr);
|
||||
|
@ -449,7 +450,7 @@ void DialogTool::Eval(const QString &text, bool &flag, QTimer *timer, QLabel *la
|
|||
delete cal;
|
||||
|
||||
//if result equal 0
|
||||
if (qFuzzyCompare(1 + result, 1 + 0))
|
||||
if (checkZero && qFuzzyCompare(1 + result, 1 + 0))
|
||||
{
|
||||
flag = false;
|
||||
ChangeColor(labelEditFormula, Qt::red);
|
||||
|
|
|
@ -213,7 +213,7 @@ protected:
|
|||
void PutValHere(QPlainTextEdit *plainTextEdit, QListWidget *listWidget);
|
||||
void ValFormulaChanged(bool &flag, QLineEdit *edit, QTimer * timer);
|
||||
void ValFormulaChanged(bool &flag, QPlainTextEdit *edit, QTimer * timer);
|
||||
void Eval(const QString &text, bool &flag, QTimer *timer, QLabel *label);
|
||||
void Eval(const QString &text, bool &flag, QTimer *timer, QLabel *label, bool checkZero = true);
|
||||
void setCurrentPointId(QComboBox *box, quint32 &pointId, const quint32 &value) const;
|
||||
void setCurrentSplineId(QComboBox *box, quint32 &splineId, const quint32 &value,
|
||||
ComboBoxCutSpline cut = ComboBoxCutSpline::NoCutSpline) const;
|
||||
|
|
|
@ -214,8 +214,7 @@ qreal VDrawTool::CheckFormula(const quint32 &toolId, QString &formula, VContaine
|
|||
{
|
||||
formula = dialog->getFormula();
|
||||
/* Need delete dialog here because parser in dialog don't allow use correct separator for parsing
|
||||
* here.
|
||||
* Don't know why. */
|
||||
* here. */
|
||||
delete dialog;
|
||||
Calculator *cal1 = new Calculator(data);
|
||||
result = cal1->EvalFormula(formula);
|
||||
|
|
Loading…
Reference in New Issue
Block a user