Refactoring deleting visualization object.
Instead of searcing inside current graphics scene use QPointer class. --HG-- branch : develop
This commit is contained in:
parent
628fdd4217
commit
bd7f328a8a
|
@ -142,7 +142,6 @@ DialogAlongLine::~DialogAlongLine()
|
||||||
VContainer *locData = const_cast<VContainer *> (data);
|
VContainer *locData = const_cast<VContainer *> (data);
|
||||||
locData->RemoveVariable(currentLength);
|
locData->RemoveVariable(currentLength);
|
||||||
|
|
||||||
DeleteVisualization<VisToolAlongLine>();
|
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -113,7 +113,6 @@ void DialogArc::DeployF2TextEdit()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
DialogArc::~DialogArc()
|
DialogArc::~DialogArc()
|
||||||
{
|
{
|
||||||
DeleteVisualization<VisToolArc>();
|
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -90,7 +90,6 @@ DialogArcWithLength::DialogArcWithLength(const VContainer *data, const quint32 &
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
DialogArcWithLength::~DialogArcWithLength()
|
DialogArcWithLength::~DialogArcWithLength()
|
||||||
{
|
{
|
||||||
DeleteVisualization<VisToolArcWithLength>();
|
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -142,7 +142,6 @@ void DialogBisector::DeployFormulaTextEdit()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
DialogBisector::~DialogBisector()
|
DialogBisector::~DialogBisector()
|
||||||
{
|
{
|
||||||
DeleteVisualization<VisToolBisector>();
|
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,6 @@ DialogCubicBezier::DialogCubicBezier(const VContainer *data, const quint32 &tool
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
DialogCubicBezier::~DialogCubicBezier()
|
DialogCubicBezier::~DialogCubicBezier()
|
||||||
{
|
{
|
||||||
DeleteVisualization<VisToolCubicBezier>();
|
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,6 @@ DialogCubicBezierPath::DialogCubicBezierPath(const VContainer *data, const quint
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
DialogCubicBezierPath::~DialogCubicBezierPath()
|
DialogCubicBezierPath::~DialogCubicBezierPath()
|
||||||
{
|
{
|
||||||
DeleteVisualization<VisToolCubicBezierPath>();
|
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -77,7 +77,6 @@ DialogCurveIntersectAxis::DialogCurveIntersectAxis(const VContainer *data, const
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
DialogCurveIntersectAxis::~DialogCurveIntersectAxis()
|
DialogCurveIntersectAxis::~DialogCurveIntersectAxis()
|
||||||
{
|
{
|
||||||
DeleteVisualization<VisToolCurveIntersectAxis>();
|
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -106,7 +106,6 @@ void DialogCutArc::DeployFormulaTextEdit()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
DialogCutArc::~DialogCutArc()
|
DialogCutArc::~DialogCutArc()
|
||||||
{
|
{
|
||||||
DeleteVisualization<VisToolCutArc>();
|
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,6 @@ DialogCutSpline::DialogCutSpline(const VContainer *data, const quint32 &toolId,
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
DialogCutSpline::~DialogCutSpline()
|
DialogCutSpline::~DialogCutSpline()
|
||||||
{
|
{
|
||||||
DeleteVisualization<VisToolCutSpline>();
|
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,6 @@ DialogCutSplinePath::DialogCutSplinePath(const VContainer *data, const quint32 &
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
DialogCutSplinePath::~DialogCutSplinePath()
|
DialogCutSplinePath::~DialogCutSplinePath()
|
||||||
{
|
{
|
||||||
DeleteVisualization<VisToolCutSplinePath>();
|
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -167,7 +167,7 @@ void DialogEndLine::ChosenObject(quint32 id, const SceneObject &type)
|
||||||
if (SetObject(id, ui->comboBoxBasePoint, ""))
|
if (SetObject(id, ui->comboBoxBasePoint, ""))
|
||||||
{
|
{
|
||||||
vis->VisualMode(id);
|
vis->VisualMode(id);
|
||||||
connect(vis, &Visualization::ToolTip, this, &DialogTool::ShowVisToolTip);
|
connect(vis.data(), &Visualization::ToolTip, this, &DialogTool::ShowVisToolTip);
|
||||||
prepare = true;
|
prepare = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -343,7 +343,6 @@ void DialogEndLine::closeEvent(QCloseEvent *event)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
DialogEndLine::~DialogEndLine()
|
DialogEndLine::~DialogEndLine()
|
||||||
{
|
{
|
||||||
DeleteVisualization<VisToolEndLine>();
|
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -75,7 +75,6 @@ DialogHeight::DialogHeight(const VContainer *data, const quint32 &toolId, QWidge
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
DialogHeight::~DialogHeight()
|
DialogHeight::~DialogHeight()
|
||||||
{
|
{
|
||||||
DeleteVisualization<VisToolHeight>();
|
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,6 @@ DialogLine::DialogLine(const VContainer *data, const quint32 &toolId, QWidget *p
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
DialogLine::~DialogLine()
|
DialogLine::~DialogLine()
|
||||||
{
|
{
|
||||||
DeleteVisualization<VisToolLine>();
|
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -75,7 +75,6 @@ DialogLineIntersect::DialogLineIntersect(const VContainer *data, const quint32 &
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
DialogLineIntersect::~DialogLineIntersect()
|
DialogLineIntersect::~DialogLineIntersect()
|
||||||
{
|
{
|
||||||
DeleteVisualization<VisToolLineIntersect>();
|
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -86,7 +86,6 @@ DialogLineIntersectAxis::DialogLineIntersectAxis(const VContainer *data, const q
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
DialogLineIntersectAxis::~DialogLineIntersectAxis()
|
DialogLineIntersectAxis::~DialogLineIntersectAxis()
|
||||||
{
|
{
|
||||||
DeleteVisualization<VisToolLineIntersectAxis>();
|
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -132,7 +132,6 @@ void DialogNormal::DeployFormulaTextEdit()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
DialogNormal::~DialogNormal()
|
DialogNormal::~DialogNormal()
|
||||||
{
|
{
|
||||||
DeleteVisualization<VisToolNormal>();
|
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,6 @@ DialogPointFromArcAndTangent::DialogPointFromArcAndTangent(const VContainer *dat
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
DialogPointFromArcAndTangent::~DialogPointFromArcAndTangent()
|
DialogPointFromArcAndTangent::~DialogPointFromArcAndTangent()
|
||||||
{
|
{
|
||||||
DeleteVisualization<VisToolPointFromArcAndTangent>();
|
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -88,7 +88,6 @@ DialogPointFromCircleAndTangent::DialogPointFromCircleAndTangent(const VContaine
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
DialogPointFromCircleAndTangent::~DialogPointFromCircleAndTangent()
|
DialogPointFromCircleAndTangent::~DialogPointFromCircleAndTangent()
|
||||||
{
|
{
|
||||||
DeleteVisualization<VisToolPointFromCircleAndTangent>();
|
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -81,7 +81,6 @@ DialogPointOfContact::DialogPointOfContact(const VContainer *data, const quint32
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
DialogPointOfContact::~DialogPointOfContact()
|
DialogPointOfContact::~DialogPointOfContact()
|
||||||
{
|
{
|
||||||
DeleteVisualization<VisToolPointOfContact>();
|
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,6 @@ DialogPointOfIntersection::DialogPointOfIntersection(const VContainer *data, con
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
DialogPointOfIntersection::~DialogPointOfIntersection()
|
DialogPointOfIntersection::~DialogPointOfIntersection()
|
||||||
{
|
{
|
||||||
DeleteVisualization<VisToolPointOfIntersection>();
|
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,6 @@ DialogPointOfIntersectionArcs::DialogPointOfIntersectionArcs(const VContainer *d
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
DialogPointOfIntersectionArcs::~DialogPointOfIntersectionArcs()
|
DialogPointOfIntersectionArcs::~DialogPointOfIntersectionArcs()
|
||||||
{
|
{
|
||||||
DeleteVisualization<VisToolPointOfIntersectionArcs>();
|
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -104,7 +104,6 @@ DialogPointOfIntersectionCircles::DialogPointOfIntersectionCircles(const VContai
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
DialogPointOfIntersectionCircles::~DialogPointOfIntersectionCircles()
|
DialogPointOfIntersectionCircles::~DialogPointOfIntersectionCircles()
|
||||||
{
|
{
|
||||||
DeleteVisualization<VisToolPointOfIntersectionCircles>();
|
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -65,7 +65,6 @@ DialogPointOfIntersectionCurves::DialogPointOfIntersectionCurves(const VContaine
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
DialogPointOfIntersectionCurves::~DialogPointOfIntersectionCurves()
|
DialogPointOfIntersectionCurves::~DialogPointOfIntersectionCurves()
|
||||||
{
|
{
|
||||||
DeleteVisualization<VisToolPointOfIntersectionCurves>();
|
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -81,7 +81,6 @@ DialogRotation::DialogRotation(const VContainer *data, const quint32 &toolId, QW
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
DialogRotation::~DialogRotation()
|
DialogRotation::~DialogRotation()
|
||||||
{
|
{
|
||||||
DeleteVisualization<VisToolRotation>();
|
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -143,7 +143,6 @@ void DialogShoulderPoint::DeployFormulaTextEdit()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
DialogShoulderPoint::~DialogShoulderPoint()
|
DialogShoulderPoint::~DialogShoulderPoint()
|
||||||
{
|
{
|
||||||
DeleteVisualization<VisToolShoulderPoint>();
|
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -122,7 +122,6 @@ DialogSpline::DialogSpline(const VContainer *data, const quint32 &toolId, QWidge
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
DialogSpline::~DialogSpline()
|
DialogSpline::~DialogSpline()
|
||||||
{
|
{
|
||||||
DeleteVisualization<VisToolSpline>();
|
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -108,7 +108,6 @@ DialogSplinePath::DialogSplinePath(const VContainer *data, const quint32 &toolId
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
DialogSplinePath::~DialogSplinePath()
|
DialogSplinePath::~DialogSplinePath()
|
||||||
{
|
{
|
||||||
DeleteVisualization<VisToolSplinePath>();
|
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -78,6 +78,11 @@ DialogTool::DialogTool(const VContainer *data, const quint32 &toolId, QWidget *p
|
||||||
DialogTool::~DialogTool()
|
DialogTool::~DialogTool()
|
||||||
{
|
{
|
||||||
emit ToolTip("");
|
emit ToolTip("");
|
||||||
|
|
||||||
|
if (not vis.isNull())
|
||||||
|
{
|
||||||
|
delete vis;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -181,7 +181,7 @@ protected:
|
||||||
/** @brief number number of handled objects */
|
/** @brief number number of handled objects */
|
||||||
qint32 number;
|
qint32 number;
|
||||||
|
|
||||||
Visualization *vis;
|
QPointer<Visualization> vis;
|
||||||
|
|
||||||
virtual void closeEvent ( QCloseEvent * event ) Q_DECL_OVERRIDE;
|
virtual void closeEvent ( QCloseEvent * event ) Q_DECL_OVERRIDE;
|
||||||
virtual void showEvent( QShowEvent *event ) Q_DECL_OVERRIDE;
|
virtual void showEvent( QShowEvent *event ) Q_DECL_OVERRIDE;
|
||||||
|
@ -241,9 +241,6 @@ protected:
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void AddVisualization();
|
void AddVisualization();
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
void DeleteVisualization();
|
|
||||||
|
|
||||||
void ChangeColor(QWidget *widget, const QColor &color);
|
void ChangeColor(QWidget *widget, const QColor &color);
|
||||||
virtual void ShowVisualization() {}
|
virtual void ShowVisualization() {}
|
||||||
/**
|
/**
|
||||||
|
@ -360,19 +357,6 @@ inline void DialogTool::AddVisualization()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
template <typename T>
|
|
||||||
inline void DialogTool::DeleteVisualization()
|
|
||||||
{
|
|
||||||
T *toolVis = qobject_cast<T *>(vis);
|
|
||||||
SCASSERT(toolVis != nullptr);
|
|
||||||
|
|
||||||
if (qApp->getCurrentScene()->items().contains(toolVis))
|
|
||||||
{ // In some cases scene delete object yourself. If not make check program will crash.
|
|
||||||
delete vis;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline T DialogTool::getCurrentCrossPoint(QComboBox *box) const
|
inline T DialogTool::getCurrentCrossPoint(QComboBox *box) const
|
||||||
|
|
|
@ -75,7 +75,6 @@ DialogTriangle::DialogTriangle(const VContainer *data, const quint32 &toolId, QW
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
DialogTriangle::~DialogTriangle()
|
DialogTriangle::~DialogTriangle()
|
||||||
{
|
{
|
||||||
DeleteVisualization<VisToolTriangle>();
|
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,6 @@ DialogTrueDarts::DialogTrueDarts(const VContainer *data, const quint32 &toolId,
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
DialogTrueDarts::~DialogTrueDarts()
|
DialogTrueDarts::~DialogTrueDarts()
|
||||||
{
|
{
|
||||||
DeleteVisualization<VisToolTrueDarts>();
|
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user