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

--HG--
branch : develop
This commit is contained in:
dismine 2014-07-14 14:54:41 +03:00
parent 0e3da0d902
commit 0c6dc67090
3 changed files with 58 additions and 10 deletions

View file

@ -66,6 +66,12 @@ DialogBisector::DialogBisector(const VContainer *data, QWidget *parent)
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogBisector::NamePointChanged);
connect(ui->plainTextEditFormula, &QPlainTextEdit::textChanged, this, &DialogBisector::FormulaTextChanged);
connect(ui->pushButtonGrowLength, &QPushButton::clicked, this, &DialogBisector::DeployFormulaTextEdit);
connect(ui->comboBoxFirstPoint, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged),
this, &DialogBisector::PointChanged);
connect(ui->comboBoxSecondPoint, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged),
this, &DialogBisector::PointChanged);
connect(ui->comboBoxThirdPoint, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged),
this, &DialogBisector::PointChanged);
}
//---------------------------------------------------------------------------------------------------------------------
@ -74,6 +80,31 @@ void DialogBisector::FormulaTextChanged()
this->FormulaChangedPlainText();
}
//---------------------------------------------------------------------------------------------------------------------
void DialogBisector::PointChanged()
{
QSet<quint32> set;
set.insert(getCurrentObjectId(ui->comboBoxFirstPoint));
set.insert(getCurrentObjectId(ui->comboBoxSecondPoint));
set.insert(getCurrentObjectId(ui->comboBoxThirdPoint));
if (set.size() != 3)
{
flagError = false;
ChangeColor(ui->labelFirstPoint, Qt::red);
ChangeColor(ui->labelSecondPoint, Qt::red);
ChangeColor(ui->labelThirdPoint, Qt::red);
}
else
{
flagError = true;
ChangeColor(ui->labelFirstPoint, QColor(76, 76, 76));
ChangeColor(ui->labelSecondPoint, QColor(76, 76, 76));
ChangeColor(ui->labelThirdPoint, QColor(76, 76, 76));
}
CheckState();
}
//---------------------------------------------------------------------------------------------------------------------
void DialogBisector::DeployFormulaTextEdit()
{
@ -175,6 +206,18 @@ void DialogBisector::setFormula(const QString &value)
ui->plainTextEditFormula->setPlainText(formula);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogBisector::setPointId(QComboBox *box, quint32 &pointId, const quint32 &value, const quint32 &id)
{
disconnect(box, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged), this,
&DialogBisector::PointChanged);
setCurrentPointId(box, pointId, value, id);
connect(box, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged), this,
&DialogBisector::PointChanged);
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief setFirstPointId set id of first point
@ -183,7 +226,7 @@ void DialogBisector::setFormula(const QString &value)
*/
void DialogBisector::setFirstPointId(const quint32 &value, const quint32 &id)
{
setCurrentPointId(ui->comboBoxFirstPoint, firstPointId, value, id);
setPointId(ui->comboBoxFirstPoint, firstPointId, value, id);
}
//---------------------------------------------------------------------------------------------------------------------
@ -194,7 +237,7 @@ void DialogBisector::setFirstPointId(const quint32 &value, const quint32 &id)
*/
void DialogBisector::setSecondPointId(const quint32 &value, const quint32 &id)
{
setCurrentPointId(ui->comboBoxSecondPoint, secondPointId, value, id);
setPointId(ui->comboBoxSecondPoint, secondPointId, value, id);
}
//---------------------------------------------------------------------------------------------------------------------
@ -205,7 +248,7 @@ void DialogBisector::setSecondPointId(const quint32 &value, const quint32 &id)
*/
void DialogBisector::setThirdPointId(const quint32 &value, const quint32 &id)
{
setCurrentPointId(ui->comboBoxThirdPoint, thirdPointId, value, id);
setPointId(ui->comboBoxThirdPoint, thirdPointId, value, id);
}
//---------------------------------------------------------------------------------------------------------------------

View file

@ -70,15 +70,16 @@ public slots:
/**
* @brief DialogApply apply data and emit signal about applied dialog.
*/
virtual void DialogApply();
virtual void DialogApply();
/**
* @brief DeployFormulaTextEdit grow or shrink formula input
*/
void DeployFormulaTextEdit();
void DeployFormulaTextEdit();
/**
* @brief FormulaTextChanged when formula text changes for validation and calc
*/
void FormulaTextChanged();
virtual void PointChanged();
private:
Q_DISABLE_COPY(DialogBisector)
@ -107,12 +108,14 @@ private:
quint32 thirdPointId;
/** @brief formulaBaseHeight base height defined by dialogui */
int formulaBaseHeight;
int formulaBaseHeight;
/**
* @brief SaveData Put dialog data in local variables
*/
void SaveData();
private:
void setPointId(QComboBox *box, quint32 &pointId, const quint32 &value, const quint32 &id);
};
//---------------------------------------------------------------------------------------------------------------------

View file

@ -186,7 +186,9 @@
<string/>
</property>
<property name="icon">
<iconset theme="go-down"/>
<iconset theme="go-down">
<normaloff/>
</iconset>
</property>
<property name="iconSize">
<size>
@ -265,7 +267,7 @@
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="label_3">
<widget class="QLabel" name="labelFirstPoint">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
@ -289,7 +291,7 @@
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QLabel" name="label_5">
<widget class="QLabel" name="labelSecondPoint">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
@ -313,7 +315,7 @@
<item>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="QLabel" name="label_6">
<widget class="QLabel" name="labelThirdPoint">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>