Fix showing warning for grainline.

--HG--
branch : feature
This commit is contained in:
Roman Telezhynskyi 2017-03-11 15:56:39 +02:00
parent 38409f747f
commit c5f7eef8b4

View File

@ -1016,13 +1016,20 @@ void DialogSeamAllowance::UpdateGrainlineValues()
} }
catch (qmu::QmuParserError &e) catch (qmu::QmuParserError &e)
{ {
qsVal.clear(); qsVal = tr("Error");
if (not flagGPin)
{
ChangeColor(plbText, Qt::red); ChangeColor(plbText, Qt::red);
}
else
{
ChangeColor(plbText, okColor);
}
bFormulasOK = false; bFormulasOK = false;
plbVal->setToolTip(tr("Parser error: %1").arg(e.GetMsg())); plbVal->setToolTip(tr("Parser error: %1").arg(e.GetMsg()));
} }
if (qsVal.isEmpty() == false) if (bFormulasOK && qsVal.isEmpty() == false)
{ {
qsVal += qsUnit; qsVal += qsUnit;
} }
@ -1102,8 +1109,16 @@ void DialogSeamAllowance::UpdateDetailLabelValues()
} }
catch (qmu::QmuParserError &e) catch (qmu::QmuParserError &e)
{ {
qsVal.clear(); qsVal = tr("Error");
if (not flagDPin)
{
ChangeColor(plbText, Qt::red); ChangeColor(plbText, Qt::red);
}
else
{
ChangeColor(plbText, okColor);
}
if (i == 3) if (i == 3)
{ {
angleFormulaOk = false; angleFormulaOk = false;
@ -1115,10 +1130,20 @@ void DialogSeamAllowance::UpdateDetailLabelValues()
plbVal->setToolTip(tr("Parser error: %1").arg(e.GetMsg())); plbVal->setToolTip(tr("Parser error: %1").arg(e.GetMsg()));
} }
if (qsVal.isEmpty() == false) if (i == 3)
{
if (angleFormulaOk && qsVal.isEmpty() == false)
{ {
qsVal += qsUnit; qsVal += qsUnit;
} }
}
else
{
if (bFormulasOK && qsVal.isEmpty() == false)
{
qsVal += qsUnit;
}
}
plbVal->setText(qsVal); plbVal->setText(qsVal);
} }
@ -1196,8 +1221,16 @@ void DialogSeamAllowance::UpdatePatternLabelValues()
} }
catch (qmu::QmuParserError &e) catch (qmu::QmuParserError &e)
{ {
qsVal.clear(); qsVal = tr("Error");
if (not flagPPin)
{
ChangeColor(plbText, Qt::red); ChangeColor(plbText, Qt::red);
}
else
{
ChangeColor(plbText, okColor);
}
if (i == 3) if (i == 3)
{ {
angleFormulaOk = false; angleFormulaOk = false;
@ -1209,10 +1242,20 @@ void DialogSeamAllowance::UpdatePatternLabelValues()
plbVal->setToolTip(tr("Parser error: %1").arg(e.GetMsg())); plbVal->setToolTip(tr("Parser error: %1").arg(e.GetMsg()));
} }
if (qsVal.isEmpty() == false) if (i == 3)
{
if (angleFormulaOk && qsVal.isEmpty() == false)
{ {
qsVal += qsUnit; qsVal += qsUnit;
} }
}
else
{
if (bFormulasOK && qsVal.isEmpty() == false)
{
qsVal += qsUnit;
}
}
plbVal->setText(qsVal); plbVal->setText(qsVal);
} }
@ -1707,8 +1750,7 @@ void DialogSeamAllowance::GrainlinePinPointChanged()
QColor color = okColor; QColor color = okColor;
const quint32 topPinId = getCurrentObjectId(ui->comboBoxGrainlineTopPin); const quint32 topPinId = getCurrentObjectId(ui->comboBoxGrainlineTopPin);
const quint32 bottomPinId = getCurrentObjectId(ui->comboBoxGrainlineBottomPin); const quint32 bottomPinId = getCurrentObjectId(ui->comboBoxGrainlineBottomPin);
if ((topPinId == NULL_ID && bottomPinId == NULL_ID) || if (topPinId != NULL_ID && bottomPinId != NULL_ID && topPinId != bottomPinId)
(topPinId != NULL_ID && bottomPinId != NULL_ID && topPinId != bottomPinId))
{ {
flagGPin = true; flagGPin = true;
color = okColor; color = okColor;
@ -1718,7 +1760,7 @@ void DialogSeamAllowance::GrainlinePinPointChanged()
else else
{ {
flagGPin = false; flagGPin = false;
color = errorColor; topPinId == NULL_ID && bottomPinId == NULL_ID ? color = okColor : color = errorColor;
if (not flagGFormulas && not flagGPin) if (not flagGFormulas && not flagGPin)
{ {
@ -1726,6 +1768,7 @@ void DialogSeamAllowance::GrainlinePinPointChanged()
ui->tabWidget->setTabIcon(ui->tabWidget->indexOf(ui->tabGrainline), icon); ui->tabWidget->setTabIcon(ui->tabWidget->indexOf(ui->tabGrainline), icon);
} }
} }
UpdateGrainlineValues();
ChangeColor(ui->labelGrainlineTopPin, color); ChangeColor(ui->labelGrainlineTopPin, color);
ChangeColor(ui->labelGrainlineBottomPin, color); ChangeColor(ui->labelGrainlineBottomPin, color);
CheckState(); CheckState();
@ -1756,6 +1799,7 @@ void DialogSeamAllowance::DetailPinPointChanged()
QIcon icon(":/icons/win.icon.theme/16x16/status/dialog-warning.png"); QIcon icon(":/icons/win.icon.theme/16x16/status/dialog-warning.png");
ui->tabWidget->setTabIcon(ui->tabWidget->indexOf(ui->tabLabels), icon); ui->tabWidget->setTabIcon(ui->tabWidget->indexOf(ui->tabLabels), icon);
} }
UpdateDetailLabelValues();
ChangeColor(ui->labelDLTopLeftPin, color); ChangeColor(ui->labelDLTopLeftPin, color);
ChangeColor(ui->labelDLBottomRightPin, color); ChangeColor(ui->labelDLBottomRightPin, color);
CheckState(); CheckState();
@ -1786,6 +1830,7 @@ void DialogSeamAllowance::PatternPinPointChanged()
QIcon icon(":/icons/win.icon.theme/16x16/status/dialog-warning.png"); QIcon icon(":/icons/win.icon.theme/16x16/status/dialog-warning.png");
ui->tabWidget->setTabIcon(ui->tabWidget->indexOf(ui->tabLabels), icon); ui->tabWidget->setTabIcon(ui->tabWidget->indexOf(ui->tabLabels), icon);
} }
UpdatePatternLabelValues();
ChangeColor(ui->labelPLTopLeftPin, color); ChangeColor(ui->labelPLTopLeftPin, color);
ChangeColor(ui->labelPLBottomRightPin, color); ChangeColor(ui->labelPLBottomRightPin, color);
CheckState(); CheckState();