From 9eac04654c3fa0b0c926cfc5077a1ba2e70e1826 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Wed, 10 Feb 2016 12:13:34 +0200 Subject: [PATCH] Refactoring. Always use AddTool method. --HG-- branch : develop --- src/app/valentina/mainwindow.cpp | 4 +--- src/libs/vtools/tools/vtooldetail.cpp | 3 +-- src/libs/vtools/tools/vtooluniondetails.cpp | 3 +-- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/app/valentina/mainwindow.cpp b/src/app/valentina/mainwindow.cpp index effd02107..80eefb518 100644 --- a/src/app/valentina/mainwindow.cpp +++ b/src/app/valentina/mainwindow.cpp @@ -244,9 +244,7 @@ void MainWindow::AddPP(const QString &PPName) connect(sceneDraw, &VMainGraphicsScene::NewFactor, spoint, &VToolBasePoint::SetFactor); connect(sceneDraw, &VMainGraphicsScene::EnableToolMove, spoint, &VToolBasePoint::EnableToolMove); - QHash* tools = doc->getTools(); - SCASSERT(tools != nullptr); - tools->insert(id, spoint); + doc->AddTool(id, spoint); VDrawTool::AddRecord(id, Tool::BasePoint, doc); SetEnableTool(true); SetEnableWidgets(true); diff --git a/src/libs/vtools/tools/vtooldetail.cpp b/src/libs/vtools/tools/vtooldetail.cpp index cb9509464..07f1fa3c4 100644 --- a/src/libs/vtools/tools/vtooldetail.cpp +++ b/src/libs/vtools/tools/vtooldetail.cpp @@ -235,8 +235,7 @@ void VToolDetail::Create(const quint32 &_id, const VDetail &newDetail, VMainGrap VToolDetail *detail = new VToolDetail(doc, data, id, typeCreation, scene, drawName); scene->addItem(detail); connect(detail, &VToolDetail::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); - QHash* tools = doc->getTools(); - tools->insert(id, detail); + doc->AddTool(id, detail); } } diff --git a/src/libs/vtools/tools/vtooluniondetails.cpp b/src/libs/vtools/tools/vtooluniondetails.cpp index 1e966fcd7..8ab87b7ce 100644 --- a/src/libs/vtools/tools/vtooluniondetails.cpp +++ b/src/libs/vtools/tools/vtooluniondetails.cpp @@ -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. unionDetails = new VToolUnionDetails(doc, data, id, d1, d2, indexD1, indexD2, typeCreation, drawName, doc); - QHash* tools = doc->getTools(); - tools->insert(id, unionDetails); + doc->AddTool(id, unionDetails); } //Then create new details VNodeDetail det1p1;