Refactor VToolSeamAllowance::InitTool. Enough to pass only tool id.
--HG-- branch : feature
This commit is contained in:
parent
20f8da230d
commit
109e23e40d
|
@ -741,7 +741,7 @@ void VToolSeamAllowance::InitNodes(const VPiece &detail, VMainGraphicsScene *sce
|
||||||
{
|
{
|
||||||
case (Tool::NodePoint):
|
case (Tool::NodePoint):
|
||||||
{
|
{
|
||||||
VNodePoint *tool = InitTool<VNodePoint>(scene, detail.GetPath().at(i));
|
VNodePoint *tool = InitTool<VNodePoint>(scene, detail.GetPath().at(i).GetId());
|
||||||
connect(tool, &VNodePoint::ShowContextMenu, this, &VToolSeamAllowance::contextMenuEvent);
|
connect(tool, &VNodePoint::ShowContextMenu, this, &VToolSeamAllowance::contextMenuEvent);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -812,17 +812,17 @@ template <typename Tool>
|
||||||
/**
|
/**
|
||||||
* @brief InitTool initial node item on scene
|
* @brief InitTool initial node item on scene
|
||||||
* @param scene pointer to scene.
|
* @param scene pointer to scene.
|
||||||
* @param node node of detail.
|
* @param toolId if of tool object.
|
||||||
*/
|
*/
|
||||||
Tool *VToolSeamAllowance::InitTool(VMainGraphicsScene *scene, const VPieceNode &node)
|
Tool *VToolSeamAllowance::InitTool(VMainGraphicsScene *scene, quint32 toolId)
|
||||||
{
|
{
|
||||||
QHash<quint32, VDataTool*>* tools = doc->getTools();
|
QHash<quint32, VDataTool*>* tools = doc->getTools();
|
||||||
SCASSERT(tools != nullptr);
|
SCASSERT(tools != nullptr);
|
||||||
Tool *tool = qobject_cast<Tool*>(tools->value(node.GetId()));
|
Tool *tool = qobject_cast<Tool*>(tools->value(toolId));
|
||||||
SCASSERT(tool != nullptr);
|
SCASSERT(tool != nullptr);
|
||||||
connect(tool, &Tool::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
|
connect(tool, &Tool::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
|
||||||
tool->setParentItem(this);
|
tool->setParentItem(this);
|
||||||
tool->SetParentType(ParentType::Item);
|
tool->SetParentType(ParentType::Item);
|
||||||
doc->IncrementReferens(node.GetId());
|
doc->IncrementReferens(toolId);
|
||||||
return tool;
|
return tool;
|
||||||
}
|
}
|
||||||
|
|
|
@ -134,7 +134,7 @@ private:
|
||||||
void InitCSAPaths(const VPiece &detail);
|
void InitCSAPaths(const VPiece &detail);
|
||||||
|
|
||||||
template <typename Tool>
|
template <typename Tool>
|
||||||
Tool* InitTool(VMainGraphicsScene *scene, const VPieceNode &node);
|
Tool* InitTool(VMainGraphicsScene *scene, quint32 toolId);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // VTOOLSEAMALLOWANCE_H
|
#endif // VTOOLSEAMALLOWANCE_H
|
||||||
|
|
Loading…
Reference in New Issue
Block a user