Fixed user defined materials

--HG--
branch : feature
This commit is contained in:
BojanKverh 2016-08-21 10:27:39 +02:00
parent 19c69c691a
commit ff6d3c7155
2 changed files with 2 additions and 5 deletions

View File

@ -693,10 +693,6 @@ void VPattern::ParseDetailElement(const QDomElement &domElement, const Document
{ {
mcp.m_qsMaterialUserDef = GetParametrString(domMCP, AttrUserDefined, ""); mcp.m_qsMaterialUserDef = GetParametrString(domMCP, AttrUserDefined, "");
} }
else
{
mcp.m_qsMaterialUserDef.clear();
}
mcp.m_iCutNumber = GetParametrUInt(domMCP, AttrCutNumber, 0); mcp.m_iCutNumber = GetParametrUInt(domMCP, AttrCutNumber, 0);
mcp.m_ePlacement = PlacementType(GetParametrUInt(domMCP, AttrPlacement, 0)); mcp.m_ePlacement = PlacementType(GetParametrUInt(domMCP, AttrPlacement, 0));
detail.GetPatternPieceData().Append(mcp); detail.GetPatternPieceData().Append(mcp);

View File

@ -252,15 +252,16 @@ void DialogDetail::AddUpdate()
MaterialCutPlacement mcp; MaterialCutPlacement mcp;
QStringList qslUserMaterials = qApp->Settings()->GetUserDefinedMaterials(); QStringList qslUserMaterials = qApp->Settings()->GetUserDefinedMaterials();
mcp.m_qsMaterialUserDef = ui.comboBoxMaterial->currentText();
int i = ui.comboBoxMaterial->currentData().toInt(); int i = ui.comboBoxMaterial->currentData().toInt();
if (i < m_qslMaterials.count() && mcp.m_qsMaterialUserDef == m_qslMaterials[i]) if (i < m_qslMaterials.count() && mcp.m_qsMaterialUserDef == m_qslMaterials[i])
{ {
mcp.m_eMaterial = MaterialType(i); mcp.m_eMaterial = MaterialType(i);
mcp.m_qsMaterialUserDef.clear();
} }
else else
{ {
mcp.m_eMaterial = MaterialType::mtUserDefined; mcp.m_eMaterial = MaterialType::mtUserDefined;
mcp.m_qsMaterialUserDef = ui.comboBoxMaterial->currentText();
// check if we have new user defined material // check if we have new user defined material
bool bFound = false; bool bFound = false;
for (int i = 0; i < qslUserMaterials.count() && bFound == false; ++i) for (int i = 0; i < qslUserMaterials.count() && bFound == false; ++i)