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

--HG--
branch : develop
This commit is contained in:
dismine 2014-07-14 16:33:03 +03:00
parent f9283ed938
commit c090325875
3 changed files with 29 additions and 17 deletions

View file

@ -49,6 +49,11 @@ DialogLine::DialogLine(const VContainer *data, QWidget *parent)
FillComboBoxTypeLine(ui->comboBoxLineType);
number = 0;
connect(ui->comboBoxFirstPoint, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged),
this, &DialogLine::PointNameChanged);
connect(ui->comboBoxSecondPoint, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged),
this, &DialogLine::PointNameChanged);
}
//---------------------------------------------------------------------------------------------------------------------
@ -64,13 +69,7 @@ DialogLine::~DialogLine()
*/
void DialogLine::setSecondPoint(const quint32 &value)
{
secondPoint = value;
const VPointF *point = data->GeometricObject<const VPointF *>(value);
qint32 index = ui->comboBoxSecondPoint->findText(point->name());
if (index != -1)
{
ui->comboBoxSecondPoint->setCurrentIndex(index);
}
setPointId(ui->comboBoxSecondPoint, secondPoint, value, 0);
}
//---------------------------------------------------------------------------------------------------------------------
@ -91,13 +90,7 @@ void DialogLine::setTypeLine(const QString &value)
*/
void DialogLine::setFirstPoint(const quint32 &value)
{
firstPoint = value;
const VPointF *point = data->GeometricObject<const VPointF *>(value);
qint32 index = ui->comboBoxFirstPoint->findText(point->name());
if (index != -1)
{
ui->comboBoxFirstPoint->setCurrentIndex(index);
}
setPointId(ui->comboBoxFirstPoint, firstPoint, value, 0);
}
//---------------------------------------------------------------------------------------------------------------------
@ -115,6 +108,24 @@ void DialogLine::DialogAccepted()
DialogClosed(QDialog::Accepted);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogLine::PointNameChanged()
{
if (getCurrentObjectId(ui->comboBoxFirstPoint) == getCurrentObjectId(ui->comboBoxSecondPoint))
{
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 ChoosedObject gets id and type of selected object. Save right data and ignore wrong.

View file

@ -60,7 +60,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(DialogLine)

View file

@ -39,7 +39,7 @@
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label">
<widget class="QLabel" name="labelFirstPoint">
<property name="minimumSize">
<size>
<width>90</width>
@ -72,7 +72,7 @@
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label_2">
<widget class="QLabel" name="labelSecondPoint">
<property name="minimumSize">
<size>
<width>90</width>