Refactoring method PointNameChanged.
--HG-- branch : develop
This commit is contained in:
parent
84050f042b
commit
9563604d67
|
@ -78,18 +78,19 @@ void DialogAlongLine::FormulaTextChanged()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogAlongLine::PointChanged()
|
void DialogAlongLine::PointChanged()
|
||||||
{
|
{
|
||||||
|
QColor color = okColor;
|
||||||
if (getCurrentObjectId(ui->comboBoxFirstPoint) == getCurrentObjectId(ui->comboBoxSecondPoint))
|
if (getCurrentObjectId(ui->comboBoxFirstPoint) == getCurrentObjectId(ui->comboBoxSecondPoint))
|
||||||
{
|
{
|
||||||
flagError = false;
|
flagError = false;
|
||||||
ChangeColor(ui->labelFirstPoint, Qt::red);
|
color = errorColor;
|
||||||
ChangeColor(ui->labelSecondPoint, Qt::red);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
flagError = true;
|
flagError = true;
|
||||||
ChangeColor(ui->labelFirstPoint, QColor(76, 76, 76));
|
color = okColor;
|
||||||
ChangeColor(ui->labelSecondPoint, QColor(76, 76, 76));
|
|
||||||
}
|
}
|
||||||
|
ChangeColor(ui->labelFirstPoint, color);
|
||||||
|
ChangeColor(ui->labelSecondPoint, color);
|
||||||
CheckState();
|
CheckState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -88,20 +88,20 @@ void DialogBisector::PointNameChanged()
|
||||||
set.insert(getCurrentObjectId(ui->comboBoxSecondPoint));
|
set.insert(getCurrentObjectId(ui->comboBoxSecondPoint));
|
||||||
set.insert(getCurrentObjectId(ui->comboBoxThirdPoint));
|
set.insert(getCurrentObjectId(ui->comboBoxThirdPoint));
|
||||||
|
|
||||||
|
QColor color = okColor;
|
||||||
if (set.size() != 3)
|
if (set.size() != 3)
|
||||||
{
|
{
|
||||||
flagError = false;
|
flagError = false;
|
||||||
ChangeColor(ui->labelFirstPoint, Qt::red);
|
color = errorColor;
|
||||||
ChangeColor(ui->labelSecondPoint, Qt::red);
|
|
||||||
ChangeColor(ui->labelThirdPoint, Qt::red);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
flagError = true;
|
flagError = true;
|
||||||
ChangeColor(ui->labelFirstPoint, QColor(76, 76, 76));
|
color = okColor;
|
||||||
ChangeColor(ui->labelSecondPoint, QColor(76, 76, 76));
|
|
||||||
ChangeColor(ui->labelThirdPoint, QColor(76, 76, 76));
|
|
||||||
}
|
}
|
||||||
|
ChangeColor(ui->labelFirstPoint, color);
|
||||||
|
ChangeColor(ui->labelSecondPoint, color);
|
||||||
|
ChangeColor(ui->labelThirdPoint, color);
|
||||||
CheckState();
|
CheckState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ DialogDetail::DialogDetail(const VContainer *data, QWidget *parent)
|
||||||
connect(bCansel, &QPushButton::clicked, this, &DialogTool::DialogRejected);
|
connect(bCansel, &QPushButton::clicked, this, &DialogTool::DialogRejected);
|
||||||
|
|
||||||
flagName = true;//We have default name of detail.
|
flagName = true;//We have default name of detail.
|
||||||
ChangeColor(labelEditNamePoint, QColor(76, 76, 76));
|
ChangeColor(labelEditNamePoint, okColor);
|
||||||
CheckState();
|
CheckState();
|
||||||
|
|
||||||
connect(ui.listWidget, &QListWidget::currentRowChanged, this, &DialogDetail::ObjectChanged);
|
connect(ui.listWidget, &QListWidget::currentRowChanged, this, &DialogDetail::ObjectChanged);
|
||||||
|
|
|
@ -193,20 +193,20 @@ void DialogHeight::PointNameChanged()
|
||||||
const VPointF *p1Line = data->GeometricObject<const VPointF *>(p1LineId);
|
const VPointF *p1Line = data->GeometricObject<const VPointF *>(p1LineId);
|
||||||
const VPointF *p2Line = data->GeometricObject<const VPointF *>(p2LineId);
|
const VPointF *p2Line = data->GeometricObject<const VPointF *>(p2LineId);
|
||||||
|
|
||||||
|
QColor color = okColor;
|
||||||
if (set.size() != 3 || VAbstractTool::ClosestPoint(QLineF(p1Line->toQPointF(), p2Line->toQPointF()),
|
if (set.size() != 3 || VAbstractTool::ClosestPoint(QLineF(p1Line->toQPointF(), p2Line->toQPointF()),
|
||||||
basePoint->toQPointF()) == QPointF())
|
basePoint->toQPointF()) == QPointF())
|
||||||
{
|
{
|
||||||
flagError = false;
|
flagError = false;
|
||||||
ChangeColor(ui->labelBasePoint, Qt::red);
|
color = errorColor;
|
||||||
ChangeColor(ui->labelFirstLinePoint, Qt::red);
|
|
||||||
ChangeColor(ui->labelSecondLinePoint, Qt::red);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
flagError = true;
|
flagError = true;
|
||||||
ChangeColor(ui->labelBasePoint, QColor(76, 76, 76));
|
color = okColor;
|
||||||
ChangeColor(ui->labelFirstLinePoint, QColor(76, 76, 76));
|
|
||||||
ChangeColor(ui->labelSecondLinePoint, QColor(76, 76, 76));
|
|
||||||
}
|
}
|
||||||
|
ChangeColor(ui->labelBasePoint, color);
|
||||||
|
ChangeColor(ui->labelFirstLinePoint, color);
|
||||||
|
ChangeColor(ui->labelSecondLinePoint, color);
|
||||||
CheckState();
|
CheckState();
|
||||||
}
|
}
|
||||||
|
|
|
@ -111,18 +111,19 @@ void DialogLine::DialogAccepted()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogLine::PointNameChanged()
|
void DialogLine::PointNameChanged()
|
||||||
{
|
{
|
||||||
|
QColor color = okColor;
|
||||||
if (getCurrentObjectId(ui->comboBoxFirstPoint) == getCurrentObjectId(ui->comboBoxSecondPoint))
|
if (getCurrentObjectId(ui->comboBoxFirstPoint) == getCurrentObjectId(ui->comboBoxSecondPoint))
|
||||||
{
|
{
|
||||||
flagError = false;
|
flagError = false;
|
||||||
ChangeColor(ui->labelFirstPoint, Qt::red);
|
color = errorColor;
|
||||||
ChangeColor(ui->labelSecondPoint, Qt::red);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
flagError = true;
|
flagError = true;
|
||||||
ChangeColor(ui->labelFirstPoint, QColor(76, 76, 76));
|
color = okColor;
|
||||||
ChangeColor(ui->labelSecondPoint, QColor(76, 76, 76));
|
|
||||||
}
|
}
|
||||||
|
ChangeColor(ui->labelFirstPoint, color);
|
||||||
|
ChangeColor(ui->labelSecondPoint, color);
|
||||||
CheckState();
|
CheckState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -236,22 +236,21 @@ void DialogLineIntersect::PointNameChanged()
|
||||||
QPointF fPoint;
|
QPointF fPoint;
|
||||||
QLineF::IntersectType intersect = line1.intersect(line2, &fPoint);
|
QLineF::IntersectType intersect = line1.intersect(line2, &fPoint);
|
||||||
|
|
||||||
|
QColor color = okColor;
|
||||||
if (set.size() < 3 || intersect == QLineF::NoIntersection)
|
if (set.size() < 3 || intersect == QLineF::NoIntersection)
|
||||||
{
|
{
|
||||||
flagError = false;
|
flagError = false;
|
||||||
ChangeColor(ui->labelP1Line1, Qt::red);
|
color = errorColor;
|
||||||
ChangeColor(ui->labelP2Line1, Qt::red);
|
|
||||||
ChangeColor(ui->labelP1Line2, Qt::red);
|
|
||||||
ChangeColor(ui->labelP2Line2, Qt::red);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
flagError = true;
|
flagError = true;
|
||||||
ChangeColor(ui->labelP1Line1, QColor(76, 76, 76));
|
color = okColor;
|
||||||
ChangeColor(ui->labelP2Line1, QColor(76, 76, 76));
|
|
||||||
ChangeColor(ui->labelP1Line2, QColor(76, 76, 76));
|
|
||||||
ChangeColor(ui->labelP2Line2, QColor(76, 76, 76));
|
|
||||||
}
|
}
|
||||||
|
ChangeColor(ui->labelP1Line1, color);
|
||||||
|
ChangeColor(ui->labelP2Line1, color);
|
||||||
|
ChangeColor(ui->labelP1Line2, color);
|
||||||
|
ChangeColor(ui->labelP2Line2, color);
|
||||||
CheckState();
|
CheckState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -78,18 +78,19 @@ void DialogNormal::FormulaTextChanged()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogNormal::PointNameChanged()
|
void DialogNormal::PointNameChanged()
|
||||||
{
|
{
|
||||||
|
QColor color = okColor;
|
||||||
if (getCurrentObjectId(ui->comboBoxFirstPoint) == getCurrentObjectId(ui->comboBoxSecondPoint))
|
if (getCurrentObjectId(ui->comboBoxFirstPoint) == getCurrentObjectId(ui->comboBoxSecondPoint))
|
||||||
{
|
{
|
||||||
flagError = false;
|
flagError = false;
|
||||||
ChangeColor(ui->labelFirstPoint, Qt::red);
|
color = errorColor;
|
||||||
ChangeColor(ui->labelSecondPoint, Qt::red);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
flagError = true;
|
flagError = true;
|
||||||
ChangeColor(ui->labelFirstPoint, QColor(76, 76, 76));
|
color = okColor;
|
||||||
ChangeColor(ui->labelSecondPoint, QColor(76, 76, 76));
|
|
||||||
}
|
}
|
||||||
|
ChangeColor(ui->labelFirstPoint, color);
|
||||||
|
ChangeColor(ui->labelSecondPoint, color);
|
||||||
CheckState();
|
CheckState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -101,20 +101,20 @@ void DialogPointOfContact::PointNameChanged()
|
||||||
set.insert(getCurrentObjectId(ui->comboBoxSecondPoint));
|
set.insert(getCurrentObjectId(ui->comboBoxSecondPoint));
|
||||||
set.insert(getCurrentObjectId(ui->comboBoxCenter));
|
set.insert(getCurrentObjectId(ui->comboBoxCenter));
|
||||||
|
|
||||||
|
QColor color = okColor;
|
||||||
if (set.size() != 3)
|
if (set.size() != 3)
|
||||||
{
|
{
|
||||||
flagError = false;
|
flagError = false;
|
||||||
ChangeColor(ui->labelFirstPoint, Qt::red);
|
color = errorColor;
|
||||||
ChangeColor(ui->labelSecondPoint, Qt::red);
|
|
||||||
ChangeColor(ui->labelArcCenter, Qt::red);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
flagError = true;
|
flagError = true;
|
||||||
ChangeColor(ui->labelFirstPoint, QColor(76, 76, 76));
|
color = okColor;
|
||||||
ChangeColor(ui->labelSecondPoint, QColor(76, 76, 76));
|
|
||||||
ChangeColor(ui->labelArcCenter, QColor(76, 76, 76));
|
|
||||||
}
|
}
|
||||||
|
ChangeColor(ui->labelFirstPoint, color);
|
||||||
|
ChangeColor(ui->labelSecondPoint, color);
|
||||||
|
ChangeColor(ui->labelArcCenter, color);
|
||||||
CheckState();
|
CheckState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -131,18 +131,19 @@ void DialogPointOfIntersection::DialogAccepted()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogPointOfIntersection::PointNameChanged()
|
void DialogPointOfIntersection::PointNameChanged()
|
||||||
{
|
{
|
||||||
|
QColor color = okColor;
|
||||||
if (getCurrentObjectId(ui->comboBoxFirstPoint) == getCurrentObjectId(ui->comboBoxSecondPoint))
|
if (getCurrentObjectId(ui->comboBoxFirstPoint) == getCurrentObjectId(ui->comboBoxSecondPoint))
|
||||||
{
|
{
|
||||||
flagError = false;
|
flagError = false;
|
||||||
ChangeColor(ui->labelFirstPoint, Qt::red);
|
color = errorColor;
|
||||||
ChangeColor(ui->labelSecondPoint, Qt::red);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
flagError = true;
|
flagError = true;
|
||||||
ChangeColor(ui->labelFirstPoint, QColor(76, 76, 76));
|
color = okColor;
|
||||||
ChangeColor(ui->labelSecondPoint, QColor(76, 76, 76));
|
|
||||||
}
|
}
|
||||||
|
ChangeColor(ui->labelFirstPoint, color);
|
||||||
|
ChangeColor(ui->labelSecondPoint, color);
|
||||||
CheckState();
|
CheckState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -86,20 +86,20 @@ void DialogShoulderPoint::PointNameChanged()
|
||||||
set.insert(getCurrentObjectId(ui->comboBoxP2Line));
|
set.insert(getCurrentObjectId(ui->comboBoxP2Line));
|
||||||
set.insert(getCurrentObjectId(ui->comboBoxPShoulder));
|
set.insert(getCurrentObjectId(ui->comboBoxPShoulder));
|
||||||
|
|
||||||
|
QColor color = okColor;
|
||||||
if (set.size() != 3)
|
if (set.size() != 3)
|
||||||
{
|
{
|
||||||
flagError = false;
|
flagError = false;
|
||||||
ChangeColor(ui->labelFirstPoint, Qt::red);
|
color = errorColor;
|
||||||
ChangeColor(ui->labelSecondPoint, Qt::red);
|
|
||||||
ChangeColor(ui->labelPointShoulder, Qt::red);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
flagError = true;
|
flagError = true;
|
||||||
ChangeColor(ui->labelFirstPoint, QColor(76, 76, 76));
|
color = okColor;
|
||||||
ChangeColor(ui->labelSecondPoint, QColor(76, 76, 76));
|
|
||||||
ChangeColor(ui->labelPointShoulder, QColor(76, 76, 76));
|
|
||||||
}
|
}
|
||||||
|
ChangeColor(ui->labelFirstPoint, color);
|
||||||
|
ChangeColor(ui->labelSecondPoint, color);
|
||||||
|
ChangeColor(ui->labelPointShoulder, color);
|
||||||
CheckState();
|
CheckState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -140,18 +140,19 @@ void DialogSpline::PointNameChanged()
|
||||||
set.insert(getCurrentObjectId(ui->comboBoxP1));
|
set.insert(getCurrentObjectId(ui->comboBoxP1));
|
||||||
set.insert(getCurrentObjectId(ui->comboBoxP4));
|
set.insert(getCurrentObjectId(ui->comboBoxP4));
|
||||||
|
|
||||||
|
QColor color = okColor;
|
||||||
if (getCurrentObjectId(ui->comboBoxP1) == getCurrentObjectId(ui->comboBoxP4))
|
if (getCurrentObjectId(ui->comboBoxP1) == getCurrentObjectId(ui->comboBoxP4))
|
||||||
{
|
{
|
||||||
flagError = false;
|
flagError = false;
|
||||||
ChangeColor(ui->labelFirstPoint, Qt::red);
|
color = errorColor;
|
||||||
ChangeColor(ui->labelSecondPoint, Qt::red);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
flagError = true;
|
flagError = true;
|
||||||
ChangeColor(ui->labelFirstPoint, QColor(76, 76, 76));
|
color = okColor;
|
||||||
ChangeColor(ui->labelSecondPoint, QColor(76, 76, 76));
|
|
||||||
}
|
}
|
||||||
|
ChangeColor(ui->labelFirstPoint, color);
|
||||||
|
ChangeColor(ui->labelSecondPoint, color);
|
||||||
CheckState();
|
CheckState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,8 @@ DialogTool::DialogTool(const VContainer *data, QWidget *parent)
|
||||||
listWidget(nullptr), labelResultCalculation(nullptr), labelDescription(nullptr), labelEditNamePoint(nullptr),
|
listWidget(nullptr), labelResultCalculation(nullptr), labelDescription(nullptr), labelEditNamePoint(nullptr),
|
||||||
labelEditFormula(nullptr), radioButtonSizeGrowth(nullptr), radioButtonStandardTable(nullptr),
|
labelEditFormula(nullptr), radioButtonSizeGrowth(nullptr), radioButtonStandardTable(nullptr),
|
||||||
radioButtonIncrements(nullptr), radioButtonLengthLine(nullptr), radioButtonLengthArc(nullptr),
|
radioButtonIncrements(nullptr), radioButtonLengthLine(nullptr), radioButtonLengthArc(nullptr),
|
||||||
radioButtonLengthCurve(nullptr), lineStyles(QStringList()), associatedTool(nullptr)
|
radioButtonLengthCurve(nullptr), lineStyles(QStringList()), okColor(QColor(76, 76, 76)), errorColor(Qt::red),
|
||||||
|
associatedTool(nullptr)
|
||||||
{
|
{
|
||||||
SCASSERT(data != nullptr);
|
SCASSERT(data != nullptr);
|
||||||
timerFormula = new QTimer(this);
|
timerFormula = new QTimer(this);
|
||||||
|
@ -463,7 +464,7 @@ void DialogTool::Eval(const QString &text, bool &flag, QTimer *timer, QLabel *la
|
||||||
label->setText(loc.toString(result) + VDomDocument::UnitsToStr(qApp->patternUnit(), true));
|
label->setText(loc.toString(result) + VDomDocument::UnitsToStr(qApp->patternUnit(), true));
|
||||||
}
|
}
|
||||||
flag = true;
|
flag = true;
|
||||||
ChangeColor(labelEditFormula, QColor(76, 76, 76));
|
ChangeColor(labelEditFormula, okColor);
|
||||||
emit ToolTip("");
|
emit ToolTip("");
|
||||||
}
|
}
|
||||||
catch (qmu::QmuParserError &e)
|
catch (qmu::QmuParserError &e)
|
||||||
|
@ -669,7 +670,7 @@ void DialogTool::NamePointChanged()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
flagName = true;
|
flagName = true;
|
||||||
ChangeColor(labelEditNamePoint, QColor(76, 76, 76));
|
ChangeColor(labelEditNamePoint, okColor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CheckState();
|
CheckState();
|
||||||
|
|
|
@ -179,6 +179,8 @@ protected:
|
||||||
|
|
||||||
/** @brief lineStyles list supported line styles. */
|
/** @brief lineStyles list supported line styles. */
|
||||||
QStringList lineStyles;
|
QStringList lineStyles;
|
||||||
|
const QColor okColor;
|
||||||
|
const QColor errorColor;
|
||||||
|
|
||||||
virtual void closeEvent ( QCloseEvent * event );
|
virtual void closeEvent ( QCloseEvent * event );
|
||||||
virtual void showEvent( QShowEvent *event );
|
virtual void showEvent( QShowEvent *event );
|
||||||
|
|
|
@ -137,22 +137,21 @@ void DialogTriangle::PointNameChanged()
|
||||||
set.insert(getCurrentObjectId(ui->comboBoxAxisP1));
|
set.insert(getCurrentObjectId(ui->comboBoxAxisP1));
|
||||||
set.insert(getCurrentObjectId(ui->comboBoxAxisP2));
|
set.insert(getCurrentObjectId(ui->comboBoxAxisP2));
|
||||||
|
|
||||||
|
QColor color = okColor;
|
||||||
if (set.size() != 4)
|
if (set.size() != 4)
|
||||||
{
|
{
|
||||||
flagError = false;
|
flagError = false;
|
||||||
ChangeColor(ui->labelFirstPoint, Qt::red);
|
color = errorColor;
|
||||||
ChangeColor(ui->labelSecondPoint, Qt::red);
|
|
||||||
ChangeColor(ui->labelAxisP1, Qt::red);
|
|
||||||
ChangeColor(ui->labelAxisP2, Qt::red);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
flagError = true;
|
flagError = true;
|
||||||
ChangeColor(ui->labelFirstPoint, QColor(76, 76, 76));
|
color = okColor;
|
||||||
ChangeColor(ui->labelSecondPoint, QColor(76, 76, 76));
|
|
||||||
ChangeColor(ui->labelAxisP1, QColor(76, 76, 76));
|
|
||||||
ChangeColor(ui->labelAxisP2, QColor(76, 76, 76));
|
|
||||||
}
|
}
|
||||||
|
ChangeColor(ui->labelFirstPoint, color);
|
||||||
|
ChangeColor(ui->labelSecondPoint, color);
|
||||||
|
ChangeColor(ui->labelAxisP1, color);
|
||||||
|
ChangeColor(ui->labelAxisP2, color);
|
||||||
CheckState();
|
CheckState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user