diff --git a/src/libs/vtools/tools/drawTools/operation/flipping/vtoolflippingbyaxis.cpp b/src/libs/vtools/tools/drawTools/operation/flipping/vtoolflippingbyaxis.cpp index 42d22be86..efebbbfa4 100644 --- a/src/libs/vtools/tools/drawTools/operation/flipping/vtoolflippingbyaxis.cpp +++ b/src/libs/vtools/tools/drawTools/operation/flipping/vtoolflippingbyaxis.cpp @@ -174,7 +174,7 @@ void VToolFlippingByAxis::ShowVisualization(bool show) //--------------------------------------------------------------------------------------------------------------------- void VToolFlippingByAxis::SetVisualization() { - if (vis != nullptr) + if (not vis.isNull()) { VisToolFlippingByAxis *visual = qobject_cast(vis); SCASSERT(visual != nullptr); diff --git a/src/libs/vtools/tools/drawTools/operation/flipping/vtoolflippingbyline.cpp b/src/libs/vtools/tools/drawTools/operation/flipping/vtoolflippingbyline.cpp index 3b2165e14..3d0a9c443 100644 --- a/src/libs/vtools/tools/drawTools/operation/flipping/vtoolflippingbyline.cpp +++ b/src/libs/vtools/tools/drawTools/operation/flipping/vtoolflippingbyline.cpp @@ -154,7 +154,7 @@ void VToolFlippingByLine::ShowVisualization(bool show) //--------------------------------------------------------------------------------------------------------------------- void VToolFlippingByLine::SetVisualization() { - if (vis != nullptr) + if (not vis.isNull()) { VisToolFlippingByLine *visual = qobject_cast(vis); SCASSERT(visual != nullptr); diff --git a/src/libs/vtools/tools/drawTools/operation/vabstractoperation.h b/src/libs/vtools/tools/drawTools/operation/vabstractoperation.h index e10123df3..7af49a93a 100644 --- a/src/libs/vtools/tools/drawTools/operation/vabstractoperation.h +++ b/src/libs/vtools/tools/drawTools/operation/vabstractoperation.h @@ -156,7 +156,7 @@ void VAbstractOperation::ShowToolVisualization(bool show) { if (show) { - if (vis == nullptr) + if (vis.isNull()) { AddVisualization(); SetVisualization(); @@ -172,7 +172,6 @@ void VAbstractOperation::ShowToolVisualization(bool show) else { delete vis; - vis = nullptr; } } diff --git a/src/libs/vtools/tools/drawTools/operation/vtoolrotation.cpp b/src/libs/vtools/tools/drawTools/operation/vtoolrotation.cpp index a02019573..8959868bc 100644 --- a/src/libs/vtools/tools/drawTools/operation/vtoolrotation.cpp +++ b/src/libs/vtools/tools/drawTools/operation/vtoolrotation.cpp @@ -285,7 +285,7 @@ void VToolRotation::ShowVisualization(bool show) //--------------------------------------------------------------------------------------------------------------------- void VToolRotation::SetVisualization() { - if (vis != nullptr) + if (not vis.isNull()) { VisToolRotation *visual = qobject_cast(vis); SCASSERT(visual != nullptr); diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vabstractspline.h b/src/libs/vtools/tools/drawTools/toolcurve/vabstractspline.h index e793ef6f6..cabef4603 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vabstractspline.h +++ b/src/libs/vtools/tools/drawTools/toolcurve/vabstractspline.h @@ -144,7 +144,7 @@ inline void VAbstractSpline::ShowToolVisualization(bool show) { if (show) { - if (vis == nullptr) + if (vis.isNull()) { AddVisualization(); SetVisualization(); @@ -160,7 +160,6 @@ inline void VAbstractSpline::ShowToolVisualization(bool show) else { delete vis; - vis = nullptr; } if (detailsMode) diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolarc.cpp b/src/libs/vtools/tools/drawTools/toolcurve/vtoolarc.cpp index 4ae142e39..39327b779 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolarc.cpp +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolarc.cpp @@ -365,7 +365,7 @@ void VToolArc::SaveOptions(QDomElement &tag, QSharedPointer &obj) //--------------------------------------------------------------------------------------------------------------------- void VToolArc::SetVisualization() { - if (vis != nullptr) + if (not vis.isNull()) { const QSharedPointer arc = VAbstractTool::data.GeometricObject(id); VisToolArc *visual = qobject_cast(vis); diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolarcwithlength.cpp b/src/libs/vtools/tools/drawTools/toolcurve/vtoolarcwithlength.cpp index 0b1ea3239..03ce82bdb 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolarcwithlength.cpp +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolarcwithlength.cpp @@ -322,7 +322,7 @@ void VToolArcWithLength::SaveOptions(QDomElement &tag, QSharedPointer //--------------------------------------------------------------------------------------------------------------------- void VToolArcWithLength::SetVisualization() { - if (vis != nullptr) + if (not vis.isNull()) { const QSharedPointer arc = VAbstractTool::data.GeometricObject(id); VisToolArcWithLength *visual = qobject_cast(vis); diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezier.cpp b/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezier.cpp index 50f46413b..e074b103d 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezier.cpp +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezier.cpp @@ -216,7 +216,7 @@ void VToolCubicBezier::SaveOptions(QDomElement &tag, QSharedPointer &o //--------------------------------------------------------------------------------------------------------------------- void VToolCubicBezier::SetVisualization() { - if (vis != nullptr) + if (not vis.isNull()) { auto visual = qobject_cast(vis); SCASSERT(visual != nullptr); diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezierpath.cpp b/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezierpath.cpp index 5a990592d..89b5dafac 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezierpath.cpp +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezierpath.cpp @@ -226,7 +226,7 @@ void VToolCubicBezierPath::SaveOptions(QDomElement &tag, QSharedPointer(vis); SCASSERT(visual != nullptr); diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolspline.cpp b/src/libs/vtools/tools/drawTools/toolcurve/vtoolspline.cpp index a4943d1a9..b48024c1f 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolspline.cpp +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolspline.cpp @@ -500,7 +500,7 @@ void VToolSpline::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) //--------------------------------------------------------------------------------------------------------------------- void VToolSpline::SetVisualization() { - if (vis != nullptr) + if (not vis.isNull()) { VisToolSpline *visual = qobject_cast(vis); SCASSERT(visual != nullptr); diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolsplinepath.cpp b/src/libs/vtools/tools/drawTools/toolcurve/vtoolsplinepath.cpp index e58082042..0da7aa71f 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolsplinepath.cpp +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolsplinepath.cpp @@ -621,7 +621,7 @@ void VToolSplinePath::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) //--------------------------------------------------------------------------------------------------------------------- void VToolSplinePath::SetVisualization() { - if (vis != nullptr) + if (not vis.isNull()) { VisToolSplinePath *visual = qobject_cast(vis); SCASSERT(visual != nullptr); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/tooldoublepoint/vtooltruedarts.cpp b/src/libs/vtools/tools/drawTools/toolpoint/tooldoublepoint/vtooltruedarts.cpp index 3548363b7..8b5d9187b 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/tooldoublepoint/vtooltruedarts.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/tooldoublepoint/vtooltruedarts.cpp @@ -376,7 +376,7 @@ void VToolTrueDarts::ReadToolAttributes(const QDomElement &domElement) //--------------------------------------------------------------------------------------------------------------------- void VToolTrueDarts::SetVisualization() { - if (vis != nullptr) + if (not vis.isNull()) { VisToolTrueDarts *visual = qobject_cast(vis); SCASSERT(visual != nullptr); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcut.h b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcut.h index 291e2f7cf..1cb1058b1 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcut.h +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcut.h @@ -89,7 +89,7 @@ inline void VToolCut::ShowToolVisualization(bool show) { if (show) { - if (vis == nullptr) + if (vis.isNull()) { AddVisualization(); SetVisualization(); @@ -105,7 +105,6 @@ inline void VToolCut::ShowToolVisualization(bool show) else { delete vis; - vis = nullptr; } if (VAbstractSpline *parentCurve = qobject_cast(doc->getTool(curveCutId))) { diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutarc.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutarc.cpp index 2069cf761..b3ee69974 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutarc.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutarc.cpp @@ -241,7 +241,7 @@ void VToolCutArc::ReadToolAttributes(const QDomElement &domElement) //--------------------------------------------------------------------------------------------------------------------- void VToolCutArc::SetVisualization() { - if (vis != nullptr) + if (not vis.isNull()) { VisToolCutArc *visual = qobject_cast(vis); SCASSERT(visual != nullptr); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.cpp index 7b0017c95..f58a42d8d 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.cpp @@ -241,7 +241,7 @@ void VToolCutSpline::ReadToolAttributes(const QDomElement &domElement) //--------------------------------------------------------------------------------------------------------------------- void VToolCutSpline::SetVisualization() { - if (vis != nullptr) + if (not vis.isNull()) { VisToolCutSpline *visual = qobject_cast(vis); SCASSERT(visual != nullptr); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.cpp index 0955bb05a..cdb998195 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.cpp @@ -329,7 +329,7 @@ void VToolCutSplinePath::ReadToolAttributes(const QDomElement &domElement) //--------------------------------------------------------------------------------------------------------------------- void VToolCutSplinePath::SetVisualization() { - if (vis != nullptr) + if (not vis.isNull()) { VisToolCutSplinePath *visual = qobject_cast(vis); SCASSERT(visual != nullptr); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolalongline.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolalongline.cpp index 098d5ca51..2963d28b5 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolalongline.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolalongline.cpp @@ -164,7 +164,7 @@ void VToolAlongLine::ReadToolAttributes(const QDomElement &domElement) //--------------------------------------------------------------------------------------------------------------------- void VToolAlongLine::SetVisualization() { - if (vis != nullptr) + if (not vis.isNull()) { VisToolAlongLine *visual = qobject_cast(vis); SCASSERT(visual != nullptr) diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolbisector.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolbisector.cpp index aeb7d651a..93eb1e5cc 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolbisector.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolbisector.cpp @@ -320,7 +320,7 @@ void VToolBisector::ReadToolAttributes(const QDomElement &domElement) //--------------------------------------------------------------------------------------------------------------------- void VToolBisector::SetVisualization() { - if (vis != nullptr) + if (not vis.isNull()) { VisToolBisector *visual = qobject_cast(vis); SCASSERT(visual != nullptr); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolcurveintersectaxis.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolcurveintersectaxis.cpp index c11517d78..e25800a43 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolcurveintersectaxis.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolcurveintersectaxis.cpp @@ -313,7 +313,7 @@ void VToolCurveIntersectAxis::ReadToolAttributes(const QDomElement &domElement) //--------------------------------------------------------------------------------------------------------------------- void VToolCurveIntersectAxis::SetVisualization() { - if (vis != nullptr) + if (not vis.isNull()) { VisToolCurveIntersectAxis *visual = qobject_cast(vis); SCASSERT(visual != nullptr); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolendline.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolendline.cpp index 43843c392..75d8e0057 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolendline.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolendline.cpp @@ -254,7 +254,7 @@ void VToolEndLine::ReadToolAttributes(const QDomElement &domElement) //--------------------------------------------------------------------------------------------------------------------- void VToolEndLine::SetVisualization() { - if (vis != nullptr) + if (not vis.isNull()) { VisToolEndLine *visual = qobject_cast(vis); SCASSERT(visual != nullptr); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolheight.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolheight.cpp index 3b8434869..dc9842c52 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolheight.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolheight.cpp @@ -261,7 +261,7 @@ void VToolHeight::ReadToolAttributes(const QDomElement &domElement) //--------------------------------------------------------------------------------------------------------------------- void VToolHeight::SetVisualization() { - if (vis != nullptr) + if (not vis.isNull()) { VisToolHeight *visual = qobject_cast(vis); SCASSERT(visual != nullptr); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollineintersectaxis.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollineintersectaxis.cpp index 0c26c4fb8..507babace 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollineintersectaxis.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollineintersectaxis.cpp @@ -313,7 +313,7 @@ void VToolLineIntersectAxis::ReadToolAttributes(const QDomElement &domElement) //--------------------------------------------------------------------------------------------------------------------- void VToolLineIntersectAxis::SetVisualization() { - if (vis != nullptr) + if (not vis.isNull()) { VisToolLineIntersectAxis *visual = qobject_cast(vis); SCASSERT(visual != nullptr); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolnormal.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolnormal.cpp index 2a772b58b..4257ffc96 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolnormal.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolnormal.cpp @@ -295,7 +295,7 @@ void VToolNormal::ReadToolAttributes(const QDomElement &domElement) //--------------------------------------------------------------------------------------------------------------------- void VToolNormal::SetVisualization() { - if (vis != nullptr) + if (not vis.isNull()) { VisToolNormal *visual = qobject_cast(vis); SCASSERT(visual != nullptr); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolshoulderpoint.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolshoulderpoint.cpp index 7a5bb7d55..7c73bb109 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolshoulderpoint.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolshoulderpoint.cpp @@ -326,7 +326,7 @@ void VToolShoulderPoint::ReadToolAttributes(const QDomElement &domElement) //--------------------------------------------------------------------------------------------------------------------- void VToolShoulderPoint::SetVisualization() { - if (vis != nullptr) + if (not vis.isNull()) { VisToolShoulderPoint *visual = qobject_cast(vis); SCASSERT(visual != nullptr); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoollineintersect.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoollineintersect.cpp index 662801242..482f6d69e 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoollineintersect.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoollineintersect.cpp @@ -286,7 +286,7 @@ void VToolLineIntersect::ReadToolAttributes(const QDomElement &domElement) //--------------------------------------------------------------------------------------------------------------------- void VToolLineIntersect::SetVisualization() { - if (vis != nullptr) + if (not vis.isNull()) { VisToolLineIntersect *visual = qobject_cast(vis); SCASSERT(visual != nullptr); @@ -295,7 +295,7 @@ void VToolLineIntersect::SetVisualization() visual->setLine1P2Id(p2Line1); visual->setLine2P1Id(p1Line2); visual->setLine2P2Id(p2Line2); - vis->RefreshGeometry(); + visual->RefreshGeometry(); } } diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromarcandtangent.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromarcandtangent.cpp index b4f405e5c..91f02cb89 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromarcandtangent.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromarcandtangent.cpp @@ -336,7 +336,7 @@ void VToolPointFromArcAndTangent::ReadToolAttributes(const QDomElement &domEleme //--------------------------------------------------------------------------------------------------------------------- void VToolPointFromArcAndTangent::SetVisualization() { - if (vis != nullptr) + if (not vis.isNull()) { VisToolPointFromArcAndTangent *visual = qobject_cast(vis); SCASSERT(visual != nullptr); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromcircleandtangent.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromcircleandtangent.cpp index e23e72d0a..88384ff46 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromcircleandtangent.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromcircleandtangent.cpp @@ -323,7 +323,7 @@ void VToolPointFromCircleAndTangent::ReadToolAttributes(const QDomElement &domEl //--------------------------------------------------------------------------------------------------------------------- void VToolPointFromCircleAndTangent::SetVisualization() { - if (vis != nullptr) + if (not vis.isNull()) { VisToolPointFromCircleAndTangent *visual = qobject_cast(vis); SCASSERT(visual != nullptr); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofcontact.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofcontact.cpp index e604a4a46..40d4ae4e0 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofcontact.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofcontact.cpp @@ -339,7 +339,7 @@ void VToolPointOfContact::ReadToolAttributes(const QDomElement &domElement) //--------------------------------------------------------------------------------------------------------------------- void VToolPointOfContact::SetVisualization() { - if (vis != nullptr) + if (not vis.isNull()) { VisToolPointOfContact *visual = qobject_cast(vis); SCASSERT(visual != nullptr); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersection.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersection.cpp index dfb57b4aa..b66c963e5 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersection.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersection.cpp @@ -237,7 +237,7 @@ void VToolPointOfIntersection::ReadToolAttributes(const QDomElement &domElement) //--------------------------------------------------------------------------------------------------------------------- void VToolPointOfIntersection::SetVisualization() { - if (vis != nullptr) + if (not vis.isNull()) { VisToolPointOfIntersection *visual = qobject_cast(vis); SCASSERT(visual != nullptr); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectionarcs.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectionarcs.cpp index 6c3c45edb..de622aa9f 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectionarcs.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectionarcs.cpp @@ -341,7 +341,7 @@ void VToolPointOfIntersectionArcs::ReadToolAttributes(const QDomElement &domElem //--------------------------------------------------------------------------------------------------------------------- void VToolPointOfIntersectionArcs::SetVisualization() { - if (vis != nullptr) + if (not vis.isNull()) { VisToolPointOfIntersectionArcs *visual = qobject_cast(vis); SCASSERT(visual != nullptr); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncircles.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncircles.cpp index b9a4cc29a..c85818732 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncircles.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncircles.cpp @@ -362,7 +362,7 @@ void VToolPointOfIntersectionCircles::ReadToolAttributes(const QDomElement &domE //--------------------------------------------------------------------------------------------------------------------- void VToolPointOfIntersectionCircles::SetVisualization() { - if (vis != nullptr) + if (not vis.isNull()) { VisToolPointOfIntersectionCircles *visual = qobject_cast(vis); SCASSERT(visual != nullptr); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncurves.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncurves.cpp index 6eb910b10..a26745a25 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncurves.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncurves.cpp @@ -404,7 +404,7 @@ void VToolPointOfIntersectionCurves::ReadToolAttributes(const QDomElement &domEl //--------------------------------------------------------------------------------------------------------------------- void VToolPointOfIntersectionCurves::SetVisualization() { - if (vis != nullptr) + if (not vis.isNull()) { auto visual = qobject_cast(vis); SCASSERT(visual != nullptr); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtooltriangle.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtooltriangle.cpp index 5933c03f0..e0ef255f4 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtooltriangle.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtooltriangle.cpp @@ -307,7 +307,7 @@ void VToolTriangle::ReadToolAttributes(const QDomElement &domElement) //--------------------------------------------------------------------------------------------------------------------- void VToolTriangle::SetVisualization() { - if (vis != nullptr) + if (not vis.isNull()) { VisToolTriangle * visual = qobject_cast(vis); SCASSERT(visual != nullptr); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/vabstractpoint.h b/src/libs/vtools/tools/drawTools/toolpoint/vabstractpoint.h index c7823a891..226fb2db2 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/vabstractpoint.h +++ b/src/libs/vtools/tools/drawTools/toolpoint/vabstractpoint.h @@ -95,7 +95,7 @@ void VAbstractPoint::ShowToolVisualization(bool show) { if (show) { - if (vis == nullptr) + if (vis.isNull()) { AddVisualization(); SetVisualization(); @@ -111,7 +111,6 @@ void VAbstractPoint::ShowToolVisualization(bool show) else { delete vis; - vis = nullptr; } } diff --git a/src/libs/vtools/tools/drawTools/vtoolline.cpp b/src/libs/vtools/tools/drawTools/vtoolline.cpp index 7c9eeb849..90463e809 100644 --- a/src/libs/vtools/tools/drawTools/vtoolline.cpp +++ b/src/libs/vtools/tools/drawTools/vtoolline.cpp @@ -319,7 +319,7 @@ void VToolLine::hoverEnterEvent(QGraphicsSceneHoverEvent *event) void VToolLine::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) { Q_UNUSED(event); - if (vis == nullptr) + if (vis.isNull()) { this->setPen(QPen(CorrectColor(lineColor), qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor, @@ -421,7 +421,7 @@ void VToolLine::ReadToolAttributes(const QDomElement &domElement) //--------------------------------------------------------------------------------------------------------------------- void VToolLine::SetVisualization() { - if (vis != nullptr) + if (not vis.isNull()) { VisToolLine *visual = qobject_cast(vis); SCASSERT(visual != nullptr); @@ -456,7 +456,7 @@ void VToolLine::ShowVisualization(bool show) { if (show) { - if (vis == nullptr) + if (vis.isNull()) { AddVisualization(); SetVisualization(); @@ -472,7 +472,6 @@ void VToolLine::ShowVisualization(bool show) else { delete vis; - vis = nullptr; hoverLeaveEvent(nullptr); } } diff --git a/src/libs/vtools/tools/vabstracttool.cpp b/src/libs/vtools/tools/vabstracttool.cpp index 29bb6d395..3fd582eef 100644 --- a/src/libs/vtools/tools/vabstracttool.cpp +++ b/src/libs/vtools/tools/vabstracttool.cpp @@ -83,7 +83,7 @@ const QString VAbstractTool::AttrInUse = QStringLiteral("inUse"); * @param parent parent object. */ VAbstractTool::VAbstractTool(VAbstractPattern *doc, VContainer *data, quint32 id, QObject *parent) - :VDataTool(data, parent), doc(doc), id(id), baseColor(Qt::black), vis(nullptr), + :VDataTool(data, parent), doc(doc), id(id), baseColor(Qt::black), vis(), selectionType(SelectionType::ByMouseRelease) { SCASSERT(doc != nullptr); @@ -94,7 +94,12 @@ VAbstractTool::VAbstractTool(VAbstractPattern *doc, VContainer *data, quint32 id //--------------------------------------------------------------------------------------------------------------------- VAbstractTool::~VAbstractTool() -{} +{ + if (not vis.isNull()) + { + delete vis; + } +} //--------------------------------------------------------------------------------------------------------------------- /** diff --git a/src/libs/vtools/tools/vabstracttool.h b/src/libs/vtools/tools/vabstracttool.h index 6247375cd..35aa07daa 100644 --- a/src/libs/vtools/tools/vabstracttool.h +++ b/src/libs/vtools/tools/vabstracttool.h @@ -122,7 +122,7 @@ protected: /** @brief baseColor base color for tool. */ Qt::GlobalColor baseColor; - Visualization *vis; + QPointer vis; SelectionType selectionType; /** @@ -182,8 +182,8 @@ inline void VAbstractTool::AddVisualization() connect(scene, &VMainGraphicsScene::NewFactor, visual, &Visualization::SetFactor); scene->addItem(visual); + connect(visual, &Visualization::ToolTip, [=] (const QString &toolTip) {emit ToolTip(toolTip);}); vis = visual; - connect(vis, &Visualization::ToolTip, [=] (const QString &toolTip) {emit ToolTip(toolTip);}); } #endif // VABSTRACTTOOL_H