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

--HG--
branch : develop
This commit is contained in:
dismine 2014-07-14 18:07:56 +03:00
parent efd6760e30
commit 6c72dfabb4
3 changed files with 31 additions and 7 deletions

View File

@ -62,6 +62,10 @@ DialogNormal::DialogNormal(const VContainer *data, QWidget *parent)
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogNormal::NamePointChanged); connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogNormal::NamePointChanged);
connect(ui->plainTextEditFormula, &QPlainTextEdit::textChanged, this, &DialogNormal::FormulaTextChanged); connect(ui->plainTextEditFormula, &QPlainTextEdit::textChanged, this, &DialogNormal::FormulaTextChanged);
connect(ui->pushButtonGrowLength, &QPushButton::clicked, this, &DialogNormal::DeployFormulaTextEdit); connect(ui->pushButtonGrowLength, &QPushButton::clicked, this, &DialogNormal::DeployFormulaTextEdit);
connect(ui->comboBoxFirstPoint, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged),
this, &DialogNormal::PointNameChanged);
connect(ui->comboBoxSecondPoint, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged),
this, &DialogNormal::PointNameChanged);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -70,6 +74,25 @@ void DialogNormal::FormulaTextChanged()
this->FormulaChangedPlainText(); this->FormulaChangedPlainText();
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogNormal::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();
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void DialogNormal::DeployFormulaTextEdit() void DialogNormal::DeployFormulaTextEdit()
{ {
@ -151,7 +174,7 @@ void DialogNormal::SaveData()
*/ */
void DialogNormal::setSecondPointId(const quint32 &value, const quint32 &id) void DialogNormal::setSecondPointId(const quint32 &value, const quint32 &id)
{ {
setCurrentPointId(ui->comboBoxSecondPoint, secondPointId, value, id); setPointId(ui->comboBoxSecondPoint, secondPointId, value, id);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -162,7 +185,7 @@ void DialogNormal::setSecondPointId(const quint32 &value, const quint32 &id)
*/ */
void DialogNormal::setFirstPointId(const quint32 &value, const quint32 &id) void DialogNormal::setFirstPointId(const quint32 &value, const quint32 &id)
{ {
setCurrentPointId(ui->comboBoxFirstPoint, firstPointId, value, id); setPointId(ui->comboBoxFirstPoint, firstPointId, value, id);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -69,15 +69,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(DialogNormal) Q_DISABLE_COPY(DialogNormal)

View File

@ -270,7 +270,7 @@
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_3"> <layout class="QHBoxLayout" name="horizontalLayout_3">
<item> <item>
<widget class="QLabel" name="label_3"> <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>
@ -290,7 +290,7 @@
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_8"> <layout class="QHBoxLayout" name="horizontalLayout_8">
<item> <item>
<widget class="QLabel" name="label_6"> <widget class="QLabel" name="labelSecondPoint">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>