Increment custom seam allowance in tool seam allowance.
--HG-- branch : feature
This commit is contained in:
parent
82d9fcba3f
commit
20f8da230d
|
@ -665,30 +665,8 @@ VToolSeamAllowance::VToolSeamAllowance(VAbstractPattern *doc, VContainer *data,
|
|||
m_seamAllowance(new VNoBrushScalePathItem(this))
|
||||
{
|
||||
VPiece detail = data->GetPiece(id);
|
||||
for (int i = 0; i< detail.GetPath().CountNodes(); ++i)
|
||||
{
|
||||
switch (detail.GetPath().at(i).GetTypeTool())
|
||||
{
|
||||
case (Tool::NodePoint):
|
||||
{
|
||||
VNodePoint *tool = InitTool<VNodePoint>(scene, detail.GetPath().at(i));
|
||||
connect(tool, &VNodePoint::ShowContextMenu, this, &VToolSeamAllowance::contextMenuEvent);
|
||||
break;
|
||||
}
|
||||
case (Tool::NodeArc):
|
||||
doc->IncrementReferens(detail.GetPath().at(i).GetId());
|
||||
break;
|
||||
case (Tool::NodeSpline):
|
||||
doc->IncrementReferens(detail.GetPath().at(i).GetId());
|
||||
break;
|
||||
case (Tool::NodeSplinePath):
|
||||
doc->IncrementReferens(detail.GetPath().at(i).GetId());
|
||||
break;
|
||||
default:
|
||||
qDebug()<<"Get wrong tool type. Ignore.";
|
||||
break;
|
||||
}
|
||||
}
|
||||
InitNodes(detail, scene);
|
||||
InitCSAPaths(detail);
|
||||
this->setFlag(QGraphicsItem::ItemIsMovable, true);
|
||||
this->setFlag(QGraphicsItem::ItemIsSelectable, true);
|
||||
RefreshGeometry();
|
||||
|
@ -754,6 +732,45 @@ void VToolSeamAllowance::SaveDialogChange()
|
|||
qApp->getUndoStack()->push(saveCommand);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolSeamAllowance::InitNodes(const VPiece &detail, VMainGraphicsScene *scene)
|
||||
{
|
||||
for (int i = 0; i< detail.GetPath().CountNodes(); ++i)
|
||||
{
|
||||
switch (detail.GetPath().at(i).GetTypeTool())
|
||||
{
|
||||
case (Tool::NodePoint):
|
||||
{
|
||||
VNodePoint *tool = InitTool<VNodePoint>(scene, detail.GetPath().at(i));
|
||||
connect(tool, &VNodePoint::ShowContextMenu, this, &VToolSeamAllowance::contextMenuEvent);
|
||||
break;
|
||||
}
|
||||
case (Tool::NodeArc):
|
||||
doc->IncrementReferens(detail.GetPath().at(i).GetId());
|
||||
break;
|
||||
case (Tool::NodeSpline):
|
||||
doc->IncrementReferens(detail.GetPath().at(i).GetId());
|
||||
break;
|
||||
case (Tool::NodeSplinePath):
|
||||
doc->IncrementReferens(detail.GetPath().at(i).GetId());
|
||||
break;
|
||||
default:
|
||||
qDebug()<<"Get wrong tool type. Ignore.";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolSeamAllowance::InitCSAPaths(const VPiece &detail)
|
||||
{
|
||||
QVector<CustomSARecord> records = detail.GetCustomSARecords();
|
||||
for (int i = 0; i < records.size(); ++i)
|
||||
{
|
||||
doc->IncrementReferens(records.at(i).path);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolSeamAllowance::DeleteTool(bool ask)
|
||||
{
|
||||
|
|
|
@ -130,6 +130,9 @@ private:
|
|||
void RefreshGeometry();
|
||||
void SaveDialogChange();
|
||||
|
||||
void InitNodes(const VPiece &detail, VMainGraphicsScene *scene);
|
||||
void InitCSAPaths(const VPiece &detail);
|
||||
|
||||
template <typename Tool>
|
||||
Tool* InitTool(VMainGraphicsScene *scene, const VPieceNode &node);
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
Block a user