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); FillComboBoxPoints(ui->comboBoxSecondPoint);
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogTriangle::NamePointChanged); 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); 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 * @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) void DialogTriangle::setSecondPointId(const quint32 &value, const quint32 &id)
{ {
secondPointId = value; setPointId(ui->comboBoxSecondPoint, secondPointId, value, id);
setCurrentPointId(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) void DialogTriangle::setFirstPointId(const quint32 &value, const quint32 &id)
{ {
firstPointId = value; setPointId(ui->comboBoxFirstPoint, firstPointId, value, id);
setCurrentPointId(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) void DialogTriangle::setAxisP2Id(const quint32 &value, const quint32 &id)
{ {
axisP2Id = value; setPointId(ui->comboBoxAxisP2, axisP2Id, value, id);
setCurrentPointId(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) void DialogTriangle::setAxisP1Id(const quint32 &value, const quint32 &id)
{ {
axisP1Id = value; setPointId(ui->comboBoxAxisP1, axisP1Id, value, id);
setCurrentPointId(ui->comboBoxAxisP1, axisP1Id, value, id);
} }

View File

@ -67,6 +67,7 @@ public slots:
* @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(DialogTriangle) Q_DISABLE_COPY(DialogTriangle)

View File

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