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);
|
||||
locData->RemoveVariable(currentLength);
|
||||
|
||||
DeleteVisualization<VisToolAlongLine>();
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
|
|
@ -113,7 +113,6 @@ void DialogArc::DeployF2TextEdit()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
DialogArc::~DialogArc()
|
||||
{
|
||||
DeleteVisualization<VisToolArc>();
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
|
|
@ -90,7 +90,6 @@ DialogArcWithLength::DialogArcWithLength(const VContainer *data, const quint32 &
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
DialogArcWithLength::~DialogArcWithLength()
|
||||
{
|
||||
DeleteVisualization<VisToolArcWithLength>();
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
|
|
@ -142,7 +142,6 @@ void DialogBisector::DeployFormulaTextEdit()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
DialogBisector::~DialogBisector()
|
||||
{
|
||||
DeleteVisualization<VisToolBisector>();
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
|
|
@ -63,7 +63,6 @@ DialogCubicBezier::DialogCubicBezier(const VContainer *data, const quint32 &tool
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
DialogCubicBezier::~DialogCubicBezier()
|
||||
{
|
||||
DeleteVisualization<VisToolCubicBezier>();
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
|
|
@ -61,7 +61,6 @@ DialogCubicBezierPath::DialogCubicBezierPath(const VContainer *data, const quint
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
DialogCubicBezierPath::~DialogCubicBezierPath()
|
||||
{
|
||||
DeleteVisualization<VisToolCubicBezierPath>();
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
|
|
@ -77,7 +77,6 @@ DialogCurveIntersectAxis::DialogCurveIntersectAxis(const VContainer *data, const
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
DialogCurveIntersectAxis::~DialogCurveIntersectAxis()
|
||||
{
|
||||
DeleteVisualization<VisToolCurveIntersectAxis>();
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
|
|
@ -106,7 +106,6 @@ void DialogCutArc::DeployFormulaTextEdit()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
DialogCutArc::~DialogCutArc()
|
||||
{
|
||||
DeleteVisualization<VisToolCutArc>();
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
|
|
@ -73,7 +73,6 @@ DialogCutSpline::DialogCutSpline(const VContainer *data, const quint32 &toolId,
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
DialogCutSpline::~DialogCutSpline()
|
||||
{
|
||||
DeleteVisualization<VisToolCutSpline>();
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
|
|
@ -73,7 +73,6 @@ DialogCutSplinePath::DialogCutSplinePath(const VContainer *data, const quint32 &
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
DialogCutSplinePath::~DialogCutSplinePath()
|
||||
{
|
||||
DeleteVisualization<VisToolCutSplinePath>();
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
|
|
@ -167,7 +167,7 @@ void DialogEndLine::ChosenObject(quint32 id, const SceneObject &type)
|
|||
if (SetObject(id, ui->comboBoxBasePoint, ""))
|
||||
{
|
||||
vis->VisualMode(id);
|
||||
connect(vis, &Visualization::ToolTip, this, &DialogTool::ShowVisToolTip);
|
||||
connect(vis.data(), &Visualization::ToolTip, this, &DialogTool::ShowVisToolTip);
|
||||
prepare = true;
|
||||
}
|
||||
}
|
||||
|
@ -343,7 +343,6 @@ void DialogEndLine::closeEvent(QCloseEvent *event)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
DialogEndLine::~DialogEndLine()
|
||||
{
|
||||
DeleteVisualization<VisToolEndLine>();
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
|
|
@ -75,7 +75,6 @@ DialogHeight::DialogHeight(const VContainer *data, const quint32 &toolId, QWidge
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
DialogHeight::~DialogHeight()
|
||||
{
|
||||
DeleteVisualization<VisToolHeight>();
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
|
|
@ -68,7 +68,6 @@ DialogLine::DialogLine(const VContainer *data, const quint32 &toolId, QWidget *p
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
DialogLine::~DialogLine()
|
||||
{
|
||||
DeleteVisualization<VisToolLine>();
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
|
|
@ -75,7 +75,6 @@ DialogLineIntersect::DialogLineIntersect(const VContainer *data, const quint32 &
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
DialogLineIntersect::~DialogLineIntersect()
|
||||
{
|
||||
DeleteVisualization<VisToolLineIntersect>();
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
|
|
@ -86,7 +86,6 @@ DialogLineIntersectAxis::DialogLineIntersectAxis(const VContainer *data, const q
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
DialogLineIntersectAxis::~DialogLineIntersectAxis()
|
||||
{
|
||||
DeleteVisualization<VisToolLineIntersectAxis>();
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
|
|
@ -132,7 +132,6 @@ void DialogNormal::DeployFormulaTextEdit()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
DialogNormal::~DialogNormal()
|
||||
{
|
||||
DeleteVisualization<VisToolNormal>();
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
|
|
@ -63,7 +63,6 @@ DialogPointFromArcAndTangent::DialogPointFromArcAndTangent(const VContainer *dat
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
DialogPointFromArcAndTangent::~DialogPointFromArcAndTangent()
|
||||
{
|
||||
DeleteVisualization<VisToolPointFromArcAndTangent>();
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
|
|
@ -88,7 +88,6 @@ DialogPointFromCircleAndTangent::DialogPointFromCircleAndTangent(const VContaine
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
DialogPointFromCircleAndTangent::~DialogPointFromCircleAndTangent()
|
||||
{
|
||||
DeleteVisualization<VisToolPointFromCircleAndTangent>();
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
|
|
@ -81,7 +81,6 @@ DialogPointOfContact::DialogPointOfContact(const VContainer *data, const quint32
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
DialogPointOfContact::~DialogPointOfContact()
|
||||
{
|
||||
DeleteVisualization<VisToolPointOfContact>();
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
|
|
@ -71,7 +71,6 @@ DialogPointOfIntersection::DialogPointOfIntersection(const VContainer *data, con
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
DialogPointOfIntersection::~DialogPointOfIntersection()
|
||||
{
|
||||
DeleteVisualization<VisToolPointOfIntersection>();
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
|
|
@ -67,7 +67,6 @@ DialogPointOfIntersectionArcs::DialogPointOfIntersectionArcs(const VContainer *d
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
DialogPointOfIntersectionArcs::~DialogPointOfIntersectionArcs()
|
||||
{
|
||||
DeleteVisualization<VisToolPointOfIntersectionArcs>();
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
|
|
@ -104,7 +104,6 @@ DialogPointOfIntersectionCircles::DialogPointOfIntersectionCircles(const VContai
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
DialogPointOfIntersectionCircles::~DialogPointOfIntersectionCircles()
|
||||
{
|
||||
DeleteVisualization<VisToolPointOfIntersectionCircles>();
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
|
|
@ -65,7 +65,6 @@ DialogPointOfIntersectionCurves::DialogPointOfIntersectionCurves(const VContaine
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
DialogPointOfIntersectionCurves::~DialogPointOfIntersectionCurves()
|
||||
{
|
||||
DeleteVisualization<VisToolPointOfIntersectionCurves>();
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
|
|
@ -81,7 +81,6 @@ DialogRotation::DialogRotation(const VContainer *data, const quint32 &toolId, QW
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
DialogRotation::~DialogRotation()
|
||||
{
|
||||
DeleteVisualization<VisToolRotation>();
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
|
|
@ -143,7 +143,6 @@ void DialogShoulderPoint::DeployFormulaTextEdit()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
DialogShoulderPoint::~DialogShoulderPoint()
|
||||
{
|
||||
DeleteVisualization<VisToolShoulderPoint>();
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
|
|
@ -122,7 +122,6 @@ DialogSpline::DialogSpline(const VContainer *data, const quint32 &toolId, QWidge
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
DialogSpline::~DialogSpline()
|
||||
{
|
||||
DeleteVisualization<VisToolSpline>();
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
|
|
@ -108,7 +108,6 @@ DialogSplinePath::DialogSplinePath(const VContainer *data, const quint32 &toolId
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
DialogSplinePath::~DialogSplinePath()
|
||||
{
|
||||
DeleteVisualization<VisToolSplinePath>();
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
|
|
@ -78,6 +78,11 @@ DialogTool::DialogTool(const VContainer *data, const quint32 &toolId, QWidget *p
|
|||
DialogTool::~DialogTool()
|
||||
{
|
||||
emit ToolTip("");
|
||||
|
||||
if (not vis.isNull())
|
||||
{
|
||||
delete vis;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -181,7 +181,7 @@ protected:
|
|||
/** @brief number number of handled objects */
|
||||
qint32 number;
|
||||
|
||||
Visualization *vis;
|
||||
QPointer<Visualization> vis;
|
||||
|
||||
virtual void closeEvent ( QCloseEvent * event ) Q_DECL_OVERRIDE;
|
||||
virtual void showEvent( QShowEvent *event ) Q_DECL_OVERRIDE;
|
||||
|
@ -241,9 +241,6 @@ protected:
|
|||
template <typename T>
|
||||
void AddVisualization();
|
||||
|
||||
template <typename T>
|
||||
void DeleteVisualization();
|
||||
|
||||
void ChangeColor(QWidget *widget, const QColor &color);
|
||||
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>
|
||||
inline T DialogTool::getCurrentCrossPoint(QComboBox *box) const
|
||||
|
|
|
@ -75,7 +75,6 @@ DialogTriangle::DialogTriangle(const VContainer *data, const quint32 &toolId, QW
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
DialogTriangle::~DialogTriangle()
|
||||
{
|
||||
DeleteVisualization<VisToolTriangle>();
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
|
|
@ -80,7 +80,6 @@ DialogTrueDarts::DialogTrueDarts(const VContainer *data, const quint32 &toolId,
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
DialogTrueDarts::~DialogTrueDarts()
|
||||
{
|
||||
DeleteVisualization<VisToolTrueDarts>();
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user