diff --git a/src/app/dialogs/tools/dialogspline.cpp b/src/app/dialogs/tools/dialogspline.cpp index 2f4c3d0cc..bb971d035 100644 --- a/src/app/dialogs/tools/dialogspline.cpp +++ b/src/app/dialogs/tools/dialogspline.cpp @@ -47,6 +47,10 @@ DialogSpline::DialogSpline(const VContainer *data, QWidget *parent) FillComboBoxPoints(ui->comboBoxP1); FillComboBoxPoints(ui->comboBoxP4); + connect(ui->comboBoxP1, static_cast(&QComboBox::currentIndexChanged), + this, &DialogSpline::PointNameChanged); + connect(ui->comboBoxP4, static_cast(&QComboBox::currentIndexChanged), + this, &DialogSpline::PointNameChanged); } //--------------------------------------------------------------------------------------------------------------------- @@ -129,6 +133,28 @@ void DialogSpline::DialogAccepted() emit DialogClosed(QDialog::Accepted); } +//--------------------------------------------------------------------------------------------------------------------- +void DialogSpline::PointNameChanged() +{ + QSet set; + set.insert(getCurrentObjectId(ui->comboBoxP1)); + set.insert(getCurrentObjectId(ui->comboBoxP4)); + + if (getCurrentObjectId(ui->comboBoxP1) == getCurrentObjectId(ui->comboBoxP4)) + { + 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 setKCurve set coefficient curve @@ -191,8 +217,7 @@ void DialogSpline::setAngle1(const qreal &value) */ void DialogSpline::setP4(const quint32 &value) { - p4 = value; - ChangeCurrentData(ui->comboBoxP4, value); + setPointId(ui->comboBoxP4, p4, value, 0); } //--------------------------------------------------------------------------------------------------------------------- @@ -202,8 +227,7 @@ void DialogSpline::setP4(const quint32 &value) */ void DialogSpline::setP1(const quint32 &value) { - p1 = value; - ChangeCurrentData(ui->comboBoxP1, value); + setPointId(ui->comboBoxP1, p1, value, 0); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/app/dialogs/tools/dialogspline.h b/src/app/dialogs/tools/dialogspline.h index d90cd2990..28c99ea09 100644 --- a/src/app/dialogs/tools/dialogspline.h +++ b/src/app/dialogs/tools/dialogspline.h @@ -72,7 +72,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(DialogSpline) diff --git a/src/app/dialogs/tools/dialogspline.ui b/src/app/dialogs/tools/dialogspline.ui index 3ffcdae4d..721ffae3b 100644 --- a/src/app/dialogs/tools/dialogspline.ui +++ b/src/app/dialogs/tools/dialogspline.ui @@ -28,7 +28,7 @@ - + First point @@ -91,7 +91,7 @@ - + Second point