From d6a55c9a402d95f55390f83edf4a009a210393b2 Mon Sep 17 00:00:00 2001 From: dismine Date: Sat, 8 Nov 2014 17:04:14 +0200 Subject: [PATCH] Validate points. --HG-- branch : develop --- .../dialogs/tools/dialoglineintersectaxis.cpp | 33 +++++++++++++++++++ .../dialogs/tools/dialoglineintersectaxis.h | 1 + .../dialogs/tools/dialoglineintersectaxis.ui | 6 ++-- 3 files changed, 37 insertions(+), 3 deletions(-) diff --git a/src/app/dialogs/tools/dialoglineintersectaxis.cpp b/src/app/dialogs/tools/dialoglineintersectaxis.cpp index 768536d4b..b30ee2cb4 100644 --- a/src/app/dialogs/tools/dialoglineintersectaxis.cpp +++ b/src/app/dialogs/tools/dialoglineintersectaxis.cpp @@ -66,6 +66,14 @@ DialogLineIntersectAxis::DialogLineIntersectAxis(const VContainer *data, const q connect(ui->plainTextEditFormula, &QPlainTextEdit::textChanged, this, &DialogLineIntersectAxis::AngleTextChanged); connect(ui->pushButtonGrowLengthAngle, &QPushButton::clicked, this, &DialogLineIntersectAxis::DeployAngleTextEdit); connect(timerFormula, &QTimer::timeout, this, &DialogLineIntersectAxis::EvalAngle); + connect(ui->comboBoxFirstLinePoint, + static_cast(&QComboBox::currentIndexChanged), + this, &DialogLineIntersectAxis::PointNameChanged); + connect(ui->comboBoxSecondLinePoint, + static_cast(&QComboBox::currentIndexChanged), + this, &DialogLineIntersectAxis::PointNameChanged); + connect(ui->comboBoxAxisPoint, static_cast(&QComboBox::currentIndexChanged), + this, &DialogLineIntersectAxis::PointNameChanged); line = new VisToolLineIntersectAxis(data); } @@ -257,6 +265,31 @@ void DialogLineIntersectAxis::DeployAngleTextEdit() DeployFormula(ui->plainTextEditFormula, ui->pushButtonGrowLengthAngle, formulaBaseHeightAngle); } +//--------------------------------------------------------------------------------------------------------------------- +void DialogLineIntersectAxis::PointNameChanged() +{ + QSet set; + set.insert(getCurrentObjectId(ui->comboBoxFirstLinePoint)); + set.insert(getCurrentObjectId(ui->comboBoxSecondLinePoint)); + set.insert(getCurrentObjectId(ui->comboBoxAxisPoint)); + + QColor color = okColor; + if (set.size() != 3) + { + flagError = false; + color = errorColor; + } + else + { + flagError = true; + color = okColor; + } + ChangeColor(ui->labelFirstLinePoint, color); + ChangeColor(ui->labelSecondLinePoint, color); + ChangeColor(ui->labelAxisPoint, color); + CheckState(); +} + //--------------------------------------------------------------------------------------------------------------------- void DialogLineIntersectAxis::ShowVisualization() { diff --git a/src/app/dialogs/tools/dialoglineintersectaxis.h b/src/app/dialogs/tools/dialoglineintersectaxis.h index f4bbbd5e8..cc287c199 100644 --- a/src/app/dialogs/tools/dialoglineintersectaxis.h +++ b/src/app/dialogs/tools/dialoglineintersectaxis.h @@ -70,6 +70,7 @@ public slots: void EvalAngle(); void AngleTextChanged(); void DeployAngleTextEdit(); + virtual void PointNameChanged(); protected: virtual void ShowVisualization(); /** diff --git a/src/app/dialogs/tools/dialoglineintersectaxis.ui b/src/app/dialogs/tools/dialoglineintersectaxis.ui index 3ef9348a0..6a8ed86f6 100644 --- a/src/app/dialogs/tools/dialoglineintersectaxis.ui +++ b/src/app/dialogs/tools/dialoglineintersectaxis.ui @@ -211,7 +211,7 @@ - + 0 @@ -231,7 +231,7 @@ - + 0 @@ -251,7 +251,7 @@ - + 0