User should at least has valid pins or not null lengths of grainline.

--HG--
branch : feature
This commit is contained in:
Roman Telezhynskyi 2017-02-24 17:23:02 +02:00
parent 86cc0fa0b0
commit 1e525ed788

View File

@ -346,7 +346,7 @@ void DialogSeamAllowance::SaveData()
void DialogSeamAllowance::CheckState() void DialogSeamAllowance::CheckState()
{ {
SCASSERT(bOk != nullptr); SCASSERT(bOk != nullptr);
bOk->setEnabled(flagName && flagError && flagFormula && flagGPin && flagDPin && flagPPin && flagGFormulas); bOk->setEnabled(flagName && flagError && flagFormula && flagDPin && flagPPin && (flagGFormulas || flagGPin));
// In case dialog hasn't apply button // In case dialog hasn't apply button
if ( bApply != nullptr && applyAllowed) if ( bApply != nullptr && applyAllowed)
{ {
@ -1075,11 +1075,10 @@ void DialogSeamAllowance::EnableGrainlineRotation()
if (ui->groupBoxGrainline->isChecked() == true) if (ui->groupBoxGrainline->isChecked() == true)
{ {
UpdateValues(); UpdateValues();
GrainlinePinPointChanged();
} }
else else
{ {
ChangeColor(ui->labelEditLen, okColor);
ChangeColor(ui->labelEditRot, okColor);
flagGFormulas = true; flagGFormulas = true;
ResetWarning(); ResetWarning();
} }
@ -1134,7 +1133,7 @@ void DialogSeamAllowance::DeployLength()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void DialogSeamAllowance::ResetWarning() void DialogSeamAllowance::ResetWarning()
{ {
if (flagGFormulas && flagGPin) if (flagGFormulas || flagGPin)
{ {
ui->tabWidget->setTabIcon(ui->tabWidget->indexOf(ui->tabGrainline), QIcon()); ui->tabWidget->setTabIcon(ui->tabWidget->indexOf(ui->tabGrainline), QIcon());
} }
@ -1286,8 +1285,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;