From 75b125194bd82b7454f77c51a40ff8f8a86c7305 Mon Sep 17 00:00:00 2001 From: dismine Date: Thu, 2 Jan 2014 19:16:16 +0200 Subject: [PATCH] Tried fix some memory leaks. --HG-- branch : feature --- src/container/vcontainer.h | 2 +- src/tools/nodeDetails/vabstractnode.cpp | 4 ++-- src/tools/nodeDetails/vabstractnode.h | 2 +- src/tools/nodeDetails/vnodearc.cpp | 12 +++++++---- src/tools/nodeDetails/vnodearc.h | 5 +++-- src/tools/nodeDetails/vnodepoint.cpp | 18 +++++++++++----- src/tools/nodeDetails/vnodepoint.h | 6 ++++-- src/tools/nodeDetails/vnodespline.cpp | 13 ++++++++---- src/tools/nodeDetails/vnodespline.h | 5 +++-- src/tools/nodeDetails/vnodesplinepath.cpp | 14 ++++++++---- src/tools/nodeDetails/vnodesplinepath.h | 5 +++-- src/tools/vabstracttool.cpp | 4 ++-- src/tools/vabstracttool.h | 2 +- src/tools/vtooldetail.cpp | 2 +- src/tools/vtooldetail.h | 2 +- src/tools/vtooluniondetails.cpp | 26 ++++++++++++----------- src/tools/vtooluniondetails.h | 8 +++---- 17 files changed, 80 insertions(+), 50 deletions(-) diff --git a/src/container/vcontainer.h b/src/container/vcontainer.h index d4ef49161..87f5ce1ab 100644 --- a/src/container/vcontainer.h +++ b/src/container/vcontainer.h @@ -160,7 +160,7 @@ public: * @param name name of row of standart table * @param cell row of standart table */ - inline void AddStandartTableCell(const QString& name, VStandartTableRow cell) + inline void AddStandartTableCell(const QString& name, const VStandartTableRow &cell) {standartTable[name] = cell;} /** * @brief AddIncrementTableRow add new row of increment table diff --git a/src/tools/nodeDetails/vabstractnode.cpp b/src/tools/nodeDetails/vabstractnode.cpp index f2920e388..0b964aea2 100644 --- a/src/tools/nodeDetails/vabstractnode.cpp +++ b/src/tools/nodeDetails/vabstractnode.cpp @@ -33,8 +33,8 @@ const QString VAbstractNode::AttrIdObject = QStringLiteral("idObject"); const QString VAbstractNode::AttrIdTool = QStringLiteral("idTool"); VAbstractNode::VAbstractNode(VDomDocument *doc, VContainer *data, const qint64 &id, const qint64 &idNode, - const qint64 &idTool) - : VAbstractTool(doc, data, id), idNode(idNode), idTool(idTool) + const qint64 &idTool, QObject *parent) + : VAbstractTool(doc, data, id, parent), idNode(idNode), idTool(idTool) { _referens = 0; } diff --git a/src/tools/nodeDetails/vabstractnode.h b/src/tools/nodeDetails/vabstractnode.h index fce0527fe..f4726933f 100644 --- a/src/tools/nodeDetails/vabstractnode.h +++ b/src/tools/nodeDetails/vabstractnode.h @@ -47,7 +47,7 @@ public: * @param parent */ VAbstractNode(VDomDocument *doc, VContainer *data, const qint64 &id, const qint64 &idNode, - const qint64 &idTool); + const qint64 &idTool, QObject *parent = 0); virtual ~VAbstractNode() {} /** * @brief AttrIdObject diff --git a/src/tools/nodeDetails/vnodearc.cpp b/src/tools/nodeDetails/vnodearc.cpp index eb7244526..ae9d6a66c 100644 --- a/src/tools/nodeDetails/vnodearc.cpp +++ b/src/tools/nodeDetails/vnodearc.cpp @@ -34,8 +34,8 @@ const QString VNodeArc::TagName = QStringLiteral("arc"); const QString VNodeArc::ToolType = QStringLiteral("modeling"); VNodeArc::VNodeArc(VDomDocument *doc, VContainer *data, qint64 id, qint64 idArc, const Tool::Sources &typeCreation, - const qint64 &idTool, QGraphicsItem * parent) - :VAbstractNode(doc, data, id, idArc, idTool), QGraphicsPathItem(parent) + const qint64 &idTool, QObject *qoParent, QGraphicsItem *parent) + :VAbstractNode(doc, data, id, idArc, idTool, qoParent), QGraphicsPathItem(parent) { RefreshGeometry(); this->setPen(QPen(baseColor, widthHairLine)); @@ -51,17 +51,21 @@ VNodeArc::VNodeArc(VDomDocument *doc, VContainer *data, qint64 id, qint64 idArc, } void VNodeArc::Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idArc, const Document::Documents &parse, - const Tool::Sources &typeCreation, const qint64 &idTool) + const Tool::Sources &typeCreation, const qint64 &idTool, QObject *parent) { VAbstractTool::AddRecord(id, Tool::NodeArc, doc); if (parse == Document::FullParse) { - VNodeArc *arc = new VNodeArc(doc, data, id, idArc, typeCreation, idTool); + VNodeArc *arc = new VNodeArc(doc, data, id, idArc, typeCreation, idTool, parent); Q_ASSERT(arc != 0); doc->AddTool(id, arc); if(idTool != 0) { doc->IncrementReferens(idTool); + //Some nodes we don't show on scene. Tool that create this nodes must free memory. + VDataTool *tool = doc->getTool(idTool); + Q_ASSERT(tool != 0); + arc->setParent(tool); } else { diff --git a/src/tools/nodeDetails/vnodearc.h b/src/tools/nodeDetails/vnodearc.h index 1fe760f30..1e263a44f 100644 --- a/src/tools/nodeDetails/vnodearc.h +++ b/src/tools/nodeDetails/vnodearc.h @@ -49,7 +49,8 @@ public: * @param parent */ VNodeArc(VDomDocument *doc, VContainer *data, qint64 id, qint64 idArc, - const Tool::Sources &typeCreation, const qint64 &idTool = 0, QGraphicsItem * parent = 0); + const Tool::Sources &typeCreation, const qint64 &idTool = 0, QObject *qoParent = 0, + QGraphicsItem * parent = 0); /** * @brief Create * @param doc dom document container @@ -60,7 +61,7 @@ public: * @param typeCreation */ static void Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idArc, const Document::Documents &parse, - const Tool::Sources &typeCreation, const qint64 &idTool = 0); + const Tool::Sources &typeCreation, const qint64 &idTool = 0, QObject *parent = 0); /** * @brief TagName */ diff --git a/src/tools/nodeDetails/vnodepoint.cpp b/src/tools/nodeDetails/vnodepoint.cpp index aaf0bd1a7..1a2f63f59 100644 --- a/src/tools/nodeDetails/vnodepoint.cpp +++ b/src/tools/nodeDetails/vnodepoint.cpp @@ -34,9 +34,10 @@ const QString VNodePoint::TagName = QStringLiteral("point"); const QString VNodePoint::ToolType = QStringLiteral("modeling"); VNodePoint::VNodePoint(VDomDocument *doc, VContainer *data, qint64 id, qint64 idPoint, - const Tool::Sources &typeCreation, const qint64 &idTool, QGraphicsItem *parent) - :VAbstractNode(doc, data, id, idPoint, idTool), QGraphicsEllipseItem(parent), radius(toPixel(1.5)), namePoint(0), - lineName(0) + const Tool::Sources &typeCreation, const qint64 &idTool, QObject *qoParent, + QGraphicsItem *parent) + :VAbstractNode(doc, data, id, idPoint, idTool, qoParent), QGraphicsEllipseItem(parent), radius(toPixel(1.5)), + namePoint(0), lineName(0) { namePoint = new VGraphicsSimpleTextItem(this); lineName = new QGraphicsLineItem(this); @@ -58,17 +59,24 @@ VNodePoint::VNodePoint(VDomDocument *doc, VContainer *data, qint64 id, qint64 id } void VNodePoint::Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idPoint, - const Document::Documents &parse, const Tool::Sources &typeCreation, const qint64 &idTool) + const Document::Documents &parse, const Tool::Sources &typeCreation, const qint64 &idTool, + QObject *parent) { VAbstractTool::AddRecord(id, Tool::NodePoint, doc); if (parse == Document::FullParse) { - VNodePoint *point = new VNodePoint(doc, data, id, idPoint, typeCreation, idTool); + //TODO Need create garbage collector and remove all nodes, that we don't use. + //Better check garbage before each saving file. Check only modeling tags. + VNodePoint *point = new VNodePoint(doc, data, id, idPoint, typeCreation, idTool, parent); Q_ASSERT(point != 0); doc->AddTool(id, point); if(idTool != 0) { doc->IncrementReferens(idTool); + //Some nodes we don't show on scene. Tool that create this nodes must free memory. + VDataTool *tool = doc->getTool(idTool); + Q_ASSERT(tool != 0); + point->setParent(tool); } else { diff --git a/src/tools/nodeDetails/vnodepoint.h b/src/tools/nodeDetails/vnodepoint.h index 2657ec20d..ba95a89b6 100644 --- a/src/tools/nodeDetails/vnodepoint.h +++ b/src/tools/nodeDetails/vnodepoint.h @@ -49,7 +49,8 @@ public: * @param parent */ VNodePoint(VDomDocument *doc, VContainer *data, qint64 id, qint64 idPoint, - const Tool::Sources &typeCreation, const qint64 &idTool = 0, QGraphicsItem * parent = 0 ); + const Tool::Sources &typeCreation, const qint64 &idTool = 0, QObject *qoParent = 0, + QGraphicsItem * parent = 0 ); /** * @brief Create * @param doc dom document container @@ -60,7 +61,8 @@ public: * @param typeCreation */ static void Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idPoint, - const Document::Documents &parse, const Tool::Sources &typeCreation, const qint64 &idTool = 0); + const Document::Documents &parse, const Tool::Sources &typeCreation, const qint64 &idTool = 0, + QObject *parent = 0); /** * @brief TagName */ diff --git a/src/tools/nodeDetails/vnodespline.cpp b/src/tools/nodeDetails/vnodespline.cpp index 8916c819b..22255e243 100644 --- a/src/tools/nodeDetails/vnodespline.cpp +++ b/src/tools/nodeDetails/vnodespline.cpp @@ -34,8 +34,9 @@ const QString VNodeSpline::TagName = QStringLiteral("spline"); const QString VNodeSpline::ToolType = QStringLiteral("modelingSpline"); VNodeSpline::VNodeSpline(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, - const Tool::Sources &typeCreation, const qint64 &idTool, QGraphicsItem * parent) - :VAbstractNode(doc, data, id, idSpline, idTool), QGraphicsPathItem(parent) + const Tool::Sources &typeCreation, const qint64 &idTool, QObject *qoParent, + QGraphicsItem * parent) + :VAbstractNode(doc, data, id, idSpline, idTool, qoParent), QGraphicsPathItem(parent) { RefreshGeometry(); this->setPen(QPen(baseColor, widthHairLine)); @@ -52,17 +53,21 @@ VNodeSpline::VNodeSpline(VDomDocument *doc, VContainer *data, qint64 id, qint64 VNodeSpline *VNodeSpline::Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, const Document::Documents &parse, const Tool::Sources &typeCreation, - const qint64 &idTool) + const qint64 &idTool, QObject *parent) { VAbstractTool::AddRecord(id, Tool::NodeSpline, doc); VNodeSpline *spl = 0; if (parse == Document::FullParse) { - spl = new VNodeSpline(doc, data, id, idSpline, typeCreation, idTool); + spl = new VNodeSpline(doc, data, id, idSpline, typeCreation, idTool, parent); doc->AddTool(id, spl); if(idTool != 0) { doc->IncrementReferens(idTool); + //Some nodes we don't show on scene. Tool that create this nodes must free memory. + VDataTool *tool = doc->getTool(idTool); + Q_ASSERT(tool != 0); + spl->setParent(tool); } else { diff --git a/src/tools/nodeDetails/vnodespline.h b/src/tools/nodeDetails/vnodespline.h index 1c42e4f7b..36426b92e 100644 --- a/src/tools/nodeDetails/vnodespline.h +++ b/src/tools/nodeDetails/vnodespline.h @@ -49,7 +49,8 @@ public: * @param parent */ VNodeSpline(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, - const Tool::Sources &typeCreation, const qint64 &idTool = 0, QGraphicsItem * parent = 0); + const Tool::Sources &typeCreation, const qint64 &idTool = 0, QObject *qoParent = 0, + QGraphicsItem * parent = 0); /** * @brief Create * @param doc dom document container @@ -62,7 +63,7 @@ public: */ static VNodeSpline *Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, const Document::Documents &parse, const Tool::Sources &typeCreation, - const qint64 &idTool = 0); + const qint64 &idTool = 0, QObject *parent = 0); /** * @brief TagName */ diff --git a/src/tools/nodeDetails/vnodesplinepath.cpp b/src/tools/nodeDetails/vnodesplinepath.cpp index 020de500d..f73420ee6 100644 --- a/src/tools/nodeDetails/vnodesplinepath.cpp +++ b/src/tools/nodeDetails/vnodesplinepath.cpp @@ -34,8 +34,9 @@ const QString VNodeSplinePath::TagName = QStringLiteral("spline"); const QString VNodeSplinePath::ToolType = QStringLiteral("modelingPath"); VNodeSplinePath::VNodeSplinePath(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, - const Tool::Sources &typeCreation, const qint64 &idTool, QGraphicsItem * parent) - :VAbstractNode(doc, data, id, idSpline, idTool), QGraphicsPathItem(parent) + const Tool::Sources &typeCreation, const qint64 &idTool, QObject *qoParent, + QGraphicsItem * parent) + :VAbstractNode(doc, data, id, idSpline, idTool, qoParent), QGraphicsPathItem(parent) { RefreshGeometry(); this->setPen(QPen(baseColor, widthHairLine)); @@ -51,12 +52,13 @@ VNodeSplinePath::VNodeSplinePath(VDomDocument *doc, VContainer *data, qint64 id, } void VNodeSplinePath::Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, - const Document::Documents &parse, const Tool::Sources &typeCreation, const qint64 &idTool) + const Document::Documents &parse, const Tool::Sources &typeCreation, const qint64 &idTool, + QObject *parent) { VAbstractTool::AddRecord(id, Tool::NodeSplinePath, doc); if (parse == Document::FullParse) { - VNodeSplinePath *splPath = new VNodeSplinePath(doc, data, id, idSpline, typeCreation, idTool); + VNodeSplinePath *splPath = new VNodeSplinePath(doc, data, id, idSpline, typeCreation, idTool, parent); Q_ASSERT(splPath != 0); doc->AddTool(id, splPath); const VSplinePath *path = data->GeometricObject(id); @@ -66,6 +68,10 @@ void VNodeSplinePath::Create(VDomDocument *doc, VContainer *data, qint64 id, qin if(idTool != 0) { doc->IncrementReferens(idTool); + //Some nodes we don't show on scene. Tool that create this nodes must free memory. + VDataTool *tool = doc->getTool(idTool); + Q_ASSERT(tool != 0); + splPath->setParent(tool); } else { diff --git a/src/tools/nodeDetails/vnodesplinepath.h b/src/tools/nodeDetails/vnodesplinepath.h index 7ffcbaee6..2d7721442 100644 --- a/src/tools/nodeDetails/vnodesplinepath.h +++ b/src/tools/nodeDetails/vnodesplinepath.h @@ -49,7 +49,7 @@ public: * @param parent */ VNodeSplinePath(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, - const Tool::Sources &typeCreation, const qint64 &idTool = 0, + const Tool::Sources &typeCreation, const qint64 &idTool = 0, QObject *qoParent = 0, QGraphicsItem * parent = 0); /** * @brief Create @@ -61,7 +61,8 @@ public: * @param typeCreation */ static void Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, - const Document::Documents &parse, const Tool::Sources &typeCreation, const qint64 &idTool = 0); + const Document::Documents &parse, const Tool::Sources &typeCreation, const qint64 &idTool = 0, + QObject *parent = 0); /** * @brief TagName */ diff --git a/src/tools/vabstracttool.cpp b/src/tools/vabstracttool.cpp index 5fc75916f..62e5260f6 100644 --- a/src/tools/vabstracttool.cpp +++ b/src/tools/vabstracttool.cpp @@ -65,8 +65,8 @@ const QString VAbstractTool::AttrAxisP2 = QStringLiteral("axisP2"); const QString VAbstractTool::TypeLineNone = QStringLiteral("none"); const QString VAbstractTool::TypeLineLine = QStringLiteral("hair"); -VAbstractTool::VAbstractTool(VDomDocument *doc, VContainer *data, qint64 id) - :VDataTool(data), doc(doc), id(id), baseColor(Qt::black), currentColor(Qt::black) +VAbstractTool::VAbstractTool(VDomDocument *doc, VContainer *data, qint64 id, QObject *parent) + :VDataTool(data, parent), doc(doc), id(id), baseColor(Qt::black), currentColor(Qt::black) { Q_ASSERT(doc != 0); connect(this, &VAbstractTool::toolhaveChange, this->doc, &VDomDocument::haveLiteChange); diff --git a/src/tools/vabstracttool.h b/src/tools/vabstracttool.h index 8d6412db7..109ce08a4 100644 --- a/src/tools/vabstracttool.h +++ b/src/tools/vabstracttool.h @@ -46,7 +46,7 @@ public: * @param id * @param parent */ - VAbstractTool(VDomDocument *doc, VContainer *data, qint64 id); + VAbstractTool(VDomDocument *doc, VContainer *data, qint64 id, QObject *parent = 0); virtual ~VAbstractTool() {} /** * @brief LineIntersectRect diff --git a/src/tools/vtooldetail.cpp b/src/tools/vtooldetail.cpp index f71db07a8..dc4198f91 100644 --- a/src/tools/vtooldetail.cpp +++ b/src/tools/vtooldetail.cpp @@ -130,7 +130,7 @@ void VToolDetail::Create(QSharedPointer &dialog, VMainGraphicsScen Create(0, det, scene, doc, data, Document::FullParse, Tool::FromGui); } -void VToolDetail::Create(const qint64 _id, VDetail newDetail, VMainGraphicsScene *scene, VDomDocument *doc, +void VToolDetail::Create(const qint64 &_id, const VDetail &newDetail, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation) { qint64 id = _id; diff --git a/src/tools/vtooldetail.h b/src/tools/vtooldetail.h index 5b9891af1..5ec8032a6 100644 --- a/src/tools/vtooldetail.h +++ b/src/tools/vtooldetail.h @@ -84,7 +84,7 @@ public: * @param parse * @param typeCreation */ - static void Create(const qint64 _id, VDetail newDetail, VMainGraphicsScene *scene, + static void Create(const qint64 &_id, const VDetail &newDetail, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation); template diff --git a/src/tools/vtooluniondetails.cpp b/src/tools/vtooluniondetails.cpp index 1c62d666f..b7b30cb5e 100644 --- a/src/tools/vtooluniondetails.cpp +++ b/src/tools/vtooluniondetails.cpp @@ -43,8 +43,8 @@ const QString VToolUnionDetails::NodeTypeModeling = QStringLiteral("Modeling"); VToolUnionDetails::VToolUnionDetails(VDomDocument *doc, VContainer *data, const qint64 &id, const VDetail &d1, const VDetail &d2, const ptrdiff_t &indexD1, const ptrdiff_t &indexD2, - const Tool::Sources &typeCreation) - :VAbstractTool(doc, data, id), d1(d1), d2(d2), indexD1(indexD1), indexD2(indexD2) + const Tool::Sources &typeCreation, QObject *parent) + :VAbstractTool(doc, data, id, parent), d1(d1), d2(d2), indexD1(indexD1), indexD2(indexD2) { if (typeCreation == Tool::FromGui) { @@ -56,9 +56,9 @@ VToolUnionDetails::VToolUnionDetails(VDomDocument *doc, VContainer *data, const } } -void VToolUnionDetails::AddToNewDetail(VDomDocument *doc, VContainer *data, VDetail &newDetail, const VDetail &det, - const ptrdiff_t &i, const qint64 &idTool, const qreal &dx, const qreal &dy, - const qint64 &pRotate, const qreal &angle) +void VToolUnionDetails::AddToNewDetail(QObject *tool, VDomDocument *doc, VContainer *data, VDetail &newDetail, + const VDetail &det, const ptrdiff_t &i, const qint64 &idTool, const qreal &dx, + const qreal &dy, const qint64 &pRotate, const qreal &angle) { qint64 id = 0, idObject = 0; switch (det.at(i).getTypeTool()) @@ -81,7 +81,7 @@ void VToolUnionDetails::AddToNewDetail(VDomDocument *doc, VContainer *data, VDet Q_ASSERT(point1 != 0); point1->setMode(Draw::Modeling); id = data->AddGObject(point1); - VNodePoint::Create(doc, data, id, idObject, Document::FullParse, Tool::FromGui, idTool); + VNodePoint::Create(doc, data, id, idObject, Document::FullParse, Tool::FromGui, idTool, tool); } } break; @@ -119,7 +119,7 @@ void VToolUnionDetails::AddToNewDetail(VDomDocument *doc, VContainer *data, VDet arc2->setMode(Draw::Modeling); id = data->AddGObject(arc2); - VNodeArc::Create(doc, data, id, idObject, Document::FullParse, Tool::FromGui, idTool); + VNodeArc::Create(doc, data, id, idObject, Document::FullParse, Tool::FromGui, idTool, tool); } } break; @@ -158,7 +158,7 @@ void VToolUnionDetails::AddToNewDetail(VDomDocument *doc, VContainer *data, VDet Q_ASSERT(spl1 != 0); spl1->setMode(Draw::Modeling); idObject = data->AddGObject(spl1); - VNodeSpline::Create(doc, data, id, idObject, Document::FullParse, Tool::FromGui, idTool); + VNodeSpline::Create(doc, data, id, idObject, Document::FullParse, Tool::FromGui, idTool, tool); } } break; @@ -215,7 +215,7 @@ void VToolUnionDetails::AddToNewDetail(VDomDocument *doc, VContainer *data, VDet Q_ASSERT(path1 != 0); path1->setMode(Draw::Modeling); id = data->AddGObject(path1); - VNodeSplinePath::Create(doc, data, id, idObject, Document::FullParse, Tool::FromGui, idTool); + VNodeSplinePath::Create(doc, data, id, idObject, Document::FullParse, Tool::FromGui, idTool, tool); } } break; @@ -390,6 +390,7 @@ void VToolUnionDetails::Create(const qint64 _id, const VDetail &d1, const VDetai VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation) { + VToolUnionDetails *unionDetails = 0; qint64 id = _id; if (typeCreation == Tool::FromGui) { @@ -405,7 +406,8 @@ void VToolUnionDetails::Create(const qint64 _id, const VDetail &d1, const VDetai VAbstractTool::AddRecord(id, Tool::UnionDetails, doc); if (parse == Document::FullParse) { - VToolUnionDetails *unionDetails = new VToolUnionDetails(doc, data, id, d1, d2, indexD1, indexD2, typeCreation); + //Scene doesn't show this tool, so doc will destroy this object. + unionDetails = new VToolUnionDetails(doc, data, id, d1, d2, indexD1, indexD2, typeCreation, doc); QHash* tools = doc->getTools(); tools->insert(id, unionDetails); for (ptrdiff_t i = 0; i < d1.CountNode(); ++i) @@ -429,7 +431,7 @@ void VToolUnionDetails::Create(const qint64 _id, const VDetail &d1, const VDetai do { - AddToNewDetail(doc, data, newDetail, d1, i, id); + AddToNewDetail(unionDetails, doc, data, newDetail, d1, i, id); ++i; if (i > indexD1 && pointsD2 < nD2-2) { @@ -483,7 +485,7 @@ void VToolUnionDetails::Create(const qint64 _id, const VDetail &d1, const VDetai { j=0; } - AddToNewDetail(doc, data, newDetail, d2, j, id, dx, dy, det1p1.getId(), angle); + AddToNewDetail(unionDetails, doc, data, newDetail, d2, j, id, dx, dy, det1p1.getId(), angle); ++pointsD2; ++j; } while (pointsD2 < nD2); diff --git a/src/tools/vtooluniondetails.h b/src/tools/vtooluniondetails.h index 225ebc4bd..4d5b8af37 100644 --- a/src/tools/vtooluniondetails.h +++ b/src/tools/vtooluniondetails.h @@ -38,7 +38,7 @@ class VToolUnionDetails : public VAbstractTool public: VToolUnionDetails(VDomDocument *doc, VContainer *data, const qint64 &id, const VDetail &d1, const VDetail &d2, const ptrdiff_t &indexD1, const ptrdiff_t &indexD2, - const Tool::Sources &typeCreation); + const Tool::Sources &typeCreation, QObject *parent = 0); virtual void setDialog() {} /** * @brief Create @@ -77,9 +77,9 @@ public: static const QString NodeTypeContour; static const QString NodeTypeModeling; - static void AddToNewDetail(VDomDocument *doc, VContainer *data, VDetail &newDetail, const VDetail &det, - const ptrdiff_t &i, const qint64 &idTool, const qreal &dx = 0, const qreal &dy = 0, - const qint64 &pRotate = 0, const qreal &angle = 0); + static void AddToNewDetail(QObject *tool, VDomDocument *doc, VContainer *data, VDetail &newDetail, + const VDetail &det, const ptrdiff_t &i, const qint64 &idTool, const qreal &dx = 0, + const qreal &dy = 0, const qint64 &pRotate = 0, const qreal &angle = 0); static void UpdatePoints(const qint64 &idDetail, VContainer *data, const VDetail &det, const ptrdiff_t &i, qint64 &idCount, const qreal &dx = 0, const qreal &dy = 0, const qint64 &pRotate = 0, const qreal &angle = 0);