Fixed the grainline tab icon in details dialog

--HG--
branch : feature
This commit is contained in:
BojanKverh 2016-10-23 20:59:38 +02:00
parent 0ca37fdecb
commit e82f65fc6a
5 changed files with 31 additions and 8 deletions

View File

@ -726,10 +726,18 @@ void VPattern::ParseDetailElement(const QDomElement &domElement, const Document
ptPos.setX(GetParametrDouble(element, AttrMx, "0")); ptPos.setX(GetParametrDouble(element, AttrMx, "0"));
ptPos.setY(GetParametrDouble(element, AttrMy, "0")); ptPos.setY(GetParametrDouble(element, AttrMy, "0"));
detail.GetGrainlineGeometry().SetPos(ptPos); detail.GetGrainlineGeometry().SetPos(ptPos);
QString qsLength = GetParametrString(element, AttrLength, "0"); if (detail.GetGrainlineGeometry().IsVisible() == true)
detail.GetGrainlineGeometry().SetLength(qsLength); {
QString qsRot = GetParametrString(element, VToolDetail::AttrRotation, "0"); QString qsLength = GetParametrString(element, AttrLength);
detail.GetGrainlineGeometry().SetRotation(qsRot); detail.GetGrainlineGeometry().SetLength(qsLength);
QString qsRot = GetParametrString(element, VToolDetail::AttrRotation);
detail.GetGrainlineGeometry().SetRotation(qsRot);
}
else
{
detail.GetGrainlineGeometry().SetLength("");
detail.GetGrainlineGeometry().SetRotation("");
}
} }
} }
} }

View File

@ -903,8 +903,7 @@ void DialogDetail::UpdateValues()
} }
else else
{ {
QIcon icon; ResetWarning();
ui.tabWidget->setTabIcon(2, icon);
} }
} }
@ -974,6 +973,7 @@ void DialogDetail::EnableGrainlineRotation()
ChangeColor(ui.labelEditLen, okColor); ChangeColor(ui.labelEditLen, okColor);
ChangeColor(ui.labelEditRot, okColor); ChangeColor(ui.labelEditRot, okColor);
bOk->setEnabled(true); bOk->setEnabled(true);
ResetWarning();
} }
} }
@ -1024,3 +1024,11 @@ void DialogDetail::DeployLength()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void DialogDetail::ResetWarning()
{
QIcon icon;
ui.tabWidget->setTabIcon(2, icon);
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -135,6 +135,7 @@ private slots:
void EditFormula(); void EditFormula();
void DeployRotation(); void DeployRotation();
void DeployLength(); void DeployLength();
void ResetWarning();
}; };
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -502,6 +502,7 @@ void VToolDetail::AddToFile()
doc->SetAttribute(domData, AttrMy, glGeom.GetPos().y()); doc->SetAttribute(domData, AttrMy, glGeom.GetPos().y());
doc->SetAttribute(domData, AttrLength, glGeom.GetLength()); doc->SetAttribute(domData, AttrLength, glGeom.GetLength());
doc->SetAttribute(domData, AttrRotation, glGeom.GetRotation()); doc->SetAttribute(domData, AttrRotation, glGeom.GetRotation());
qDebug() << "XML ROTATION" << glGeom.GetRotation();
// nodes // nodes
for (int i = 0; i < detail.CountNode(); ++i) for (int i = 0; i < detail.CountNode(); ++i)
@ -580,6 +581,7 @@ void VToolDetail::RefreshDataInFile()
doc->SetAttribute(domData, AttrMy, glGeom.GetPos().y()); doc->SetAttribute(domData, AttrMy, glGeom.GetPos().y());
doc->SetAttribute(domData, AttrLength, glGeom.GetLength()); doc->SetAttribute(domData, AttrLength, glGeom.GetLength());
doc->SetAttribute(domData, AttrRotation, glGeom.GetRotation()); doc->SetAttribute(domData, AttrRotation, glGeom.GetRotation());
qDebug() << "XML ROTATION2" << glGeom.GetRotation();
// nodes // nodes
for (int i = 0; i < det.CountNode(); ++i) for (int i = 0; i < det.CountNode(); ++i)
@ -926,6 +928,7 @@ void VToolDetail::UpdateGrainline()
QString qsFormula; QString qsFormula;
qsFormula = geom.GetRotation().replace("\n", " "); qsFormula = geom.GetRotation().replace("\n", " ");
qsFormula = qApp->TrVars()->FormulaFromUser(qsFormula, qApp->Settings()->GetOsSeparator()); qsFormula = qApp->TrVars()->FormulaFromUser(qsFormula, qApp->Settings()->GetOsSeparator());
Calculator cal1; Calculator cal1;
dRotation = cal1.EvalFormula(VDataTool::data.PlainVariables(), qsFormula); dRotation = cal1.EvalFormula(VDataTool::data.PlainVariables(), qsFormula);

View File

@ -208,8 +208,11 @@ void SaveDetailOptions::SaveGrainline(QDomElement &domElement, const VDetail &de
doc->SetAttribute(domData, VAbstractPattern::AttrVisible, glGeom.IsVisible() == true? trueStr : falseStr); doc->SetAttribute(domData, VAbstractPattern::AttrVisible, glGeom.IsVisible() == true? trueStr : falseStr);
doc->SetAttribute(domData, AttrMx, glGeom.GetPos().x()); doc->SetAttribute(domData, AttrMx, glGeom.GetPos().x());
doc->SetAttribute(domData, AttrMy, glGeom.GetPos().y()); doc->SetAttribute(domData, AttrMy, glGeom.GetPos().y());
doc->SetAttribute(domData, AttrLength, glGeom.GetLength()); if (glGeom.IsVisible() == true)
doc->SetAttribute(domData, VToolDetail::AttrRotation, glGeom.GetRotation()); {
doc->SetAttribute(domData, AttrLength, glGeom.GetLength());
doc->SetAttribute(domData, VToolDetail::AttrRotation, glGeom.GetRotation());
}
domElement.appendChild(domData); domElement.appendChild(domData);
} }