diff --git a/src/app/valentina/xml/vpattern.cpp b/src/app/valentina/xml/vpattern.cpp index a7bad80df..e7d0bd65e 100644 --- a/src/app/valentina/xml/vpattern.cpp +++ b/src/app/valentina/xml/vpattern.cpp @@ -3115,35 +3115,91 @@ QRectF VPattern::ActiveDrawBoundingRect() const Q_UNREACHABLE(); break; case Tool::BasePoint: + rec = ToolBoundingRect(rec, tool.getId()); + break; case Tool::EndLine: + rec = ToolBoundingRect(rec, tool.getId()); + break; case Tool::Line: + rec = ToolBoundingRect(rec, tool.getId()); + break; case Tool::AlongLine: + rec = ToolBoundingRect(rec, tool.getId()); + break; case Tool::ShoulderPoint: + rec = ToolBoundingRect(rec, tool.getId()); + break; case Tool::Normal: + rec = ToolBoundingRect(rec, tool.getId()); + break; case Tool::Bisector: + rec = ToolBoundingRect(rec, tool.getId()); + break; case Tool::LineIntersect: + rec = ToolBoundingRect(rec, tool.getId()); + break; case Tool::Spline: + rec = ToolBoundingRect(rec, tool.getId()); + break; case Tool::CubicBezier: + rec = ToolBoundingRect(rec, tool.getId()); + break; case Tool::Arc: + rec = ToolBoundingRect(rec, tool.getId()); + break; case Tool::SplinePath: + rec = ToolBoundingRect(rec, tool.getId()); + break; case Tool::CubicBezierPath: + rec = ToolBoundingRect(rec, tool.getId()); + break; case Tool::PointOfContact: + rec = ToolBoundingRect(rec, tool.getId()); + break; case Tool::Height: + rec = ToolBoundingRect(rec, tool.getId()); + break; case Tool::Triangle: + rec = ToolBoundingRect(rec, tool.getId()); + break; case Tool::PointOfIntersection: + rec = ToolBoundingRect(rec, tool.getId()); + break; case Tool::CutArc: + rec = ToolBoundingRect(rec, tool.getId()); + break; case Tool::CutSpline: + rec = ToolBoundingRect(rec, tool.getId()); + break; case Tool::CutSplinePath: + rec = ToolBoundingRect(rec, tool.getId()); + break; case Tool::ArcWithLength: + rec = ToolBoundingRect(rec, tool.getId()); + break; case Tool::LineIntersectAxis: + rec = ToolBoundingRect(rec, tool.getId()); + break; case Tool::PointOfIntersectionArcs: + rec = ToolBoundingRect(rec, tool.getId()); + break; case Tool::PointOfIntersectionCircles: + rec = ToolBoundingRect(rec, tool.getId()); + break; case Tool::PointOfIntersectionCurves: + rec = ToolBoundingRect(rec, tool.getId()); + break; case Tool::CurveIntersectAxis: + rec = ToolBoundingRect(rec, tool.getId()); + break; case Tool::PointFromCircleAndTangent: + rec = ToolBoundingRect(rec, tool.getId()); + break; case Tool::PointFromArcAndTangent: + rec = ToolBoundingRect(rec, tool.getId()); + break; case Tool::TrueDarts: - rec = ToolBoundingRect(rec, tool.getId()); + rec = ToolBoundingRect(rec, tool.getId()); break; //These tools are not accesseble in Draw mode, but still 'history' contains them. case Tool::Detail: @@ -3164,12 +3220,13 @@ QRectF VPattern::ActiveDrawBoundingRect() const #endif //--------------------------------------------------------------------------------------------------------------------- +template QRectF VPattern::ToolBoundingRect(const QRectF &rec, const quint32 &id) const { QRectF recTool = rec; if (tools.contains(id)) { - const QGraphicsItem *vTool = qobject_cast(tools.value(id)); + const T *vTool = qobject_cast(tools.value(id)); SCASSERT(vTool != nullptr); QRectF childrenRect = vTool->childrenBoundingRect(); diff --git a/src/app/valentina/xml/vpattern.h b/src/app/valentina/xml/vpattern.h index 8471662ca..c65ccb6d1 100644 --- a/src/app/valentina/xml/vpattern.h +++ b/src/app/valentina/xml/vpattern.h @@ -135,6 +135,7 @@ private: void PointsCommonAttributes(const QDomElement &domElement, quint32 &id, qreal &mx, qreal &my); void SplinesCommonAttributes(const QDomElement &domElement, quint32 &id, quint32 &idObject, quint32 &idTool); + template QRectF ToolBoundingRect(const QRectF &rec, const quint32 &id) const; void ParseCurrentPP(); QString GetLabelBase(quint32 index)const;