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

--HG--
branch : develop
This commit is contained in:
dismine 2014-07-14 18:15:55 +03:00
parent 6c72dfabb4
commit 3f50c316de
3 changed files with 44 additions and 11 deletions

View file

@ -79,6 +79,12 @@ DialogPointOfContact::DialogPointOfContact(const VContainer *data, QWidget *pare
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogPointOfContact::NamePointChanged); connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogPointOfContact::NamePointChanged);
connect(ui->plainTextEditFormula, &QPlainTextEdit::textChanged, this, &DialogPointOfContact::FormulaTextChanged); connect(ui->plainTextEditFormula, &QPlainTextEdit::textChanged, this, &DialogPointOfContact::FormulaTextChanged);
connect(ui->pushButtonGrowLength, &QPushButton::clicked, this, &DialogPointOfContact::DeployFormulaTextEdit); connect(ui->pushButtonGrowLength, &QPushButton::clicked, this, &DialogPointOfContact::DeployFormulaTextEdit);
connect(ui->comboBoxFirstPoint, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged),
this, &DialogPointOfContact::PointNameChanged);
connect(ui->comboBoxSecondPoint, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged),
this, &DialogPointOfContact::PointNameChanged);
connect(ui->comboBoxCenter, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged),
this, &DialogPointOfContact::PointNameChanged);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -87,6 +93,31 @@ void DialogPointOfContact::FormulaTextChanged()
this->FormulaChangedPlainText(); this->FormulaChangedPlainText();
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogPointOfContact::PointNameChanged()
{
QSet<quint32> set;
set.insert(getCurrentObjectId(ui->comboBoxFirstPoint));
set.insert(getCurrentObjectId(ui->comboBoxSecondPoint));
set.insert(getCurrentObjectId(ui->comboBoxCenter));
if (set.size() != 3)
{
flagError = false;
ChangeColor(ui->labelFirstPoint, Qt::red);
ChangeColor(ui->labelSecondPoint, Qt::red);
ChangeColor(ui->labelArcCenter, Qt::red);
}
else
{
flagError = true;
ChangeColor(ui->labelFirstPoint, QColor(76, 76, 76));
ChangeColor(ui->labelSecondPoint, QColor(76, 76, 76));
ChangeColor(ui->labelArcCenter, QColor(76, 76, 76));
}
CheckState();
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void DialogPointOfContact::DeployFormulaTextEdit() void DialogPointOfContact::DeployFormulaTextEdit()
{ {
@ -179,7 +210,7 @@ void DialogPointOfContact::SaveData()
*/ */
void DialogPointOfContact::setSecondPoint(const quint32 &value, const quint32 &id) void DialogPointOfContact::setSecondPoint(const quint32 &value, const quint32 &id)
{ {
setCurrentPointId(ui->comboBoxSecondPoint, secondPoint, value, id); setPointId(ui->comboBoxSecondPoint, secondPoint, value, id);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -190,7 +221,7 @@ void DialogPointOfContact::setSecondPoint(const quint32 &value, const quint32 &i
*/ */
void DialogPointOfContact::setFirstPoint(const quint32 &value, const quint32 &id) void DialogPointOfContact::setFirstPoint(const quint32 &value, const quint32 &id)
{ {
setCurrentPointId(ui->comboBoxFirstPoint, firstPoint, value, id); setPointId(ui->comboBoxFirstPoint, firstPoint, value, id);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -201,8 +232,7 @@ void DialogPointOfContact::setFirstPoint(const quint32 &value, const quint32 &id
*/ */
void DialogPointOfContact::setCenter(const quint32 &value, const quint32 &id) void DialogPointOfContact::setCenter(const quint32 &value, const quint32 &id)
{ {
setCurrentPointId(ui->comboBoxCenter, center, value, id); setPointId(ui->comboBoxCenter, center, value, id);
center = value;
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View file

@ -65,15 +65,16 @@ 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();
/** /**
* @brief DeployFormulaTextEdit grow or shrink formula input * @brief DeployFormulaTextEdit grow or shrink formula input
*/ */
void DeployFormulaTextEdit(); void DeployFormulaTextEdit();
/** /**
* @brief FormulaTextChanged when formula text changes for validation and calc * @brief FormulaTextChanged when formula text changes for validation and calc
*/ */
void FormulaTextChanged(); void FormulaTextChanged();
virtual void PointNameChanged();
private: private:
Q_DISABLE_COPY(DialogPointOfContact) Q_DISABLE_COPY(DialogPointOfContact)

View file

@ -189,7 +189,9 @@
<string/> <string/>
</property> </property>
<property name="icon"> <property name="icon">
<iconset theme="go-down"/> <iconset theme="go-down">
<normaloff/>
</iconset>
</property> </property>
<property name="iconSize"> <property name="iconSize">
<size> <size>
@ -268,7 +270,7 @@
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_4"> <layout class="QHBoxLayout" name="horizontalLayout_4">
<item> <item>
<widget class="QLabel" name="label_3"> <widget class="QLabel" name="labelArcCenter">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@ -304,7 +306,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="labelFirstPoint">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@ -337,7 +339,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="labelSecondPoint">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred"> <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch> <horstretch>0</horstretch>