Refactoring. Always use AddTool method.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2016-02-10 12:13:34 +02:00
parent 1f15722417
commit 9eac04654c
3 changed files with 3 additions and 7 deletions

View File

@ -244,9 +244,7 @@ void MainWindow::AddPP(const QString &PPName)
connect(sceneDraw, &VMainGraphicsScene::NewFactor, spoint, &VToolBasePoint::SetFactor); connect(sceneDraw, &VMainGraphicsScene::NewFactor, spoint, &VToolBasePoint::SetFactor);
connect(sceneDraw, &VMainGraphicsScene::EnableToolMove, spoint, &VToolBasePoint::EnableToolMove); connect(sceneDraw, &VMainGraphicsScene::EnableToolMove, spoint, &VToolBasePoint::EnableToolMove);
QHash<quint32, VDataTool*>* tools = doc->getTools(); doc->AddTool(id, spoint);
SCASSERT(tools != nullptr);
tools->insert(id, spoint);
VDrawTool::AddRecord(id, Tool::BasePoint, doc); VDrawTool::AddRecord(id, Tool::BasePoint, doc);
SetEnableTool(true); SetEnableTool(true);
SetEnableWidgets(true); SetEnableWidgets(true);

View File

@ -235,8 +235,7 @@ void VToolDetail::Create(const quint32 &_id, const VDetail &newDetail, VMainGrap
VToolDetail *detail = new VToolDetail(doc, data, id, typeCreation, scene, drawName); VToolDetail *detail = new VToolDetail(doc, data, id, typeCreation, scene, drawName);
scene->addItem(detail); scene->addItem(detail);
connect(detail, &VToolDetail::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); connect(detail, &VToolDetail::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
QHash<quint32, VDataTool*>* tools = doc->getTools(); doc->AddTool(id, detail);
tools->insert(id, detail);
} }
} }

View File

@ -551,8 +551,7 @@ VToolUnionDetails* VToolUnionDetails::Create(const quint32 _id, const VDetail &d
{ {
//Scene doesn't show this tool, so doc will destroy this object. //Scene doesn't show this tool, so doc will destroy this object.
unionDetails = new VToolUnionDetails(doc, data, id, d1, d2, indexD1, indexD2, typeCreation, drawName, doc); unionDetails = new VToolUnionDetails(doc, data, id, d1, d2, indexD1, indexD2, typeCreation, drawName, doc);
QHash<quint32, VDataTool*>* tools = doc->getTools(); doc->AddTool(id, unionDetails);
tools->insert(id, unionDetails);
} }
//Then create new details //Then create new details
VNodeDetail det1p1; VNodeDetail det1p1;