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

--HG--
branch : develop
This commit is contained in:
dismine 2014-07-14 19:12:51 +03:00
parent 9693d6d63e
commit 84050f042b
3 changed files with 46 additions and 13 deletions

View File

@ -54,6 +54,14 @@ DialogTriangle::DialogTriangle(const VContainer *data, QWidget *parent)
FillComboBoxPoints(ui->comboBoxSecondPoint);
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogTriangle::NamePointChanged);
connect(ui->comboBoxFirstPoint, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged),
this, &DialogTriangle::PointNameChanged);
connect(ui->comboBoxSecondPoint, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged),
this, &DialogTriangle::PointNameChanged);
connect(ui->comboBoxAxisP1, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged),
this, &DialogTriangle::PointNameChanged);
connect(ui->comboBoxAxisP2, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged),
this, &DialogTriangle::PointNameChanged);
}
//---------------------------------------------------------------------------------------------------------------------
@ -120,6 +128,34 @@ void DialogTriangle::DialogAccepted()
emit DialogClosed(QDialog::Accepted);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogTriangle::PointNameChanged()
{
QSet<quint32> set;
set.insert(getCurrentObjectId(ui->comboBoxFirstPoint));
set.insert(getCurrentObjectId(ui->comboBoxSecondPoint));
set.insert(getCurrentObjectId(ui->comboBoxAxisP1));
set.insert(getCurrentObjectId(ui->comboBoxAxisP2));
if (set.size() != 4)
{
flagError = false;
ChangeColor(ui->labelFirstPoint, Qt::red);
ChangeColor(ui->labelSecondPoint, Qt::red);
ChangeColor(ui->labelAxisP1, Qt::red);
ChangeColor(ui->labelAxisP2, Qt::red);
}
else
{
flagError = true;
ChangeColor(ui->labelFirstPoint, QColor(76, 76, 76));
ChangeColor(ui->labelSecondPoint, QColor(76, 76, 76));
ChangeColor(ui->labelAxisP1, QColor(76, 76, 76));
ChangeColor(ui->labelAxisP2, QColor(76, 76, 76));
}
CheckState();
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief setPointName set name of point
@ -139,8 +175,7 @@ void DialogTriangle::setPointName(const QString &value)
*/
void DialogTriangle::setSecondPointId(const quint32 &value, const quint32 &id)
{
secondPointId = value;
setCurrentPointId(ui->comboBoxSecondPoint, secondPointId, value, id);
setPointId(ui->comboBoxSecondPoint, secondPointId, value, id);
}
//---------------------------------------------------------------------------------------------------------------------
@ -151,8 +186,7 @@ void DialogTriangle::setSecondPointId(const quint32 &value, const quint32 &id)
*/
void DialogTriangle::setFirstPointId(const quint32 &value, const quint32 &id)
{
firstPointId = value;
setCurrentPointId(ui->comboBoxFirstPoint, firstPointId, value, id);
setPointId(ui->comboBoxFirstPoint, firstPointId, value, id);
}
//---------------------------------------------------------------------------------------------------------------------
@ -163,8 +197,7 @@ void DialogTriangle::setFirstPointId(const quint32 &value, const quint32 &id)
*/
void DialogTriangle::setAxisP2Id(const quint32 &value, const quint32 &id)
{
axisP2Id = value;
setCurrentPointId(ui->comboBoxAxisP2, axisP2Id, value, id);
setPointId(ui->comboBoxAxisP2, axisP2Id, value, id);
}
//---------------------------------------------------------------------------------------------------------------------
@ -175,6 +208,5 @@ void DialogTriangle::setAxisP2Id(const quint32 &value, const quint32 &id)
*/
void DialogTriangle::setAxisP1Id(const quint32 &value, const quint32 &id)
{
axisP1Id = value;
setCurrentPointId(ui->comboBoxAxisP1, axisP1Id, value, id);
setPointId(ui->comboBoxAxisP1, axisP1Id, value, id);
}

View File

@ -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(DialogTriangle)

View File

@ -81,7 +81,7 @@
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QLabel" name="label_4">
<widget class="QLabel" name="labelAxisP1">
<property name="text">
<string>First point of axis</string>
</property>
@ -99,7 +99,7 @@
<item>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="QLabel" name="label_5">
<widget class="QLabel" name="labelAxisP2">
<property name="text">
<string>Second point of axis</string>
</property>
@ -117,7 +117,7 @@
<item>
<layout class="QHBoxLayout" name="horizontalLayout_7">
<item>
<widget class="QLabel" name="label_6">
<widget class="QLabel" name="labelFirstPoint">
<property name="text">
<string>First point</string>
</property>
@ -135,7 +135,7 @@
<item>
<layout class="QHBoxLayout" name="horizontalLayout_8">
<item>
<widget class="QLabel" name="label_7">
<widget class="QLabel" name="labelSecondPoint">
<property name="text">
<string>Second point</string>
</property>