diff --git a/src/app/dialogs/tools/dialogbisector.cpp b/src/app/dialogs/tools/dialogbisector.cpp index bd0942f06..928bd3b3c 100644 --- a/src/app/dialogs/tools/dialogbisector.cpp +++ b/src/app/dialogs/tools/dialogbisector.cpp @@ -67,11 +67,11 @@ DialogBisector::DialogBisector(const VContainer *data, QWidget *parent) connect(ui->plainTextEditFormula, &QPlainTextEdit::textChanged, this, &DialogBisector::FormulaTextChanged); connect(ui->pushButtonGrowLength, &QPushButton::clicked, this, &DialogBisector::DeployFormulaTextEdit); connect(ui->comboBoxFirstPoint, static_cast(&QComboBox::currentIndexChanged), - this, &DialogBisector::PointChanged); + this, &DialogBisector::PointNameChanged); connect(ui->comboBoxSecondPoint, static_cast(&QComboBox::currentIndexChanged), - this, &DialogBisector::PointChanged); + this, &DialogBisector::PointNameChanged); connect(ui->comboBoxThirdPoint, static_cast(&QComboBox::currentIndexChanged), - this, &DialogBisector::PointChanged); + this, &DialogBisector::PointNameChanged); } //--------------------------------------------------------------------------------------------------------------------- @@ -81,7 +81,7 @@ void DialogBisector::FormulaTextChanged() } //--------------------------------------------------------------------------------------------------------------------- -void DialogBisector::PointChanged() +void DialogBisector::PointNameChanged() { QSet set; set.insert(getCurrentObjectId(ui->comboBoxFirstPoint)); @@ -206,18 +206,6 @@ void DialogBisector::setFormula(const QString &value) ui->plainTextEditFormula->setPlainText(formula); } -//--------------------------------------------------------------------------------------------------------------------- -void DialogBisector::setPointId(QComboBox *box, quint32 &pointId, const quint32 &value, const quint32 &id) -{ - disconnect(box, static_cast(&QComboBox::currentIndexChanged), this, - &DialogBisector::PointChanged); - - setCurrentPointId(box, pointId, value, id); - - connect(box, static_cast(&QComboBox::currentIndexChanged), this, - &DialogBisector::PointChanged); -} - //--------------------------------------------------------------------------------------------------------------------- /** * @brief setFirstPointId set id of first point diff --git a/src/app/dialogs/tools/dialogbisector.h b/src/app/dialogs/tools/dialogbisector.h index 96a177aa6..110e7fdbc 100644 --- a/src/app/dialogs/tools/dialogbisector.h +++ b/src/app/dialogs/tools/dialogbisector.h @@ -78,8 +78,8 @@ public slots: /** * @brief FormulaTextChanged when formula text changes for validation and calc */ - void FormulaTextChanged(); - virtual void PointChanged(); + void FormulaTextChanged(); + virtual void PointNameChanged(); private: Q_DISABLE_COPY(DialogBisector) @@ -114,8 +114,6 @@ private: * @brief SaveData Put dialog data in local variables */ void SaveData(); -private: - void setPointId(QComboBox *box, quint32 &pointId, const quint32 &value, const quint32 &id); }; //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/app/dialogs/tools/dialogheight.cpp b/src/app/dialogs/tools/dialogheight.cpp index a7d11d655..4fc9815a1 100644 --- a/src/app/dialogs/tools/dialogheight.cpp +++ b/src/app/dialogs/tools/dialogheight.cpp @@ -53,6 +53,13 @@ DialogHeight::DialogHeight(const VContainer *data, QWidget *parent) FillComboBoxPoints(ui->comboBoxP2Line); FillComboBoxTypeLine(ui->comboBoxLineType); connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogHeight::NamePointChanged); + connect(ui->comboBoxBasePoint, static_cast(&QComboBox::currentIndexChanged), + this, &DialogHeight::PointNameChanged); + connect(ui->comboBoxP1Line, static_cast(&QComboBox::currentIndexChanged), + this, &DialogHeight::PointNameChanged); + connect(ui->comboBoxP2Line, static_cast(&QComboBox::currentIndexChanged), + this, &DialogHeight::PointNameChanged); + } //--------------------------------------------------------------------------------------------------------------------- @@ -91,8 +98,7 @@ void DialogHeight::setTypeLine(const QString &value) */ void DialogHeight::setBasePointId(const quint32 &value, const quint32 &id) { - basePointId = value; - setCurrentPointId(ui->comboBoxBasePoint, basePointId, value, id); + setPointId(ui->comboBoxBasePoint, basePointId, value, id); } //--------------------------------------------------------------------------------------------------------------------- @@ -103,8 +109,7 @@ void DialogHeight::setBasePointId(const quint32 &value, const quint32 &id) */ void DialogHeight::setP1LineId(const quint32 &value, const quint32 &id) { - p1LineId = value; - setCurrentPointId(ui->comboBoxP1Line, p1LineId, value, id); + setPointId(ui->comboBoxP1Line, p1LineId, value, id); } //--------------------------------------------------------------------------------------------------------------------- @@ -115,8 +120,7 @@ void DialogHeight::setP1LineId(const quint32 &value, const quint32 &id) */ void DialogHeight::setP2LineId(const quint32 &value, const quint32 &id) { - p2LineId = value; - setCurrentPointId(ui->comboBoxP2Line, p2LineId, value, id); + setPointId(ui->comboBoxP2Line, p2LineId, value, id); } //--------------------------------------------------------------------------------------------------------------------- @@ -171,3 +175,28 @@ void DialogHeight::DialogAccepted() p2LineId = getCurrentObjectId(ui->comboBoxP2Line); emit DialogClosed(QDialog::Accepted); } + +//--------------------------------------------------------------------------------------------------------------------- +void DialogHeight::PointNameChanged() +{ + QSet set; + set.insert(getCurrentObjectId(ui->comboBoxBasePoint)); + set.insert(getCurrentObjectId(ui->comboBoxP1Line)); + set.insert(getCurrentObjectId(ui->comboBoxP2Line)); + + if (set.size() != 3) + { + flagError = false; + ChangeColor(ui->labelBasePoint, Qt::red); + ChangeColor(ui->labelFirstLinePoint, Qt::red); + ChangeColor(ui->labelSecondLinePoint, Qt::red); + } + else + { + flagError = true; + ChangeColor(ui->labelBasePoint, QColor(76, 76, 76)); + ChangeColor(ui->labelFirstLinePoint, QColor(76, 76, 76)); + ChangeColor(ui->labelSecondLinePoint, QColor(76, 76, 76)); + } + CheckState(); +} diff --git a/src/app/dialogs/tools/dialogheight.h b/src/app/dialogs/tools/dialogheight.h index 15a814a79..1a42b24b9 100644 --- a/src/app/dialogs/tools/dialogheight.h +++ b/src/app/dialogs/tools/dialogheight.h @@ -66,7 +66,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(DialogHeight) diff --git a/src/app/dialogs/tools/dialogheight.ui b/src/app/dialogs/tools/dialogheight.ui index a9c599d32..fc6ba114b 100644 --- a/src/app/dialogs/tools/dialogheight.ui +++ b/src/app/dialogs/tools/dialogheight.ui @@ -81,7 +81,7 @@ - + 0 @@ -105,7 +105,7 @@ - + 0 @@ -129,7 +129,7 @@ - + 0 diff --git a/src/app/dialogs/tools/dialogsplinepath.h b/src/app/dialogs/tools/dialogsplinepath.h index 631ce5478..fce0dcdae 100644 --- a/src/app/dialogs/tools/dialogsplinepath.h +++ b/src/app/dialogs/tools/dialogsplinepath.h @@ -55,7 +55,7 @@ public slots: /** TODO ISSUE 79 : create real function * @brief DialogApply apply data and emit signal about applied dialog. */ - virtual void DialogApply(){} + virtual void DialogApply(){} void PointChanged(int row); void currentPointChanged( int index ); void Angle1Changed(qreal index ); diff --git a/src/app/dialogs/tools/dialogtool.cpp b/src/app/dialogs/tools/dialogtool.cpp index 661e4db12..36047e1ab 100644 --- a/src/app/dialogs/tools/dialogtool.cpp +++ b/src/app/dialogs/tools/dialogtool.cpp @@ -684,6 +684,19 @@ void DialogTool::ChangeColor(QWidget *widget, const QColor &color) widget->setPalette(palette); } +//--------------------------------------------------------------------------------------------------------------------- +void DialogTool::setPointId(QComboBox *box, quint32 &pointId, const quint32 &value, const quint32 &id) +{ + SCASSERT(box != nullptr); + disconnect(box, static_cast(&QComboBox::currentIndexChanged), this, + &DialogTool::PointNameChanged); + + setCurrentPointId(box, pointId, value, id); + + connect(box, static_cast(&QComboBox::currentIndexChanged), this, + &DialogTool::PointNameChanged); +} + //--------------------------------------------------------------------------------------------------------------------- /** * @brief DialogAccepted save data and emit signal about closed dialog. diff --git a/src/app/dialogs/tools/dialogtool.h b/src/app/dialogs/tools/dialogtool.h index 737418c6d..a15088924 100644 --- a/src/app/dialogs/tools/dialogtool.h +++ b/src/app/dialogs/tools/dialogtool.h @@ -107,6 +107,7 @@ public slots: void PutVal(QListWidgetItem * item); virtual void ValChenged(int row); void UpdateList(); + virtual void PointNameChanged(){} protected: Q_DISABLE_COPY(DialogTool) @@ -300,6 +301,7 @@ protected: */ VAbstractTool* associatedTool; void ChangeColor(QWidget *widget, const QColor &color); + void setPointId(QComboBox *box, quint32 &pointId, const quint32 &value, const quint32 &id); private: void FillList(QComboBox *box, const QMap &list)const; };