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); FillComboBoxTypeLine(ui->comboBoxLineType);
number = 0; 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) void DialogLine::setSecondPoint(const quint32 &value)
{ {
secondPoint = value; setPointId(ui->comboBoxSecondPoint, secondPoint, value, 0);
const VPointF *point = data->GeometricObject<const VPointF *>(value);
qint32 index = ui->comboBoxSecondPoint->findText(point->name());
if (index != -1)
{
ui->comboBoxSecondPoint->setCurrentIndex(index);
}
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -91,13 +90,7 @@ void DialogLine::setTypeLine(const QString &value)
*/ */
void DialogLine::setFirstPoint(const quint32 &value) void DialogLine::setFirstPoint(const quint32 &value)
{ {
firstPoint = value; setPointId(ui->comboBoxFirstPoint, firstPoint, value, 0);
const VPointF *point = data->GeometricObject<const VPointF *>(value);
qint32 index = ui->comboBoxFirstPoint->findText(point->name());
if (index != -1)
{
ui->comboBoxFirstPoint->setCurrentIndex(index);
}
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -115,6 +108,24 @@ void DialogLine::DialogAccepted()
DialogClosed(QDialog::Accepted); 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. * @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 /** 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(DialogLine) Q_DISABLE_COPY(DialogLine)

View File

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