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->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogBisector::NamePointChanged);
connect(ui->plainTextEditFormula, &QPlainTextEdit::textChanged, this, &DialogBisector::FormulaTextChanged); connect(ui->plainTextEditFormula, &QPlainTextEdit::textChanged, this, &DialogBisector::FormulaTextChanged);
connect(ui->pushButtonGrowLength, &QPushButton::clicked, this, &DialogBisector::DeployFormulaTextEdit); 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(); 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() void DialogBisector::DeployFormulaTextEdit()
{ {
@ -175,6 +206,18 @@ void DialogBisector::setFormula(const QString &value)
ui->plainTextEditFormula->setPlainText(formula); 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 * @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) 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) 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) 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. * @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 PointChanged();
private: private:
Q_DISABLE_COPY(DialogBisector) Q_DISABLE_COPY(DialogBisector)
@ -107,12 +108,14 @@ private:
quint32 thirdPointId; quint32 thirdPointId;
/** @brief formulaBaseHeight base height defined by dialogui */ /** @brief formulaBaseHeight base height defined by dialogui */
int formulaBaseHeight; int formulaBaseHeight;
/** /**
* @brief SaveData Put dialog data in local variables * @brief SaveData Put dialog data in local variables
*/ */
void SaveData(); void SaveData();
private:
void setPointId(QComboBox *box, quint32 &pointId, const quint32 &value, const quint32 &id);
}; };
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -186,7 +186,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>
@ -265,7 +267,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>
@ -289,7 +291,7 @@
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_5"> <layout class="QHBoxLayout" name="horizontalLayout_5">
<item> <item>
<widget class="QLabel" name="label_5"> <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>
@ -313,7 +315,7 @@
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_6"> <layout class="QHBoxLayout" name="horizontalLayout_6">
<item> <item>
<widget class="QLabel" name="label_6"> <widget class="QLabel" name="labelThirdPoint">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>