From 5a07871a8d73d7a035383e774f4fbbf7fb35a1f1 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Thu, 26 Oct 2017 17:22:12 +0300 Subject: [PATCH] Fix Tool union Reatin pieces option. --HG-- branch : feature --- src/libs/vtools/tools/vtooluniondetails.cpp | 35 ++++++++++++++++----- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/src/libs/vtools/tools/vtooluniondetails.cpp b/src/libs/vtools/tools/vtooluniondetails.cpp index 8eb89fb0d..bf3a395db 100644 --- a/src/libs/vtools/tools/vtooluniondetails.cpp +++ b/src/libs/vtools/tools/vtooluniondetails.cpp @@ -1538,19 +1538,38 @@ void CreateUnitedDetail(const VToolUnionDetailsInitData &initData, qreal dx, qre VToolSeamAllowance::Create(pieceInitData); - auto RemoveDetail = [initData](quint32 id) + auto DuplicateDetail = [initData](quint32 id) + { + VToolSeamAllowanceInitData initPieceData; + initPieceData.scene = initData.scene; + initPieceData.doc = initData.doc; + initPieceData.parse = Document::FullParse; + initPieceData.typeCreation = Source::FromGui; + initPieceData.drawName = initData.doc->PieceDrawName(id); + + VContainer toolData = VAbstractPattern::getTool(id)->getData(); + initPieceData.data = &toolData; + + initPieceData.detail = initData.data->GetPiece(id); + initPieceData.width = initPieceData.detail.GetFormulaSAWidth(); + VToolSeamAllowance::Duplicate(initPieceData); + }; + + if (initData.retainPieces) + { + DuplicateDetail(initData.d1id); + DuplicateDetail(initData.d2id); + } + + auto RemoveDetail = [](quint32 id) { VToolSeamAllowance *toolDet = qobject_cast(VAbstractPattern::getTool(id)); SCASSERT(toolDet != nullptr); - bool ask = false; - toolDet->RemoveWithConfirm(ask); + toolDet->RemoveWithConfirm(false); }; - if (not initData.retainPieces) - { - RemoveDetail(initData.d1id); - RemoveDetail(initData.d2id); - } + RemoveDetail(initData.d1id); + RemoveDetail(initData.d2id); } //---------------------------------------------------------------------------------------------------------------------