DialogShoulderPoint, DialogPointOfIntersection - check if names of points don't

equal.

--HG--
branch : develop
This commit is contained in:
dismine 2014-07-14 18:32:00 +03:00
parent 3f50c316de
commit d4d55228a6
6 changed files with 76 additions and 21 deletions

View file

@ -53,6 +53,10 @@ DialogPointOfIntersection::DialogPointOfIntersection(const VContainer *data, QWi
FillComboBoxPoints(ui->comboBoxSecondPoint);
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogPointOfIntersection::NamePointChanged);
connect(ui->comboBoxFirstPoint, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged),
this, &DialogPointOfIntersection::PointNameChanged);
connect(ui->comboBoxSecondPoint, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged),
this, &DialogPointOfIntersection::PointNameChanged);
}
//---------------------------------------------------------------------------------------------------------------------
@ -69,8 +73,7 @@ DialogPointOfIntersection::~DialogPointOfIntersection()
*/
void DialogPointOfIntersection::setSecondPointId(const quint32 &value, const quint32 &id)
{
secondPointId = value;
setCurrentPointId(ui->comboBoxSecondPoint, secondPointId, value, id);
setPointId(ui->comboBoxSecondPoint, secondPointId, value, id);
}
//---------------------------------------------------------------------------------------------------------------------
@ -125,6 +128,24 @@ void DialogPointOfIntersection::DialogAccepted()
emit DialogClosed(QDialog::Accepted);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogPointOfIntersection::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 setFirstPointId set id of first point
@ -133,8 +154,7 @@ void DialogPointOfIntersection::DialogAccepted()
*/
void DialogPointOfIntersection::setFirstPointId(const quint32 &value, const quint32 &id)
{
firstPointId = value;
setCurrentPointId(ui->comboBoxFirstPoint, firstPointId, value, id);
setPointId(ui->comboBoxFirstPoint, firstPointId, value, id);
}
//---------------------------------------------------------------------------------------------------------------------

View file

@ -60,7 +60,8 @@ public slots:
/** TODO ISSUE 79 : create real function
* @brief DialogApply apply data and emit signal about applied dialog.
*/
virtual void DialogApply(){}
virtual void DialogApply(){}
virtual void PointNameChanged();
private:
Q_DISABLE_COPY(DialogPointOfIntersection)

View file

@ -78,7 +78,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>
@ -102,7 +102,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>

View file

@ -64,6 +64,12 @@ DialogShoulderPoint::DialogShoulderPoint(const VContainer *data, QWidget *parent
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogShoulderPoint::NamePointChanged);
connect(ui->plainTextEditFormula, &QPlainTextEdit::textChanged, this, &DialogShoulderPoint::FormulaTextChanged);
connect(ui->pushButtonGrowLength, &QPushButton::clicked, this, &DialogShoulderPoint::DeployFormulaTextEdit);
connect(ui->comboBoxP1Line, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged),
this, &DialogShoulderPoint::PointNameChanged);
connect(ui->comboBoxP2Line, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged),
this, &DialogShoulderPoint::PointNameChanged);
connect(ui->comboBoxPShoulder, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged),
this, &DialogShoulderPoint::PointNameChanged);
}
//---------------------------------------------------------------------------------------------------------------------
@ -72,6 +78,31 @@ void DialogShoulderPoint::FormulaTextChanged()
this->FormulaChangedPlainText();
}
//---------------------------------------------------------------------------------------------------------------------
void DialogShoulderPoint::PointNameChanged()
{
QSet<quint32> set;
set.insert(getCurrentObjectId(ui->comboBoxP1Line));
set.insert(getCurrentObjectId(ui->comboBoxP2Line));
set.insert(getCurrentObjectId(ui->comboBoxPShoulder));
if (set.size() != 3)
{
flagError = false;
ChangeColor(ui->labelFirstPoint, Qt::red);
ChangeColor(ui->labelSecondPoint, Qt::red);
ChangeColor(ui->labelPointShoulder, Qt::red);
}
else
{
flagError = true;
ChangeColor(ui->labelFirstPoint, QColor(76, 76, 76));
ChangeColor(ui->labelSecondPoint, QColor(76, 76, 76));
ChangeColor(ui->labelPointShoulder, QColor(76, 76, 76));
}
CheckState();
}
//---------------------------------------------------------------------------------------------------------------------
void DialogShoulderPoint::DeployFormulaTextEdit()
{
@ -171,7 +202,7 @@ void DialogShoulderPoint::SaveData()
*/
void DialogShoulderPoint::setPShoulder(const quint32 &value, const quint32 &id)
{
setCurrentPointId(ui->comboBoxPShoulder, pShoulder, value, id);
setPointId(ui->comboBoxPShoulder, pShoulder, value, id);
}
//---------------------------------------------------------------------------------------------------------------------
@ -182,7 +213,7 @@ void DialogShoulderPoint::setPShoulder(const quint32 &value, const quint32 &id)
*/
void DialogShoulderPoint::setP2Line(const quint32 &value, const quint32 &id)
{
setCurrentPointId(ui->comboBoxP2Line, p2Line, value, id);
setPointId(ui->comboBoxP2Line, p2Line, value, id);
}
//---------------------------------------------------------------------------------------------------------------------
@ -193,7 +224,7 @@ void DialogShoulderPoint::setP2Line(const quint32 &value, const quint32 &id)
*/
void DialogShoulderPoint::setP1Line(const quint32 &value, const quint32 &id)
{
setCurrentPointId(ui->comboBoxP1Line, p1Line, value, id);
setPointId(ui->comboBoxP1Line, p1Line, value, id);
}
//---------------------------------------------------------------------------------------------------------------------

View file

@ -69,15 +69,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();
void FormulaTextChanged();
virtual void PointNameChanged();
private:
Q_DISABLE_COPY(DialogShoulderPoint)

View file

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>473</width>
<height>686</height>
<width>512</width>
<height>674</height>
</rect>
</property>
<property name="windowTitle">
@ -189,7 +189,9 @@
<string/>
</property>
<property name="icon">
<iconset theme="go-down"/>
<iconset theme="go-down">
<normaloff/>
</iconset>
</property>
<property name="iconSize">
<size>
@ -268,9 +270,9 @@
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLabel" name="label_3">
<widget class="QLabel" name="labelFirstPoint">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -301,9 +303,9 @@
<item>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="QLabel" name="label_5">
<widget class="QLabel" name="labelSecondPoint">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -334,7 +336,7 @@
<item>
<layout class="QHBoxLayout" name="horizontalLayout_7">
<item>
<widget class="QLabel" name="label_6">
<widget class="QLabel" name="labelPointShoulder">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>