DialogHeight - check if names of points don't equal.

--HG--
branch : develop
This commit is contained in:
dismine 2014-07-14 15:57:16 +03:00
parent 0c6dc67090
commit f9283ed938
8 changed files with 62 additions and 31 deletions

View File

@ -67,11 +67,11 @@ DialogBisector::DialogBisector(const VContainer *data, QWidget *parent)
connect(ui->plainTextEditFormula, &QPlainTextEdit::textChanged, this, &DialogBisector::FormulaTextChanged); connect(ui->plainTextEditFormula, &QPlainTextEdit::textChanged, this, &DialogBisector::FormulaTextChanged);
connect(ui->pushButtonGrowLength, &QPushButton::clicked, this, &DialogBisector::DeployFormulaTextEdit); connect(ui->pushButtonGrowLength, &QPushButton::clicked, this, &DialogBisector::DeployFormulaTextEdit);
connect(ui->comboBoxFirstPoint, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged), connect(ui->comboBoxFirstPoint, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged),
this, &DialogBisector::PointChanged); this, &DialogBisector::PointNameChanged);
connect(ui->comboBoxSecondPoint, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged), connect(ui->comboBoxSecondPoint, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged),
this, &DialogBisector::PointChanged); this, &DialogBisector::PointNameChanged);
connect(ui->comboBoxThirdPoint, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged), connect(ui->comboBoxThirdPoint, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged),
this, &DialogBisector::PointChanged); this, &DialogBisector::PointNameChanged);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -81,7 +81,7 @@ void DialogBisector::FormulaTextChanged()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void DialogBisector::PointChanged() void DialogBisector::PointNameChanged()
{ {
QSet<quint32> set; QSet<quint32> set;
set.insert(getCurrentObjectId(ui->comboBoxFirstPoint)); set.insert(getCurrentObjectId(ui->comboBoxFirstPoint));
@ -206,18 +206,6 @@ void DialogBisector::setFormula(const QString &value)
ui->plainTextEditFormula->setPlainText(formula); ui->plainTextEditFormula->setPlainText(formula);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogBisector::setPointId(QComboBox *box, quint32 &pointId, const quint32 &value, const quint32 &id)
{
disconnect(box, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged), this,
&DialogBisector::PointChanged);
setCurrentPointId(box, pointId, value, id);
connect(box, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged), this,
&DialogBisector::PointChanged);
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**
* @brief setFirstPointId set id of first point * @brief setFirstPointId set id of first point

View File

@ -78,8 +78,8 @@ public slots:
/** /**
* @brief FormulaTextChanged when formula text changes for validation and calc * @brief FormulaTextChanged when formula text changes for validation and calc
*/ */
void FormulaTextChanged(); void FormulaTextChanged();
virtual void PointChanged(); virtual void PointNameChanged();
private: private:
Q_DISABLE_COPY(DialogBisector) Q_DISABLE_COPY(DialogBisector)
@ -114,8 +114,6 @@ private:
* @brief SaveData Put dialog data in local variables * @brief SaveData Put dialog data in local variables
*/ */
void SaveData(); void SaveData();
private:
void setPointId(QComboBox *box, quint32 &pointId, const quint32 &value, const quint32 &id);
}; };
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -53,6 +53,13 @@ DialogHeight::DialogHeight(const VContainer *data, QWidget *parent)
FillComboBoxPoints(ui->comboBoxP2Line); FillComboBoxPoints(ui->comboBoxP2Line);
FillComboBoxTypeLine(ui->comboBoxLineType); FillComboBoxTypeLine(ui->comboBoxLineType);
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogHeight::NamePointChanged); connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogHeight::NamePointChanged);
connect(ui->comboBoxBasePoint, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged),
this, &DialogHeight::PointNameChanged);
connect(ui->comboBoxP1Line, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged),
this, &DialogHeight::PointNameChanged);
connect(ui->comboBoxP2Line, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged),
this, &DialogHeight::PointNameChanged);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -91,8 +98,7 @@ void DialogHeight::setTypeLine(const QString &value)
*/ */
void DialogHeight::setBasePointId(const quint32 &value, const quint32 &id) void DialogHeight::setBasePointId(const quint32 &value, const quint32 &id)
{ {
basePointId = value; setPointId(ui->comboBoxBasePoint, basePointId, value, id);
setCurrentPointId(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) void DialogHeight::setP1LineId(const quint32 &value, const quint32 &id)
{ {
p1LineId = value; setPointId(ui->comboBoxP1Line, p1LineId, value, id);
setCurrentPointId(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) void DialogHeight::setP2LineId(const quint32 &value, const quint32 &id)
{ {
p2LineId = value; setPointId(ui->comboBoxP2Line, p2LineId, value, id);
setCurrentPointId(ui->comboBoxP2Line, p2LineId, value, id);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -171,3 +175,28 @@ void DialogHeight::DialogAccepted()
p2LineId = getCurrentObjectId(ui->comboBoxP2Line); p2LineId = getCurrentObjectId(ui->comboBoxP2Line);
emit DialogClosed(QDialog::Accepted); emit DialogClosed(QDialog::Accepted);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogHeight::PointNameChanged()
{
QSet<quint32> 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();
}

View File

@ -66,7 +66,8 @@ public slots:
/** TODO ISSUE 79 : create real function /** TODO ISSUE 79 : create real function
* @brief DialogApply apply data and emit signal about applied dialog. * @brief DialogApply apply data and emit signal about applied dialog.
*/ */
virtual void DialogApply(){} virtual void DialogApply(){}
virtual void PointNameChanged();
private: private:
Q_DISABLE_COPY(DialogHeight) Q_DISABLE_COPY(DialogHeight)

View File

@ -81,7 +81,7 @@
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_3"> <layout class="QHBoxLayout" name="horizontalLayout_3">
<item> <item>
<widget class="QLabel" name="label_3"> <widget class="QLabel" name="labelBasePoint">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@ -105,7 +105,7 @@
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_5"> <layout class="QHBoxLayout" name="horizontalLayout_5">
<item> <item>
<widget class="QLabel" name="label_4"> <widget class="QLabel" name="labelFirstLinePoint">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@ -129,7 +129,7 @@
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_6"> <layout class="QHBoxLayout" name="horizontalLayout_6">
<item> <item>
<widget class="QLabel" name="label_5"> <widget class="QLabel" name="labelSecondLinePoint">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>

View File

@ -55,7 +55,7 @@ public slots:
/** TODO ISSUE 79 : create real function /** TODO ISSUE 79 : create real function
* @brief DialogApply apply data and emit signal about applied dialog. * @brief DialogApply apply data and emit signal about applied dialog.
*/ */
virtual void DialogApply(){} virtual void DialogApply(){}
void PointChanged(int row); void PointChanged(int row);
void currentPointChanged( int index ); void currentPointChanged( int index );
void Angle1Changed(qreal index ); void Angle1Changed(qreal index );

View File

@ -684,6 +684,19 @@ void DialogTool::ChangeColor(QWidget *widget, const QColor &color)
widget->setPalette(palette); widget->setPalette(palette);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::setPointId(QComboBox *box, quint32 &pointId, const quint32 &value, const quint32 &id)
{
SCASSERT(box != nullptr);
disconnect(box, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged), this,
&DialogTool::PointNameChanged);
setCurrentPointId(box, pointId, value, id);
connect(box, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged), this,
&DialogTool::PointNameChanged);
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**
* @brief DialogAccepted save data and emit signal about closed dialog. * @brief DialogAccepted save data and emit signal about closed dialog.

View File

@ -107,6 +107,7 @@ public slots:
void PutVal(QListWidgetItem * item); void PutVal(QListWidgetItem * item);
virtual void ValChenged(int row); virtual void ValChenged(int row);
void UpdateList(); void UpdateList();
virtual void PointNameChanged(){}
protected: protected:
Q_DISABLE_COPY(DialogTool) Q_DISABLE_COPY(DialogTool)
@ -300,6 +301,7 @@ protected:
*/ */
VAbstractTool* associatedTool; VAbstractTool* associatedTool;
void ChangeColor(QWidget *widget, const QColor &color); void ChangeColor(QWidget *widget, const QColor &color);
void setPointId(QComboBox *box, quint32 &pointId, const quint32 &value, const quint32 &id);
private: private:
void FillList(QComboBox *box, const QMap<QString, quint32> &list)const; void FillList(QComboBox *box, const QMap<QString, quint32> &list)const;
}; };