parent
013a8d7cfd
commit
ffed353147
|
@ -45,8 +45,9 @@
|
||||||
*/
|
*/
|
||||||
DialogArc::DialogArc(const VContainer *data, const quint32 &toolId, QWidget *parent)
|
DialogArc::DialogArc(const VContainer *data, const quint32 &toolId, QWidget *parent)
|
||||||
:DialogTool(data, toolId, parent), ui(new Ui::DialogArc), flagRadius(false), flagF1(false), flagF2(false),
|
:DialogTool(data, toolId, parent), ui(new Ui::DialogArc), flagRadius(false), flagF1(false), flagF2(false),
|
||||||
timerRadius(nullptr), timerF1(nullptr), timerF2(nullptr), center(NULL_ID), radius(QString()), f1(QString()),
|
timerRadius(nullptr), timerF1(nullptr), timerF2(nullptr), center(NULL_ID), radius(QString()),
|
||||||
f2(QString()), formulaBaseHeight(0), formulaBaseHeightF1(0), formulaBaseHeightF2(0), path(nullptr)
|
f1(QString()), f2(QString()), formulaBaseHeight(0), formulaBaseHeightF1(0), formulaBaseHeightF2(0), path(nullptr),
|
||||||
|
angleF1(0), angleF2(0)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
@ -65,10 +66,10 @@ DialogArc::DialogArc(const VContainer *data, const quint32 &toolId, QWidget *par
|
||||||
connect(timerRadius, &QTimer::timeout, this, &DialogArc::EvalRadius);
|
connect(timerRadius, &QTimer::timeout, this, &DialogArc::EvalRadius);
|
||||||
|
|
||||||
timerF1 = new QTimer(this);
|
timerF1 = new QTimer(this);
|
||||||
connect(timerF1, &QTimer::timeout, this, &DialogArc::EvalF1);
|
connect(timerF1, &QTimer::timeout, this, &DialogArc::EvalF);
|
||||||
|
|
||||||
timerF2 = new QTimer(this);
|
timerF2 = new QTimer(this);
|
||||||
connect(timerF2, &QTimer::timeout, this, &DialogArc::EvalF2);
|
connect(timerF2, &QTimer::timeout, this, &DialogArc::EvalF);
|
||||||
|
|
||||||
InitOkCancelApply(ui);
|
InitOkCancelApply(ui);
|
||||||
|
|
||||||
|
@ -81,8 +82,8 @@ DialogArc::DialogArc(const VContainer *data, const quint32 &toolId, QWidget *par
|
||||||
connect(ui->toolButtonPutHereF2, &QPushButton::clicked, this, &DialogArc::PutF2);
|
connect(ui->toolButtonPutHereF2, &QPushButton::clicked, this, &DialogArc::PutF2);
|
||||||
|
|
||||||
connect(ui->toolButtonEqualRadius, &QPushButton::clicked, this, &DialogArc::EvalRadius);
|
connect(ui->toolButtonEqualRadius, &QPushButton::clicked, this, &DialogArc::EvalRadius);
|
||||||
connect(ui->toolButtonEqualF1, &QPushButton::clicked, this, &DialogArc::EvalF1);
|
connect(ui->toolButtonEqualF1, &QPushButton::clicked, this, &DialogArc::EvalF);
|
||||||
connect(ui->toolButtonEqualF2, &QPushButton::clicked, this, &DialogArc::EvalF2);
|
connect(ui->toolButtonEqualF2, &QPushButton::clicked, this, &DialogArc::EvalF);
|
||||||
|
|
||||||
connect(ui->plainTextEditFormula, &QPlainTextEdit::textChanged, this, &DialogArc::RadiusChanged);
|
connect(ui->plainTextEditFormula, &QPlainTextEdit::textChanged, this, &DialogArc::RadiusChanged);
|
||||||
connect(ui->plainTextEditF1, &QPlainTextEdit::textChanged, this, &DialogArc::F1Changed);
|
connect(ui->plainTextEditF1, &QPlainTextEdit::textChanged, this, &DialogArc::F1Changed);
|
||||||
|
@ -356,22 +357,17 @@ void DialogArc::EvalRadius()
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief EvalF1 calculate value of first angle
|
* @brief EvalF1 calculate value of angle
|
||||||
*/
|
*/
|
||||||
void DialogArc::EvalF1()
|
void DialogArc::EvalF()
|
||||||
{
|
{
|
||||||
labelEditFormula = ui->labelEditF1;
|
labelEditFormula = ui->labelEditF1;
|
||||||
Eval(ui->plainTextEditF1->toPlainText(), flagF1, ui->labelResultF1, degreeSymbol, false);
|
angleF1 = Eval(ui->plainTextEditF1->toPlainText(), flagF1, ui->labelResultF1, degreeSymbol, false);
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief EvalF2 calculate value of second angle
|
|
||||||
*/
|
|
||||||
void DialogArc::EvalF2()
|
|
||||||
{
|
|
||||||
labelEditFormula = ui->labelEditF2;
|
labelEditFormula = ui->labelEditF2;
|
||||||
Eval(ui->plainTextEditF2->toPlainText(), flagF2, ui->labelResultF2, degreeSymbol, false);
|
angleF2 = Eval(ui->plainTextEditF2->toPlainText(), flagF2, ui->labelResultF2, degreeSymbol, false);
|
||||||
|
|
||||||
|
CheckAngles();
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -394,3 +390,20 @@ void DialogArc::ShowLineAngles()
|
||||||
}
|
}
|
||||||
ui->listWidget->setCurrentRow (0);
|
ui->listWidget->setCurrentRow (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogArc::CheckAngles()
|
||||||
|
{
|
||||||
|
if (qFuzzyCompare(angleF1 + 1, angleF2 + 1))
|
||||||
|
{
|
||||||
|
flagF1 = false;
|
||||||
|
ChangeColor(ui->labelEditF1, Qt::red);
|
||||||
|
ui->labelResultF1->setToolTip(tr("Angles equal"));
|
||||||
|
|
||||||
|
flagF2 = false;
|
||||||
|
ChangeColor(ui->labelEditF2, Qt::red);
|
||||||
|
ui->labelResultF2->setToolTip(tr("Angles equal"));
|
||||||
|
}
|
||||||
|
|
||||||
|
DialogArc::CheckState();
|
||||||
|
}
|
||||||
|
|
|
@ -126,11 +126,13 @@ private:
|
||||||
|
|
||||||
VisToolArc *path;
|
VisToolArc *path;
|
||||||
|
|
||||||
void EvalRadius();
|
qreal angleF1;
|
||||||
void EvalF1();
|
qreal angleF2;
|
||||||
void EvalF2();
|
|
||||||
void ShowLineAngles();
|
|
||||||
|
|
||||||
|
void EvalRadius();
|
||||||
|
void EvalF();
|
||||||
|
void ShowLineAngles();
|
||||||
|
void CheckAngles();
|
||||||
};
|
};
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -473,10 +473,13 @@ void DialogTool::ValFormulaChanged(bool &flag, QPlainTextEdit *edit, QTimer *tim
|
||||||
* @param postfix unit name
|
* @param postfix unit name
|
||||||
* @param checkZero true - if formula can't be equal zero
|
* @param checkZero true - if formula can't be equal zero
|
||||||
*/
|
*/
|
||||||
void DialogTool::Eval(const QString &text, bool &flag, QLabel *label, const QString& postfix, bool checkZero)
|
qreal DialogTool::Eval(const QString &text, bool &flag, QLabel *label, const QString& postfix, bool checkZero)
|
||||||
{
|
{
|
||||||
SCASSERT(label != nullptr);
|
SCASSERT(label != nullptr);
|
||||||
SCASSERT(labelEditFormula != nullptr);
|
SCASSERT(labelEditFormula != nullptr);
|
||||||
|
|
||||||
|
qreal result = 0;
|
||||||
|
|
||||||
if (text.isEmpty())
|
if (text.isEmpty())
|
||||||
{
|
{
|
||||||
flag = false;
|
flag = false;
|
||||||
|
@ -493,7 +496,7 @@ void DialogTool::Eval(const QString &text, bool &flag, QLabel *label, const QStr
|
||||||
formula.replace("\n", " ");
|
formula.replace("\n", " ");
|
||||||
formula = qApp->FormulaFromUser(formula);
|
formula = qApp->FormulaFromUser(formula);
|
||||||
Calculator *cal = new Calculator(data);
|
Calculator *cal = new Calculator(data);
|
||||||
const qreal result = cal->EvalFormula(formula);
|
result = cal->EvalFormula(formula);
|
||||||
delete cal;
|
delete cal;
|
||||||
|
|
||||||
//if result equal 0
|
//if result equal 0
|
||||||
|
@ -537,6 +540,7 @@ void DialogTool::Eval(const QString &text, bool &flag, QLabel *label, const QStr
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CheckState();
|
CheckState();
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -225,7 +225,7 @@ protected:
|
||||||
void PutValHere(QPlainTextEdit *plainTextEdit, QListWidget *listWidget);
|
void PutValHere(QPlainTextEdit *plainTextEdit, QListWidget *listWidget);
|
||||||
void ValFormulaChanged(bool &flag, QLineEdit *edit, QTimer * timer);
|
void ValFormulaChanged(bool &flag, QLineEdit *edit, QTimer * timer);
|
||||||
void ValFormulaChanged(bool &flag, QPlainTextEdit *edit, QTimer * timer);
|
void ValFormulaChanged(bool &flag, QPlainTextEdit *edit, QTimer * timer);
|
||||||
void Eval(const QString &text, bool &flag, QLabel *label, const QString &postfix,
|
qreal Eval(const QString &text, bool &flag, QLabel *label, const QString &postfix,
|
||||||
bool checkZero = true);
|
bool checkZero = true);
|
||||||
void setCurrentPointId(QComboBox *box, quint32 &pointId, const quint32 &value) const;
|
void setCurrentPointId(QComboBox *box, quint32 &pointId, const quint32 &value) const;
|
||||||
void setCurrentSplineId(QComboBox *box, quint32 &splineId, const quint32 &value,
|
void setCurrentSplineId(QComboBox *box, quint32 &splineId, const quint32 &value,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user