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

--HG--
branch : develop
This commit is contained in:
dismine 2014-07-14 18:57:12 +03:00
parent d4d55228a6
commit 9693d6d63e
3 changed files with 32 additions and 7 deletions

View File

@ -47,6 +47,10 @@ DialogSpline::DialogSpline(const VContainer *data, QWidget *parent)
FillComboBoxPoints(ui->comboBoxP1);
FillComboBoxPoints(ui->comboBoxP4);
connect(ui->comboBoxP1, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged),
this, &DialogSpline::PointNameChanged);
connect(ui->comboBoxP4, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged),
this, &DialogSpline::PointNameChanged);
}
//---------------------------------------------------------------------------------------------------------------------
@ -129,6 +133,28 @@ void DialogSpline::DialogAccepted()
emit DialogClosed(QDialog::Accepted);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogSpline::PointNameChanged()
{
QSet<quint32> 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);
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -73,6 +73,7 @@ public slots:
* @brief DialogApply apply data and emit signal about applied dialog.
*/
virtual void DialogApply(){}
virtual void PointNameChanged();
private:
Q_DISABLE_COPY(DialogSpline)

View File

@ -28,7 +28,7 @@
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label">
<widget class="QLabel" name="labelFirstPoint">
<property name="text">
<string>First point</string>
</property>
@ -91,7 +91,7 @@
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QLabel" name="label_5">
<widget class="QLabel" name="labelSecondPoint">
<property name="text">
<string>Second point</string>
</property>