Fix crash. Each tool should delete visualization even if scene also can delete
it. --HG-- branch : develop
This commit is contained in:
parent
2b26b986bc
commit
eee2144483
|
@ -174,7 +174,7 @@ void VToolFlippingByAxis::ShowVisualization(bool show)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolFlippingByAxis::SetVisualization()
|
void VToolFlippingByAxis::SetVisualization()
|
||||||
{
|
{
|
||||||
if (vis != nullptr)
|
if (not vis.isNull())
|
||||||
{
|
{
|
||||||
VisToolFlippingByAxis *visual = qobject_cast<VisToolFlippingByAxis *>(vis);
|
VisToolFlippingByAxis *visual = qobject_cast<VisToolFlippingByAxis *>(vis);
|
||||||
SCASSERT(visual != nullptr);
|
SCASSERT(visual != nullptr);
|
||||||
|
|
|
@ -154,7 +154,7 @@ void VToolFlippingByLine::ShowVisualization(bool show)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolFlippingByLine::SetVisualization()
|
void VToolFlippingByLine::SetVisualization()
|
||||||
{
|
{
|
||||||
if (vis != nullptr)
|
if (not vis.isNull())
|
||||||
{
|
{
|
||||||
VisToolFlippingByLine *visual = qobject_cast<VisToolFlippingByLine *>(vis);
|
VisToolFlippingByLine *visual = qobject_cast<VisToolFlippingByLine *>(vis);
|
||||||
SCASSERT(visual != nullptr);
|
SCASSERT(visual != nullptr);
|
||||||
|
|
|
@ -156,7 +156,7 @@ void VAbstractOperation::ShowToolVisualization(bool show)
|
||||||
{
|
{
|
||||||
if (show)
|
if (show)
|
||||||
{
|
{
|
||||||
if (vis == nullptr)
|
if (vis.isNull())
|
||||||
{
|
{
|
||||||
AddVisualization<T>();
|
AddVisualization<T>();
|
||||||
SetVisualization();
|
SetVisualization();
|
||||||
|
@ -172,7 +172,6 @@ void VAbstractOperation::ShowToolVisualization(bool show)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
delete vis;
|
delete vis;
|
||||||
vis = nullptr;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -285,7 +285,7 @@ void VToolRotation::ShowVisualization(bool show)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolRotation::SetVisualization()
|
void VToolRotation::SetVisualization()
|
||||||
{
|
{
|
||||||
if (vis != nullptr)
|
if (not vis.isNull())
|
||||||
{
|
{
|
||||||
VisToolRotation *visual = qobject_cast<VisToolRotation *>(vis);
|
VisToolRotation *visual = qobject_cast<VisToolRotation *>(vis);
|
||||||
SCASSERT(visual != nullptr);
|
SCASSERT(visual != nullptr);
|
||||||
|
|
|
@ -144,7 +144,7 @@ inline void VAbstractSpline::ShowToolVisualization(bool show)
|
||||||
{
|
{
|
||||||
if (show)
|
if (show)
|
||||||
{
|
{
|
||||||
if (vis == nullptr)
|
if (vis.isNull())
|
||||||
{
|
{
|
||||||
AddVisualization<T>();
|
AddVisualization<T>();
|
||||||
SetVisualization();
|
SetVisualization();
|
||||||
|
@ -160,7 +160,6 @@ inline void VAbstractSpline::ShowToolVisualization(bool show)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
delete vis;
|
delete vis;
|
||||||
vis = nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (detailsMode)
|
if (detailsMode)
|
||||||
|
|
|
@ -365,7 +365,7 @@ void VToolArc::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolArc::SetVisualization()
|
void VToolArc::SetVisualization()
|
||||||
{
|
{
|
||||||
if (vis != nullptr)
|
if (not vis.isNull())
|
||||||
{
|
{
|
||||||
const QSharedPointer<VArc> arc = VAbstractTool::data.GeometricObject<VArc>(id);
|
const QSharedPointer<VArc> arc = VAbstractTool::data.GeometricObject<VArc>(id);
|
||||||
VisToolArc *visual = qobject_cast<VisToolArc *>(vis);
|
VisToolArc *visual = qobject_cast<VisToolArc *>(vis);
|
||||||
|
|
|
@ -322,7 +322,7 @@ void VToolArcWithLength::SaveOptions(QDomElement &tag, QSharedPointer<VGObject>
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolArcWithLength::SetVisualization()
|
void VToolArcWithLength::SetVisualization()
|
||||||
{
|
{
|
||||||
if (vis != nullptr)
|
if (not vis.isNull())
|
||||||
{
|
{
|
||||||
const QSharedPointer<VArc> arc = VAbstractTool::data.GeometricObject<VArc>(id);
|
const QSharedPointer<VArc> arc = VAbstractTool::data.GeometricObject<VArc>(id);
|
||||||
VisToolArcWithLength *visual = qobject_cast<VisToolArcWithLength *>(vis);
|
VisToolArcWithLength *visual = qobject_cast<VisToolArcWithLength *>(vis);
|
||||||
|
|
|
@ -216,7 +216,7 @@ void VToolCubicBezier::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &o
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolCubicBezier::SetVisualization()
|
void VToolCubicBezier::SetVisualization()
|
||||||
{
|
{
|
||||||
if (vis != nullptr)
|
if (not vis.isNull())
|
||||||
{
|
{
|
||||||
auto visual = qobject_cast<VisToolCubicBezier *>(vis);
|
auto visual = qobject_cast<VisToolCubicBezier *>(vis);
|
||||||
SCASSERT(visual != nullptr);
|
SCASSERT(visual != nullptr);
|
||||||
|
|
|
@ -226,7 +226,7 @@ void VToolCubicBezierPath::SaveOptions(QDomElement &tag, QSharedPointer<VGObject
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolCubicBezierPath::SetVisualization()
|
void VToolCubicBezierPath::SetVisualization()
|
||||||
{
|
{
|
||||||
if (vis != nullptr)
|
if (not vis.isNull())
|
||||||
{
|
{
|
||||||
auto visual = qobject_cast<VisToolCubicBezierPath *>(vis);
|
auto visual = qobject_cast<VisToolCubicBezierPath *>(vis);
|
||||||
SCASSERT(visual != nullptr);
|
SCASSERT(visual != nullptr);
|
||||||
|
|
|
@ -500,7 +500,7 @@ void VToolSpline::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolSpline::SetVisualization()
|
void VToolSpline::SetVisualization()
|
||||||
{
|
{
|
||||||
if (vis != nullptr)
|
if (not vis.isNull())
|
||||||
{
|
{
|
||||||
VisToolSpline *visual = qobject_cast<VisToolSpline *>(vis);
|
VisToolSpline *visual = qobject_cast<VisToolSpline *>(vis);
|
||||||
SCASSERT(visual != nullptr);
|
SCASSERT(visual != nullptr);
|
||||||
|
|
|
@ -621,7 +621,7 @@ void VToolSplinePath::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolSplinePath::SetVisualization()
|
void VToolSplinePath::SetVisualization()
|
||||||
{
|
{
|
||||||
if (vis != nullptr)
|
if (not vis.isNull())
|
||||||
{
|
{
|
||||||
VisToolSplinePath *visual = qobject_cast<VisToolSplinePath *>(vis);
|
VisToolSplinePath *visual = qobject_cast<VisToolSplinePath *>(vis);
|
||||||
SCASSERT(visual != nullptr);
|
SCASSERT(visual != nullptr);
|
||||||
|
|
|
@ -376,7 +376,7 @@ void VToolTrueDarts::ReadToolAttributes(const QDomElement &domElement)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolTrueDarts::SetVisualization()
|
void VToolTrueDarts::SetVisualization()
|
||||||
{
|
{
|
||||||
if (vis != nullptr)
|
if (not vis.isNull())
|
||||||
{
|
{
|
||||||
VisToolTrueDarts *visual = qobject_cast<VisToolTrueDarts *>(vis);
|
VisToolTrueDarts *visual = qobject_cast<VisToolTrueDarts *>(vis);
|
||||||
SCASSERT(visual != nullptr);
|
SCASSERT(visual != nullptr);
|
||||||
|
|
|
@ -89,7 +89,7 @@ inline void VToolCut::ShowToolVisualization(bool show)
|
||||||
{
|
{
|
||||||
if (show)
|
if (show)
|
||||||
{
|
{
|
||||||
if (vis == nullptr)
|
if (vis.isNull())
|
||||||
{
|
{
|
||||||
AddVisualization<T>();
|
AddVisualization<T>();
|
||||||
SetVisualization();
|
SetVisualization();
|
||||||
|
@ -105,7 +105,6 @@ inline void VToolCut::ShowToolVisualization(bool show)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
delete vis;
|
delete vis;
|
||||||
vis = nullptr;
|
|
||||||
}
|
}
|
||||||
if (VAbstractSpline *parentCurve = qobject_cast<VAbstractSpline *>(doc->getTool(curveCutId)))
|
if (VAbstractSpline *parentCurve = qobject_cast<VAbstractSpline *>(doc->getTool(curveCutId)))
|
||||||
{
|
{
|
||||||
|
|
|
@ -241,7 +241,7 @@ void VToolCutArc::ReadToolAttributes(const QDomElement &domElement)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolCutArc::SetVisualization()
|
void VToolCutArc::SetVisualization()
|
||||||
{
|
{
|
||||||
if (vis != nullptr)
|
if (not vis.isNull())
|
||||||
{
|
{
|
||||||
VisToolCutArc *visual = qobject_cast<VisToolCutArc *>(vis);
|
VisToolCutArc *visual = qobject_cast<VisToolCutArc *>(vis);
|
||||||
SCASSERT(visual != nullptr);
|
SCASSERT(visual != nullptr);
|
||||||
|
|
|
@ -241,7 +241,7 @@ void VToolCutSpline::ReadToolAttributes(const QDomElement &domElement)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolCutSpline::SetVisualization()
|
void VToolCutSpline::SetVisualization()
|
||||||
{
|
{
|
||||||
if (vis != nullptr)
|
if (not vis.isNull())
|
||||||
{
|
{
|
||||||
VisToolCutSpline *visual = qobject_cast<VisToolCutSpline *>(vis);
|
VisToolCutSpline *visual = qobject_cast<VisToolCutSpline *>(vis);
|
||||||
SCASSERT(visual != nullptr);
|
SCASSERT(visual != nullptr);
|
||||||
|
|
|
@ -329,7 +329,7 @@ void VToolCutSplinePath::ReadToolAttributes(const QDomElement &domElement)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolCutSplinePath::SetVisualization()
|
void VToolCutSplinePath::SetVisualization()
|
||||||
{
|
{
|
||||||
if (vis != nullptr)
|
if (not vis.isNull())
|
||||||
{
|
{
|
||||||
VisToolCutSplinePath *visual = qobject_cast<VisToolCutSplinePath *>(vis);
|
VisToolCutSplinePath *visual = qobject_cast<VisToolCutSplinePath *>(vis);
|
||||||
SCASSERT(visual != nullptr);
|
SCASSERT(visual != nullptr);
|
||||||
|
|
|
@ -164,7 +164,7 @@ void VToolAlongLine::ReadToolAttributes(const QDomElement &domElement)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolAlongLine::SetVisualization()
|
void VToolAlongLine::SetVisualization()
|
||||||
{
|
{
|
||||||
if (vis != nullptr)
|
if (not vis.isNull())
|
||||||
{
|
{
|
||||||
VisToolAlongLine *visual = qobject_cast<VisToolAlongLine *>(vis);
|
VisToolAlongLine *visual = qobject_cast<VisToolAlongLine *>(vis);
|
||||||
SCASSERT(visual != nullptr)
|
SCASSERT(visual != nullptr)
|
||||||
|
|
|
@ -320,7 +320,7 @@ void VToolBisector::ReadToolAttributes(const QDomElement &domElement)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolBisector::SetVisualization()
|
void VToolBisector::SetVisualization()
|
||||||
{
|
{
|
||||||
if (vis != nullptr)
|
if (not vis.isNull())
|
||||||
{
|
{
|
||||||
VisToolBisector *visual = qobject_cast<VisToolBisector *>(vis);
|
VisToolBisector *visual = qobject_cast<VisToolBisector *>(vis);
|
||||||
SCASSERT(visual != nullptr);
|
SCASSERT(visual != nullptr);
|
||||||
|
|
|
@ -313,7 +313,7 @@ void VToolCurveIntersectAxis::ReadToolAttributes(const QDomElement &domElement)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolCurveIntersectAxis::SetVisualization()
|
void VToolCurveIntersectAxis::SetVisualization()
|
||||||
{
|
{
|
||||||
if (vis != nullptr)
|
if (not vis.isNull())
|
||||||
{
|
{
|
||||||
VisToolCurveIntersectAxis *visual = qobject_cast<VisToolCurveIntersectAxis *>(vis);
|
VisToolCurveIntersectAxis *visual = qobject_cast<VisToolCurveIntersectAxis *>(vis);
|
||||||
SCASSERT(visual != nullptr);
|
SCASSERT(visual != nullptr);
|
||||||
|
|
|
@ -254,7 +254,7 @@ void VToolEndLine::ReadToolAttributes(const QDomElement &domElement)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolEndLine::SetVisualization()
|
void VToolEndLine::SetVisualization()
|
||||||
{
|
{
|
||||||
if (vis != nullptr)
|
if (not vis.isNull())
|
||||||
{
|
{
|
||||||
VisToolEndLine *visual = qobject_cast<VisToolEndLine *>(vis);
|
VisToolEndLine *visual = qobject_cast<VisToolEndLine *>(vis);
|
||||||
SCASSERT(visual != nullptr);
|
SCASSERT(visual != nullptr);
|
||||||
|
|
|
@ -261,7 +261,7 @@ void VToolHeight::ReadToolAttributes(const QDomElement &domElement)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolHeight::SetVisualization()
|
void VToolHeight::SetVisualization()
|
||||||
{
|
{
|
||||||
if (vis != nullptr)
|
if (not vis.isNull())
|
||||||
{
|
{
|
||||||
VisToolHeight *visual = qobject_cast<VisToolHeight *>(vis);
|
VisToolHeight *visual = qobject_cast<VisToolHeight *>(vis);
|
||||||
SCASSERT(visual != nullptr);
|
SCASSERT(visual != nullptr);
|
||||||
|
|
|
@ -313,7 +313,7 @@ void VToolLineIntersectAxis::ReadToolAttributes(const QDomElement &domElement)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolLineIntersectAxis::SetVisualization()
|
void VToolLineIntersectAxis::SetVisualization()
|
||||||
{
|
{
|
||||||
if (vis != nullptr)
|
if (not vis.isNull())
|
||||||
{
|
{
|
||||||
VisToolLineIntersectAxis *visual = qobject_cast<VisToolLineIntersectAxis *>(vis);
|
VisToolLineIntersectAxis *visual = qobject_cast<VisToolLineIntersectAxis *>(vis);
|
||||||
SCASSERT(visual != nullptr);
|
SCASSERT(visual != nullptr);
|
||||||
|
|
|
@ -295,7 +295,7 @@ void VToolNormal::ReadToolAttributes(const QDomElement &domElement)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolNormal::SetVisualization()
|
void VToolNormal::SetVisualization()
|
||||||
{
|
{
|
||||||
if (vis != nullptr)
|
if (not vis.isNull())
|
||||||
{
|
{
|
||||||
VisToolNormal *visual = qobject_cast<VisToolNormal *>(vis);
|
VisToolNormal *visual = qobject_cast<VisToolNormal *>(vis);
|
||||||
SCASSERT(visual != nullptr);
|
SCASSERT(visual != nullptr);
|
||||||
|
|
|
@ -326,7 +326,7 @@ void VToolShoulderPoint::ReadToolAttributes(const QDomElement &domElement)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolShoulderPoint::SetVisualization()
|
void VToolShoulderPoint::SetVisualization()
|
||||||
{
|
{
|
||||||
if (vis != nullptr)
|
if (not vis.isNull())
|
||||||
{
|
{
|
||||||
VisToolShoulderPoint *visual = qobject_cast<VisToolShoulderPoint *>(vis);
|
VisToolShoulderPoint *visual = qobject_cast<VisToolShoulderPoint *>(vis);
|
||||||
SCASSERT(visual != nullptr);
|
SCASSERT(visual != nullptr);
|
||||||
|
|
|
@ -286,7 +286,7 @@ void VToolLineIntersect::ReadToolAttributes(const QDomElement &domElement)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolLineIntersect::SetVisualization()
|
void VToolLineIntersect::SetVisualization()
|
||||||
{
|
{
|
||||||
if (vis != nullptr)
|
if (not vis.isNull())
|
||||||
{
|
{
|
||||||
VisToolLineIntersect *visual = qobject_cast<VisToolLineIntersect *>(vis);
|
VisToolLineIntersect *visual = qobject_cast<VisToolLineIntersect *>(vis);
|
||||||
SCASSERT(visual != nullptr);
|
SCASSERT(visual != nullptr);
|
||||||
|
@ -295,7 +295,7 @@ void VToolLineIntersect::SetVisualization()
|
||||||
visual->setLine1P2Id(p2Line1);
|
visual->setLine1P2Id(p2Line1);
|
||||||
visual->setLine2P1Id(p1Line2);
|
visual->setLine2P1Id(p1Line2);
|
||||||
visual->setLine2P2Id(p2Line2);
|
visual->setLine2P2Id(p2Line2);
|
||||||
vis->RefreshGeometry();
|
visual->RefreshGeometry();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -336,7 +336,7 @@ void VToolPointFromArcAndTangent::ReadToolAttributes(const QDomElement &domEleme
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolPointFromArcAndTangent::SetVisualization()
|
void VToolPointFromArcAndTangent::SetVisualization()
|
||||||
{
|
{
|
||||||
if (vis != nullptr)
|
if (not vis.isNull())
|
||||||
{
|
{
|
||||||
VisToolPointFromArcAndTangent *visual = qobject_cast<VisToolPointFromArcAndTangent *>(vis);
|
VisToolPointFromArcAndTangent *visual = qobject_cast<VisToolPointFromArcAndTangent *>(vis);
|
||||||
SCASSERT(visual != nullptr);
|
SCASSERT(visual != nullptr);
|
||||||
|
|
|
@ -323,7 +323,7 @@ void VToolPointFromCircleAndTangent::ReadToolAttributes(const QDomElement &domEl
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolPointFromCircleAndTangent::SetVisualization()
|
void VToolPointFromCircleAndTangent::SetVisualization()
|
||||||
{
|
{
|
||||||
if (vis != nullptr)
|
if (not vis.isNull())
|
||||||
{
|
{
|
||||||
VisToolPointFromCircleAndTangent *visual = qobject_cast<VisToolPointFromCircleAndTangent *>(vis);
|
VisToolPointFromCircleAndTangent *visual = qobject_cast<VisToolPointFromCircleAndTangent *>(vis);
|
||||||
SCASSERT(visual != nullptr);
|
SCASSERT(visual != nullptr);
|
||||||
|
|
|
@ -339,7 +339,7 @@ void VToolPointOfContact::ReadToolAttributes(const QDomElement &domElement)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolPointOfContact::SetVisualization()
|
void VToolPointOfContact::SetVisualization()
|
||||||
{
|
{
|
||||||
if (vis != nullptr)
|
if (not vis.isNull())
|
||||||
{
|
{
|
||||||
VisToolPointOfContact *visual = qobject_cast<VisToolPointOfContact *>(vis);
|
VisToolPointOfContact *visual = qobject_cast<VisToolPointOfContact *>(vis);
|
||||||
SCASSERT(visual != nullptr);
|
SCASSERT(visual != nullptr);
|
||||||
|
|
|
@ -237,7 +237,7 @@ void VToolPointOfIntersection::ReadToolAttributes(const QDomElement &domElement)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolPointOfIntersection::SetVisualization()
|
void VToolPointOfIntersection::SetVisualization()
|
||||||
{
|
{
|
||||||
if (vis != nullptr)
|
if (not vis.isNull())
|
||||||
{
|
{
|
||||||
VisToolPointOfIntersection *visual = qobject_cast<VisToolPointOfIntersection *>(vis);
|
VisToolPointOfIntersection *visual = qobject_cast<VisToolPointOfIntersection *>(vis);
|
||||||
SCASSERT(visual != nullptr);
|
SCASSERT(visual != nullptr);
|
||||||
|
|
|
@ -341,7 +341,7 @@ void VToolPointOfIntersectionArcs::ReadToolAttributes(const QDomElement &domElem
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolPointOfIntersectionArcs::SetVisualization()
|
void VToolPointOfIntersectionArcs::SetVisualization()
|
||||||
{
|
{
|
||||||
if (vis != nullptr)
|
if (not vis.isNull())
|
||||||
{
|
{
|
||||||
VisToolPointOfIntersectionArcs *visual = qobject_cast<VisToolPointOfIntersectionArcs *>(vis);
|
VisToolPointOfIntersectionArcs *visual = qobject_cast<VisToolPointOfIntersectionArcs *>(vis);
|
||||||
SCASSERT(visual != nullptr);
|
SCASSERT(visual != nullptr);
|
||||||
|
|
|
@ -362,7 +362,7 @@ void VToolPointOfIntersectionCircles::ReadToolAttributes(const QDomElement &domE
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolPointOfIntersectionCircles::SetVisualization()
|
void VToolPointOfIntersectionCircles::SetVisualization()
|
||||||
{
|
{
|
||||||
if (vis != nullptr)
|
if (not vis.isNull())
|
||||||
{
|
{
|
||||||
VisToolPointOfIntersectionCircles *visual = qobject_cast<VisToolPointOfIntersectionCircles *>(vis);
|
VisToolPointOfIntersectionCircles *visual = qobject_cast<VisToolPointOfIntersectionCircles *>(vis);
|
||||||
SCASSERT(visual != nullptr);
|
SCASSERT(visual != nullptr);
|
||||||
|
|
|
@ -404,7 +404,7 @@ void VToolPointOfIntersectionCurves::ReadToolAttributes(const QDomElement &domEl
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolPointOfIntersectionCurves::SetVisualization()
|
void VToolPointOfIntersectionCurves::SetVisualization()
|
||||||
{
|
{
|
||||||
if (vis != nullptr)
|
if (not vis.isNull())
|
||||||
{
|
{
|
||||||
auto visual = qobject_cast<VisToolPointOfIntersectionCurves *>(vis);
|
auto visual = qobject_cast<VisToolPointOfIntersectionCurves *>(vis);
|
||||||
SCASSERT(visual != nullptr);
|
SCASSERT(visual != nullptr);
|
||||||
|
|
|
@ -307,7 +307,7 @@ void VToolTriangle::ReadToolAttributes(const QDomElement &domElement)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolTriangle::SetVisualization()
|
void VToolTriangle::SetVisualization()
|
||||||
{
|
{
|
||||||
if (vis != nullptr)
|
if (not vis.isNull())
|
||||||
{
|
{
|
||||||
VisToolTriangle * visual = qobject_cast<VisToolTriangle *>(vis);
|
VisToolTriangle * visual = qobject_cast<VisToolTriangle *>(vis);
|
||||||
SCASSERT(visual != nullptr);
|
SCASSERT(visual != nullptr);
|
||||||
|
|
|
@ -95,7 +95,7 @@ void VAbstractPoint::ShowToolVisualization(bool show)
|
||||||
{
|
{
|
||||||
if (show)
|
if (show)
|
||||||
{
|
{
|
||||||
if (vis == nullptr)
|
if (vis.isNull())
|
||||||
{
|
{
|
||||||
AddVisualization<T>();
|
AddVisualization<T>();
|
||||||
SetVisualization();
|
SetVisualization();
|
||||||
|
@ -111,7 +111,6 @@ void VAbstractPoint::ShowToolVisualization(bool show)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
delete vis;
|
delete vis;
|
||||||
vis = nullptr;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -319,7 +319,7 @@ void VToolLine::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
|
||||||
void VToolLine::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
void VToolLine::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
||||||
{
|
{
|
||||||
Q_UNUSED(event);
|
Q_UNUSED(event);
|
||||||
if (vis == nullptr)
|
if (vis.isNull())
|
||||||
{
|
{
|
||||||
this->setPen(QPen(CorrectColor(lineColor),
|
this->setPen(QPen(CorrectColor(lineColor),
|
||||||
qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor,
|
qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor,
|
||||||
|
@ -421,7 +421,7 @@ void VToolLine::ReadToolAttributes(const QDomElement &domElement)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolLine::SetVisualization()
|
void VToolLine::SetVisualization()
|
||||||
{
|
{
|
||||||
if (vis != nullptr)
|
if (not vis.isNull())
|
||||||
{
|
{
|
||||||
VisToolLine *visual = qobject_cast<VisToolLine *>(vis);
|
VisToolLine *visual = qobject_cast<VisToolLine *>(vis);
|
||||||
SCASSERT(visual != nullptr);
|
SCASSERT(visual != nullptr);
|
||||||
|
@ -456,7 +456,7 @@ void VToolLine::ShowVisualization(bool show)
|
||||||
{
|
{
|
||||||
if (show)
|
if (show)
|
||||||
{
|
{
|
||||||
if (vis == nullptr)
|
if (vis.isNull())
|
||||||
{
|
{
|
||||||
AddVisualization<VisToolLine>();
|
AddVisualization<VisToolLine>();
|
||||||
SetVisualization();
|
SetVisualization();
|
||||||
|
@ -472,7 +472,6 @@ void VToolLine::ShowVisualization(bool show)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
delete vis;
|
delete vis;
|
||||||
vis = nullptr;
|
|
||||||
hoverLeaveEvent(nullptr);
|
hoverLeaveEvent(nullptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,7 +83,7 @@ const QString VAbstractTool::AttrInUse = QStringLiteral("inUse");
|
||||||
* @param parent parent object.
|
* @param parent parent object.
|
||||||
*/
|
*/
|
||||||
VAbstractTool::VAbstractTool(VAbstractPattern *doc, VContainer *data, quint32 id, QObject *parent)
|
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)
|
selectionType(SelectionType::ByMouseRelease)
|
||||||
{
|
{
|
||||||
SCASSERT(doc != nullptr);
|
SCASSERT(doc != nullptr);
|
||||||
|
@ -94,7 +94,12 @@ VAbstractTool::VAbstractTool(VAbstractPattern *doc, VContainer *data, quint32 id
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VAbstractTool::~VAbstractTool()
|
VAbstractTool::~VAbstractTool()
|
||||||
{}
|
{
|
||||||
|
if (not vis.isNull())
|
||||||
|
{
|
||||||
|
delete vis;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -122,7 +122,7 @@ protected:
|
||||||
/** @brief baseColor base color for tool. */
|
/** @brief baseColor base color for tool. */
|
||||||
Qt::GlobalColor baseColor;
|
Qt::GlobalColor baseColor;
|
||||||
|
|
||||||
Visualization *vis;
|
QPointer<Visualization> vis;
|
||||||
SelectionType selectionType;
|
SelectionType selectionType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -182,8 +182,8 @@ inline void VAbstractTool::AddVisualization()
|
||||||
connect(scene, &VMainGraphicsScene::NewFactor, visual, &Visualization::SetFactor);
|
connect(scene, &VMainGraphicsScene::NewFactor, visual, &Visualization::SetFactor);
|
||||||
scene->addItem(visual);
|
scene->addItem(visual);
|
||||||
|
|
||||||
|
connect(visual, &Visualization::ToolTip, [=] (const QString &toolTip) {emit ToolTip(toolTip);});
|
||||||
vis = visual;
|
vis = visual;
|
||||||
connect(vis, &Visualization::ToolTip, [=] (const QString &toolTip) {emit ToolTip(toolTip);});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // VABSTRACTTOOL_H
|
#endif // VABSTRACTTOOL_H
|
||||||
|
|
Loading…
Reference in New Issue
Block a user