diff --git a/src/app/dialogs/tools/dialogpointofintersection.cpp b/src/app/dialogs/tools/dialogpointofintersection.cpp index a43edc02f..07efa52bd 100644 --- a/src/app/dialogs/tools/dialogpointofintersection.cpp +++ b/src/app/dialogs/tools/dialogpointofintersection.cpp @@ -53,6 +53,10 @@ DialogPointOfIntersection::DialogPointOfIntersection(const VContainer *data, QWi FillComboBoxPoints(ui->comboBoxSecondPoint); connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogPointOfIntersection::NamePointChanged); + connect(ui->comboBoxFirstPoint, static_cast(&QComboBox::currentIndexChanged), + this, &DialogPointOfIntersection::PointNameChanged); + connect(ui->comboBoxSecondPoint, static_cast(&QComboBox::currentIndexChanged), + this, &DialogPointOfIntersection::PointNameChanged); } //--------------------------------------------------------------------------------------------------------------------- @@ -69,8 +73,7 @@ DialogPointOfIntersection::~DialogPointOfIntersection() */ void DialogPointOfIntersection::setSecondPointId(const quint32 &value, const quint32 &id) { - secondPointId = value; - setCurrentPointId(ui->comboBoxSecondPoint, secondPointId, value, id); + setPointId(ui->comboBoxSecondPoint, secondPointId, value, id); } //--------------------------------------------------------------------------------------------------------------------- @@ -125,6 +128,24 @@ void DialogPointOfIntersection::DialogAccepted() emit DialogClosed(QDialog::Accepted); } +//--------------------------------------------------------------------------------------------------------------------- +void DialogPointOfIntersection::PointNameChanged() +{ + if (getCurrentObjectId(ui->comboBoxFirstPoint) == getCurrentObjectId(ui->comboBoxSecondPoint)) + { + flagError = false; + ChangeColor(ui->labelFirstPoint, Qt::red); + ChangeColor(ui->labelSecondPoint, Qt::red); + } + else + { + flagError = true; + ChangeColor(ui->labelFirstPoint, QColor(76, 76, 76)); + ChangeColor(ui->labelSecondPoint, QColor(76, 76, 76)); + } + CheckState(); +} + //--------------------------------------------------------------------------------------------------------------------- /** * @brief setFirstPointId set id of first point @@ -133,8 +154,7 @@ void DialogPointOfIntersection::DialogAccepted() */ void DialogPointOfIntersection::setFirstPointId(const quint32 &value, const quint32 &id) { - firstPointId = value; - setCurrentPointId(ui->comboBoxFirstPoint, firstPointId, value, id); + setPointId(ui->comboBoxFirstPoint, firstPointId, value, id); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/app/dialogs/tools/dialogpointofintersection.h b/src/app/dialogs/tools/dialogpointofintersection.h index dad79fa31..e036e6bf2 100644 --- a/src/app/dialogs/tools/dialogpointofintersection.h +++ b/src/app/dialogs/tools/dialogpointofintersection.h @@ -60,7 +60,8 @@ public slots: /** TODO ISSUE 79 : create real function * @brief DialogApply apply data and emit signal about applied dialog. */ - virtual void DialogApply(){} + virtual void DialogApply(){} + virtual void PointNameChanged(); private: Q_DISABLE_COPY(DialogPointOfIntersection) diff --git a/src/app/dialogs/tools/dialogpointofintersection.ui b/src/app/dialogs/tools/dialogpointofintersection.ui index 3a03630ec..88e61cdcd 100644 --- a/src/app/dialogs/tools/dialogpointofintersection.ui +++ b/src/app/dialogs/tools/dialogpointofintersection.ui @@ -78,7 +78,7 @@ - + 0 @@ -102,7 +102,7 @@ - + 0 diff --git a/src/app/dialogs/tools/dialogshoulderpoint.cpp b/src/app/dialogs/tools/dialogshoulderpoint.cpp index 2008fcfa1..b16e67dc0 100644 --- a/src/app/dialogs/tools/dialogshoulderpoint.cpp +++ b/src/app/dialogs/tools/dialogshoulderpoint.cpp @@ -64,6 +64,12 @@ DialogShoulderPoint::DialogShoulderPoint(const VContainer *data, QWidget *parent connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogShoulderPoint::NamePointChanged); connect(ui->plainTextEditFormula, &QPlainTextEdit::textChanged, this, &DialogShoulderPoint::FormulaTextChanged); connect(ui->pushButtonGrowLength, &QPushButton::clicked, this, &DialogShoulderPoint::DeployFormulaTextEdit); + connect(ui->comboBoxP1Line, static_cast(&QComboBox::currentIndexChanged), + this, &DialogShoulderPoint::PointNameChanged); + connect(ui->comboBoxP2Line, static_cast(&QComboBox::currentIndexChanged), + this, &DialogShoulderPoint::PointNameChanged); + connect(ui->comboBoxPShoulder, static_cast(&QComboBox::currentIndexChanged), + this, &DialogShoulderPoint::PointNameChanged); } //--------------------------------------------------------------------------------------------------------------------- @@ -72,6 +78,31 @@ void DialogShoulderPoint::FormulaTextChanged() this->FormulaChangedPlainText(); } +//--------------------------------------------------------------------------------------------------------------------- +void DialogShoulderPoint::PointNameChanged() +{ + QSet set; + set.insert(getCurrentObjectId(ui->comboBoxP1Line)); + set.insert(getCurrentObjectId(ui->comboBoxP2Line)); + set.insert(getCurrentObjectId(ui->comboBoxPShoulder)); + + if (set.size() != 3) + { + flagError = false; + ChangeColor(ui->labelFirstPoint, Qt::red); + ChangeColor(ui->labelSecondPoint, Qt::red); + ChangeColor(ui->labelPointShoulder, Qt::red); + } + else + { + flagError = true; + ChangeColor(ui->labelFirstPoint, QColor(76, 76, 76)); + ChangeColor(ui->labelSecondPoint, QColor(76, 76, 76)); + ChangeColor(ui->labelPointShoulder, QColor(76, 76, 76)); + } + CheckState(); +} + //--------------------------------------------------------------------------------------------------------------------- void DialogShoulderPoint::DeployFormulaTextEdit() { @@ -171,7 +202,7 @@ void DialogShoulderPoint::SaveData() */ void DialogShoulderPoint::setPShoulder(const quint32 &value, const quint32 &id) { - setCurrentPointId(ui->comboBoxPShoulder, pShoulder, value, id); + setPointId(ui->comboBoxPShoulder, pShoulder, value, id); } //--------------------------------------------------------------------------------------------------------------------- @@ -182,7 +213,7 @@ void DialogShoulderPoint::setPShoulder(const quint32 &value, const quint32 &id) */ void DialogShoulderPoint::setP2Line(const quint32 &value, const quint32 &id) { - setCurrentPointId(ui->comboBoxP2Line, p2Line, value, id); + setPointId(ui->comboBoxP2Line, p2Line, value, id); } //--------------------------------------------------------------------------------------------------------------------- @@ -193,7 +224,7 @@ void DialogShoulderPoint::setP2Line(const quint32 &value, const quint32 &id) */ void DialogShoulderPoint::setP1Line(const quint32 &value, const quint32 &id) { - setCurrentPointId(ui->comboBoxP1Line, p1Line, value, id); + setPointId(ui->comboBoxP1Line, p1Line, value, id); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/app/dialogs/tools/dialogshoulderpoint.h b/src/app/dialogs/tools/dialogshoulderpoint.h index 17afae0ad..99b4eea1e 100644 --- a/src/app/dialogs/tools/dialogshoulderpoint.h +++ b/src/app/dialogs/tools/dialogshoulderpoint.h @@ -69,15 +69,16 @@ public slots: /** * @brief DialogApply apply data and emit signal about applied dialog. */ - virtual void DialogApply(); + virtual void DialogApply(); /** * @brief DeployFormulaTextEdit grow or shrink formula input */ - void DeployFormulaTextEdit(); + void DeployFormulaTextEdit(); /** * @brief FormulaTextChanged when formula text changes for validation and calc */ - void FormulaTextChanged(); + void FormulaTextChanged(); + virtual void PointNameChanged(); private: Q_DISABLE_COPY(DialogShoulderPoint) diff --git a/src/app/dialogs/tools/dialogshoulderpoint.ui b/src/app/dialogs/tools/dialogshoulderpoint.ui index 583815972..c19369ab4 100644 --- a/src/app/dialogs/tools/dialogshoulderpoint.ui +++ b/src/app/dialogs/tools/dialogshoulderpoint.ui @@ -6,8 +6,8 @@ 0 0 - 473 - 686 + 512 + 674 @@ -189,7 +189,9 @@ - + + + @@ -268,9 +270,9 @@ - + - + 0 0 @@ -301,9 +303,9 @@ - + - + 0 0 @@ -334,7 +336,7 @@ - + 0