From a0e09d3fe7ebab039d21bf65ea694460fdae6d66 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Tue, 24 Jul 2018 14:57:41 +0300 Subject: [PATCH] Fix crash on Windows. Cancelling Piece Path dialog crashes Valentina. --HG-- branch : develop --- src/app/valentina/mainwindow.cpp | 16 ++++++++++------ src/app/valentina/mainwindow.h | 2 +- .../operation/flipping/vtoolflippingbyaxis.cpp | 10 +++++----- .../operation/flipping/vtoolflippingbyaxis.h | 2 +- .../operation/flipping/vtoolflippingbyline.cpp | 10 +++++----- .../operation/flipping/vtoolflippingbyline.h | 2 +- .../tools/drawTools/operation/vtoolmove.cpp | 10 +++++----- .../vtools/tools/drawTools/operation/vtoolmove.h | 2 +- .../tools/drawTools/operation/vtoolrotation.cpp | 10 +++++----- .../tools/drawTools/operation/vtoolrotation.h | 2 +- .../tools/drawTools/toolcurve/vtoolarc.cpp | 10 +++++----- .../vtools/tools/drawTools/toolcurve/vtoolarc.h | 2 +- .../drawTools/toolcurve/vtoolarcwithlength.cpp | 10 +++++----- .../drawTools/toolcurve/vtoolarcwithlength.h | 2 +- .../drawTools/toolcurve/vtoolcubicbezier.cpp | 6 +++--- .../tools/drawTools/toolcurve/vtoolcubicbezier.h | 2 +- .../drawTools/toolcurve/vtoolcubicbezierpath.cpp | 6 +++--- .../drawTools/toolcurve/vtoolcubicbezierpath.h | 2 +- .../drawTools/toolcurve/vtoolellipticalarc.cpp | 10 +++++----- .../drawTools/toolcurve/vtoolellipticalarc.h | 2 +- .../tools/drawTools/toolcurve/vtoolspline.cpp | 8 ++++---- .../tools/drawTools/toolcurve/vtoolspline.h | 2 +- .../drawTools/toolcurve/vtoolsplinepath.cpp | 10 +++++----- .../tools/drawTools/toolcurve/vtoolsplinepath.h | 2 +- .../toolpoint/tooldoublepoint/vtooltruedarts.cpp | 10 +++++----- .../toolpoint/tooldoublepoint/vtooltruedarts.h | 2 +- .../toolsinglepoint/toolcut/vtoolcutarc.cpp | 10 +++++----- .../toolsinglepoint/toolcut/vtoolcutarc.h | 2 +- .../toolsinglepoint/toolcut/vtoolcutspline.cpp | 10 +++++----- .../toolsinglepoint/toolcut/vtoolcutspline.h | 2 +- .../toolcut/vtoolcutsplinepath.cpp | 10 +++++----- .../toolsinglepoint/toolcut/vtoolcutsplinepath.h | 2 +- .../toollinepoint/vtoolalongline.cpp | 10 +++++----- .../toollinepoint/vtoolalongline.h | 2 +- .../toollinepoint/vtoolbisector.cpp | 10 +++++----- .../toollinepoint/vtoolbisector.h | 2 +- .../toollinepoint/vtoolcurveintersectaxis.cpp | 10 +++++----- .../toollinepoint/vtoolcurveintersectaxis.h | 2 +- .../toollinepoint/vtoolendline.cpp | 10 +++++----- .../toolsinglepoint/toollinepoint/vtoolendline.h | 2 +- .../toollinepoint/vtoolheight.cpp | 10 +++++----- .../toolsinglepoint/toollinepoint/vtoolheight.h | 2 +- .../toollinepoint/vtoollineintersectaxis.cpp | 10 +++++----- .../toollinepoint/vtoollineintersectaxis.h | 2 +- .../toollinepoint/vtoolnormal.cpp | 10 +++++----- .../toolsinglepoint/toollinepoint/vtoolnormal.h | 2 +- .../toollinepoint/vtoolshoulderpoint.cpp | 10 +++++----- .../toollinepoint/vtoolshoulderpoint.h | 2 +- .../toolpoint/toolsinglepoint/vtoolbasepoint.cpp | 4 ++-- .../toolsinglepoint/vtoollineintersect.cpp | 10 +++++----- .../toolsinglepoint/vtoollineintersect.h | 2 +- .../vtoolpointfromarcandtangent.cpp | 10 +++++----- .../vtoolpointfromarcandtangent.h | 2 +- .../vtoolpointfromcircleandtangent.cpp | 13 ++++++++----- .../vtoolpointfromcircleandtangent.h | 2 +- .../toolsinglepoint/vtoolpointofcontact.cpp | 10 +++++----- .../toolsinglepoint/vtoolpointofcontact.h | 2 +- .../toolsinglepoint/vtoolpointofintersection.cpp | 13 +++++++------ .../toolsinglepoint/vtoolpointofintersection.h | 2 +- .../vtoolpointofintersectionarcs.cpp | 10 +++++----- .../vtoolpointofintersectionarcs.h | 2 +- .../vtoolpointofintersectioncircles.cpp | 15 ++++++++------- .../vtoolpointofintersectioncircles.h | 2 +- .../vtoolpointofintersectioncurves.cpp | 7 ++++--- .../vtoolpointofintersectioncurves.h | 2 +- .../toolpoint/toolsinglepoint/vtooltriangle.cpp | 10 +++++----- .../toolpoint/toolsinglepoint/vtooltriangle.h | 2 +- src/libs/vtools/tools/drawTools/vdrawtool.h | 2 +- src/libs/vtools/tools/drawTools/vtoolline.cpp | 10 +++++----- src/libs/vtools/tools/drawTools/vtoolline.h | 2 +- .../vtools/tools/nodeDetails/vtoolpiecepath.cpp | 4 ++-- .../vtools/tools/nodeDetails/vtoolpiecepath.h | 2 +- src/libs/vtools/tools/nodeDetails/vtoolpin.cpp | 4 ++-- src/libs/vtools/tools/nodeDetails/vtoolpin.h | 2 +- .../vtools/tools/nodeDetails/vtoolplacelabel.cpp | 4 ++-- .../vtools/tools/nodeDetails/vtoolplacelabel.h | 2 +- src/libs/vtools/tools/vinteractivetool.cpp | 4 ++-- src/libs/vtools/tools/vinteractivetool.h | 2 +- src/libs/vtools/tools/vtoolseamallowance.cpp | 15 +++++++-------- src/libs/vtools/tools/vtoolseamallowance.h | 4 ++-- src/libs/vtools/tools/vtooluniondetails.cpp | 4 ++-- src/libs/vtools/tools/vtooluniondetails.h | 2 +- 82 files changed, 238 insertions(+), 229 deletions(-) diff --git a/src/app/valentina/mainwindow.cpp b/src/app/valentina/mainwindow.cpp index bbe9a4cf4..8c3361f59 100644 --- a/src/app/valentina/mainwindow.cpp +++ b/src/app/valentina/mainwindow.cpp @@ -636,7 +636,7 @@ void MainWindow::SetToolButton(bool checked, Tool t, const QString &cursor, cons ui->view->setCurrentCursorShape(); // Hack to fix problem with a cursor m_statusLabel->setText(toolTip); ui->view->setShowToolOptions(false); - dialogTool = QSharedPointer(new Dialog(pattern, 0, this)); + dialogTool = new Dialog(pattern, 0, this); // This check helps to find missed tools in the switch Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 55, "Check if need to extend."); @@ -1229,8 +1229,8 @@ void MainWindow::ClosedDialogGroup(int result) SCASSERT(dialogTool != nullptr) if (result == QDialog::Accepted) { - QSharedPointer dialog = dialogTool.objectCast(); - SCASSERT(dialog != nullptr) + const QPointer dialog = qobject_cast(dialogTool); + SCASSERT(not dialog.isNull()) const QDomElement group = doc->CreateGroup(VContainer::getNextId(), dialog->GetName(), dialog->GetGroup()); if (not group.isNull()) { @@ -1284,8 +1284,8 @@ void MainWindow::ClosedDialogInsertNode(int result) SCASSERT(dialogTool != nullptr); if (result == QDialog::Accepted) { - QSharedPointer dTool = dialogTool.objectCast(); - SCASSERT(dTool != nullptr) + const QPointer dTool = qobject_cast(dialogTool); + SCASSERT(not dTool.isNull()) VToolSeamAllowance::InsertNode(dTool->GetNode(), dTool->GetPieceId(), sceneDetails, pattern, doc); } ArrowTool(true); @@ -2193,7 +2193,11 @@ void MainWindow::CancelTool() Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 55, "Not all tools were handled."); qCDebug(vMainWindow, "Canceling tool."); - dialogTool.clear(); + if(not dialogTool.isNull()) + { + dialogTool->hide(); + dialogTool->deleteLater(); + } qCDebug(vMainWindow, "Dialog closed."); currentScene->setFocus(Qt::OtherFocusReason); diff --git a/src/app/valentina/mainwindow.h b/src/app/valentina/mainwindow.h index f18d91aaf..d336fe7fe 100644 --- a/src/app/valentina/mainwindow.h +++ b/src/app/valentina/mainwindow.h @@ -238,7 +238,7 @@ private: bool patternReadOnly; QPointer dialogTable; - QSharedPointer dialogTool; + QPointer dialogTool; QPointer dialogHistory; QPointer dialogFMeasurements; diff --git a/src/libs/vtools/tools/drawTools/operation/flipping/vtoolflippingbyaxis.cpp b/src/libs/vtools/tools/drawTools/operation/flipping/vtoolflippingbyaxis.cpp index 388fe4ce2..8d8f60f31 100644 --- a/src/libs/vtools/tools/drawTools/operation/flipping/vtoolflippingbyaxis.cpp +++ b/src/libs/vtools/tools/drawTools/operation/flipping/vtoolflippingbyaxis.cpp @@ -70,7 +70,7 @@ const QString VToolFlippingByAxis::ToolType = QStringLiteral("flippingByAxis"); void VToolFlippingByAxis::setDialog() { SCASSERT(not m_dialog.isNull()) - QSharedPointer dialogTool = m_dialog.objectCast(); + const QPointer dialogTool = qobject_cast(m_dialog); SCASSERT(not dialogTool.isNull()) dialogTool->SetOriginPointId(m_originPointId); dialogTool->SetAxisType(m_axisType); @@ -78,11 +78,11 @@ void VToolFlippingByAxis::setDialog() } //--------------------------------------------------------------------------------------------------------------------- -VToolFlippingByAxis *VToolFlippingByAxis::Create(QSharedPointer dialog, VMainGraphicsScene *scene, +VToolFlippingByAxis *VToolFlippingByAxis::Create(const QPointer &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data) { SCASSERT(not dialog.isNull()) - QSharedPointer dialogTool = dialog.objectCast(); + const QPointer dialogTool = qobject_cast(dialog); SCASSERT(not dialogTool.isNull()) VToolFlippingByAxisInitData initData; @@ -99,7 +99,7 @@ VToolFlippingByAxis *VToolFlippingByAxis::Create(QSharedPointer dial VToolFlippingByAxis* operation = Create(initData); if (operation != nullptr) { - operation->m_dialog = dialogTool; + operation->m_dialog = dialog; } return operation; } @@ -200,7 +200,7 @@ void VToolFlippingByAxis::SaveDialog(QDomElement &domElement, QList &ol QList &newDependencies) { SCASSERT(not m_dialog.isNull()) - QSharedPointer dialogTool = m_dialog.objectCast(); + const QPointer dialogTool = qobject_cast(m_dialog); SCASSERT(not dialogTool.isNull()) AddDependence(oldDependencies, m_originPointId); diff --git a/src/libs/vtools/tools/drawTools/operation/flipping/vtoolflippingbyaxis.h b/src/libs/vtools/tools/drawTools/operation/flipping/vtoolflippingbyaxis.h index 524257efd..d9c1a07c3 100644 --- a/src/libs/vtools/tools/drawTools/operation/flipping/vtoolflippingbyaxis.h +++ b/src/libs/vtools/tools/drawTools/operation/flipping/vtoolflippingbyaxis.h @@ -51,7 +51,7 @@ class VToolFlippingByAxis : public VAbstractFlipping public: virtual ~VToolFlippingByAxis() Q_DECL_EQ_DEFAULT; virtual void setDialog() override; - static VToolFlippingByAxis* Create(QSharedPointer dialog, VMainGraphicsScene *scene, + static VToolFlippingByAxis* Create(const QPointer &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data); static VToolFlippingByAxis* Create(VToolFlippingByAxisInitData initData); diff --git a/src/libs/vtools/tools/drawTools/operation/flipping/vtoolflippingbyline.cpp b/src/libs/vtools/tools/drawTools/operation/flipping/vtoolflippingbyline.cpp index 02217d8e5..f2ef954f3 100644 --- a/src/libs/vtools/tools/drawTools/operation/flipping/vtoolflippingbyline.cpp +++ b/src/libs/vtools/tools/drawTools/operation/flipping/vtoolflippingbyline.cpp @@ -70,7 +70,7 @@ const QString VToolFlippingByLine::ToolType = QStringLiteral("flippingByLine"); void VToolFlippingByLine::setDialog() { SCASSERT(not m_dialog.isNull()) - QSharedPointer dialogTool = m_dialog.objectCast(); + const QPointer dialogTool = qobject_cast(m_dialog); SCASSERT(not dialogTool.isNull()) dialogTool->SetFirstLinePointId(m_firstLinePointId); dialogTool->SetSecondLinePointId(m_secondLinePointId); @@ -78,11 +78,11 @@ void VToolFlippingByLine::setDialog() } //--------------------------------------------------------------------------------------------------------------------- -VToolFlippingByLine *VToolFlippingByLine::Create(QSharedPointer dialog, VMainGraphicsScene *scene, +VToolFlippingByLine *VToolFlippingByLine::Create(const QPointer &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data) { SCASSERT(not dialog.isNull()) - QSharedPointer dialogTool = dialog.objectCast(); + const QPointer dialogTool = qobject_cast(dialog); SCASSERT(not dialogTool.isNull()) VToolFlippingByLineInitData initData; @@ -99,7 +99,7 @@ VToolFlippingByLine *VToolFlippingByLine::Create(QSharedPointer dial VToolFlippingByLine* operation = Create(initData); if (operation != nullptr) { - operation->m_dialog = dialogTool; + operation->m_dialog = dialog; } return operation; } @@ -185,7 +185,7 @@ void VToolFlippingByLine::SaveDialog(QDomElement &domElement, QList &ol QList &newDependencies) { SCASSERT(not m_dialog.isNull()) - QSharedPointer dialogTool = m_dialog.objectCast(); + const QPointer dialogTool = qobject_cast(m_dialog); SCASSERT(not dialogTool.isNull()) AddDependence(oldDependencies, m_firstLinePointId); diff --git a/src/libs/vtools/tools/drawTools/operation/flipping/vtoolflippingbyline.h b/src/libs/vtools/tools/drawTools/operation/flipping/vtoolflippingbyline.h index 069cfdac1..44c802309 100644 --- a/src/libs/vtools/tools/drawTools/operation/flipping/vtoolflippingbyline.h +++ b/src/libs/vtools/tools/drawTools/operation/flipping/vtoolflippingbyline.h @@ -52,7 +52,7 @@ class VToolFlippingByLine : public VAbstractFlipping public: virtual ~VToolFlippingByLine() Q_DECL_EQ_DEFAULT; virtual void setDialog() override; - static VToolFlippingByLine* Create(QSharedPointer dialog, VMainGraphicsScene *scene, + static VToolFlippingByLine* Create(const QPointer &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data); static VToolFlippingByLine* Create(VToolFlippingByLineInitData initData); diff --git a/src/libs/vtools/tools/drawTools/operation/vtoolmove.cpp b/src/libs/vtools/tools/drawTools/operation/vtoolmove.cpp index 4a4a6791f..0d9461f7d 100644 --- a/src/libs/vtools/tools/drawTools/operation/vtoolmove.cpp +++ b/src/libs/vtools/tools/drawTools/operation/vtoolmove.cpp @@ -131,7 +131,7 @@ QT_WARNING_POP void VToolMove::setDialog() { SCASSERT(not m_dialog.isNull()) - QSharedPointer dialogTool = m_dialog.objectCast(); + const QPointer dialogTool = qobject_cast(m_dialog); SCASSERT(not dialogTool.isNull()) dialogTool->SetAngle(formulaAngle); dialogTool->SetRotationAngle(formulaRotationAngle); @@ -141,11 +141,11 @@ void VToolMove::setDialog() } //--------------------------------------------------------------------------------------------------------------------- -VToolMove *VToolMove::Create(QSharedPointer dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, +VToolMove *VToolMove::Create(const QPointer &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data) { SCASSERT(not dialog.isNull()) - QSharedPointer dialogTool = dialog.objectCast(); + const QPointer dialogTool = qobject_cast(dialog); SCASSERT(not dialogTool.isNull()) VToolMoveInitData initData; @@ -164,7 +164,7 @@ VToolMove *VToolMove::Create(QSharedPointer dialog, VMainGraphicsSce VToolMove* operation = Create(initData); if (operation != nullptr) { - operation->m_dialog = dialogTool; + operation->m_dialog = dialog; } return operation; } @@ -463,7 +463,7 @@ void VToolMove::SetVisualization() void VToolMove::SaveDialog(QDomElement &domElement, QList &oldDependencies, QList &newDependencies) { SCASSERT(not m_dialog.isNull()) - QSharedPointer dialogTool = m_dialog.objectCast(); + const QPointer dialogTool = qobject_cast(m_dialog); SCASSERT(not dialogTool.isNull()) AddDependence(oldDependencies, origPointId); diff --git a/src/libs/vtools/tools/drawTools/operation/vtoolmove.h b/src/libs/vtools/tools/drawTools/operation/vtoolmove.h index 120b5a320..50961a9af 100644 --- a/src/libs/vtools/tools/drawTools/operation/vtoolmove.h +++ b/src/libs/vtools/tools/drawTools/operation/vtoolmove.h @@ -67,7 +67,7 @@ class VToolMove : public VAbstractOperation public: virtual ~VToolMove() Q_DECL_EQ_DEFAULT; virtual void setDialog() override; - static VToolMove* Create(QSharedPointer dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, + static VToolMove* Create(const QPointer &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data); static VToolMove* Create(VToolMoveInitData &initData); diff --git a/src/libs/vtools/tools/drawTools/operation/vtoolrotation.cpp b/src/libs/vtools/tools/drawTools/operation/vtoolrotation.cpp index 094c714bc..353be5a85 100644 --- a/src/libs/vtools/tools/drawTools/operation/vtoolrotation.cpp +++ b/src/libs/vtools/tools/drawTools/operation/vtoolrotation.cpp @@ -94,7 +94,7 @@ VToolRotation::VToolRotation(const VToolRotationInitData &initData, QGraphicsIte void VToolRotation::setDialog() { SCASSERT(not m_dialog.isNull()) - QSharedPointer dialogTool = m_dialog.objectCast(); + const QPointer dialogTool = qobject_cast(m_dialog); SCASSERT(not dialogTool.isNull()) dialogTool->SetOrigPointId(origPointId); dialogTool->SetAngle(formulaAngle); @@ -102,11 +102,11 @@ void VToolRotation::setDialog() } //--------------------------------------------------------------------------------------------------------------------- -VToolRotation *VToolRotation::Create(QSharedPointer dialog, VMainGraphicsScene *scene, +VToolRotation *VToolRotation::Create(const QPointer &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data) { SCASSERT(not dialog.isNull()) - QSharedPointer dialogTool = dialog.objectCast(); + const QPointer dialogTool = qobject_cast(dialog); SCASSERT(not dialogTool.isNull()) VToolRotationInitData initData; @@ -123,7 +123,7 @@ VToolRotation *VToolRotation::Create(QSharedPointer dialog, VMainGra VToolRotation* operation = Create(initData); if (operation != nullptr) { - operation->m_dialog = dialogTool; + operation->m_dialog = dialog; } return operation; } @@ -336,7 +336,7 @@ void VToolRotation::SaveDialog(QDomElement &domElement, QList &oldDepen QList &newDependencies) { SCASSERT(not m_dialog.isNull()) - QSharedPointer dialogTool = m_dialog.objectCast(); + const QPointer dialogTool = qobject_cast(m_dialog); SCASSERT(not dialogTool.isNull()) AddDependence(oldDependencies, origPointId); diff --git a/src/libs/vtools/tools/drawTools/operation/vtoolrotation.h b/src/libs/vtools/tools/drawTools/operation/vtoolrotation.h index 9acebfb8e..1168d5107 100644 --- a/src/libs/vtools/tools/drawTools/operation/vtoolrotation.h +++ b/src/libs/vtools/tools/drawTools/operation/vtoolrotation.h @@ -63,7 +63,7 @@ class VToolRotation : public VAbstractOperation public: virtual ~VToolRotation() Q_DECL_EQ_DEFAULT; virtual void setDialog() override; - static VToolRotation* Create(QSharedPointer dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, + static VToolRotation* Create(const QPointer &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data); static VToolRotation* Create(VToolRotationInitData &initData); diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolarc.cpp b/src/libs/vtools/tools/drawTools/toolcurve/vtoolarc.cpp index 4c28c5f46..6fce634c6 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolarc.cpp +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolarc.cpp @@ -80,7 +80,7 @@ VToolArc::VToolArc(const VToolArcInitData &initData, QGraphicsItem *parent) void VToolArc::setDialog() { SCASSERT(not m_dialog.isNull()) - QSharedPointer dialogTool = m_dialog.objectCast(); + const QPointer dialogTool = qobject_cast(m_dialog); SCASSERT(not dialogTool.isNull()) const QSharedPointer arc = VAbstractTool::data.GeometricObject(m_id); dialogTool->SetCenter(arc->GetCenter().id()); @@ -100,11 +100,11 @@ void VToolArc::setDialog() * @param doc dom document container * @param data container with variables */ -VToolArc* VToolArc::Create(QSharedPointer dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, +VToolArc* VToolArc::Create(const QPointer &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data) { SCASSERT(not dialog.isNull()) - QSharedPointer dialogTool = dialog.objectCast(); + const QPointer dialogTool = qobject_cast(dialog); SCASSERT(not dialogTool.isNull()) VToolArcInitData initData; @@ -124,7 +124,7 @@ VToolArc* VToolArc::Create(QSharedPointer dialog, VMainGraphicsScene VToolArc* point = Create(initData); if (point != nullptr) { - point->m_dialog = dialogTool; + point->m_dialog = dialog; } return point; } @@ -321,7 +321,7 @@ void VToolArc::RemoveReferens() void VToolArc::SaveDialog(QDomElement &domElement, QList &oldDependencies, QList &newDependencies) { SCASSERT(not m_dialog.isNull()) - QSharedPointer dialogTool = m_dialog.objectCast(); + QPointer dialogTool = qobject_cast(m_dialog); SCASSERT(not dialogTool.isNull()) QSharedPointer arc = VAbstractTool::data.GeometricObject(m_id); diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolarc.h b/src/libs/vtools/tools/drawTools/toolcurve/vtoolarc.h index 4aa06675e..14d005512 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolarc.h +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolarc.h @@ -67,7 +67,7 @@ class VToolArc :public VToolAbstractArc Q_OBJECT public: virtual void setDialog() override; - static VToolArc* Create(QSharedPointer dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, + static VToolArc* Create(const QPointer &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data); static VToolArc* Create(VToolArcInitData &initData); diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolarcwithlength.cpp b/src/libs/vtools/tools/drawTools/toolcurve/vtoolarcwithlength.cpp index 517750d1d..1a9198f4d 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolarcwithlength.cpp +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolarcwithlength.cpp @@ -73,7 +73,7 @@ VToolArcWithLength::VToolArcWithLength(const VToolArcWithLengthInitData &initDat void VToolArcWithLength::setDialog() { SCASSERT(not m_dialog.isNull()) - QSharedPointer dialogTool = m_dialog.objectCast(); + const QPointer dialogTool = qobject_cast(m_dialog); SCASSERT(not dialogTool.isNull()) const QSharedPointer arc = VAbstractTool::data.GeometricObject(m_id); dialogTool->SetCenter(arc->GetCenter().id()); @@ -86,11 +86,11 @@ void VToolArcWithLength::setDialog() } //--------------------------------------------------------------------------------------------------------------------- -VToolArcWithLength *VToolArcWithLength::Create(QSharedPointer dialog, VMainGraphicsScene *scene, +VToolArcWithLength *VToolArcWithLength::Create(const QPointer &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data) { SCASSERT(not dialog.isNull()) - QSharedPointer dialogTool = dialog.objectCast(); + const QPointer dialogTool = qobject_cast(dialog); SCASSERT(not dialogTool.isNull()) VToolArcWithLengthInitData initData; @@ -110,7 +110,7 @@ VToolArcWithLength *VToolArcWithLength::Create(QSharedPointer dialog VToolArcWithLength* point = Create(initData); if (point != nullptr) { - point->m_dialog = dialogTool; + point->m_dialog = dialog; } return point; } @@ -299,7 +299,7 @@ void VToolArcWithLength::SaveDialog(QDomElement &domElement, QList &old QList &newDependencies) { SCASSERT(not m_dialog.isNull()) - QSharedPointer dialogTool = m_dialog.objectCast(); + const QPointer dialogTool = qobject_cast(m_dialog); SCASSERT(not dialogTool.isNull()) QSharedPointer arc = VAbstractTool::data.GeometricObject(m_id); diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolarcwithlength.h b/src/libs/vtools/tools/drawTools/toolcurve/vtoolarcwithlength.h index e98b9b647..bc46bdf24 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolarcwithlength.h +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolarcwithlength.h @@ -64,7 +64,7 @@ class VToolArcWithLength : public VToolAbstractArc Q_OBJECT public: virtual void setDialog() override; - static VToolArcWithLength* Create(QSharedPointer dialog, VMainGraphicsScene *scene, + static VToolArcWithLength* Create(const QPointer &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data); static VToolArcWithLength* Create(VToolArcWithLengthInitData &initData); diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezier.cpp b/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezier.cpp index 515f78ced..09bb5943e 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezier.cpp +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezier.cpp @@ -78,11 +78,11 @@ void VToolCubicBezier::setDialog() } //--------------------------------------------------------------------------------------------------------------------- -VToolCubicBezier *VToolCubicBezier::Create(QSharedPointer dialog, VMainGraphicsScene *scene, +VToolCubicBezier *VToolCubicBezier::Create(const QPointer &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data) { SCASSERT(not dialog.isNull()) - QSharedPointer dialogTool = dialog.objectCast(); + const QPointer dialogTool = qobject_cast(dialog); SCASSERT(not dialogTool.isNull()) VToolCubicBezierInitData initData; @@ -97,7 +97,7 @@ VToolCubicBezier *VToolCubicBezier::Create(QSharedPointer dialog, VM if (spl != nullptr) { - spl->m_dialog = dialogTool; + spl->m_dialog = dialog; } return spl; } diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezier.h b/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezier.h index c27f4b23d..1b5c47e60 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezier.h +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezier.h @@ -64,7 +64,7 @@ class VToolCubicBezier : public VAbstractSpline public: virtual ~VToolCubicBezier() Q_DECL_EQ_DEFAULT; virtual void setDialog() override; - static VToolCubicBezier *Create(QSharedPointer dialog, VMainGraphicsScene *scene, + static VToolCubicBezier *Create(const QPointer &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data); static VToolCubicBezier *Create(VToolCubicBezierInitData initData); static const QString ToolType; diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezierpath.cpp b/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezierpath.cpp index e4a97bda9..4f886e544 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezierpath.cpp +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezierpath.cpp @@ -80,11 +80,11 @@ void VToolCubicBezierPath::setDialog() } //--------------------------------------------------------------------------------------------------------------------- -VToolCubicBezierPath *VToolCubicBezierPath::Create(QSharedPointer dialog, VMainGraphicsScene *scene, +VToolCubicBezierPath *VToolCubicBezierPath::Create(const QPointer &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data) { SCASSERT(not dialog.isNull()) - QSharedPointer dialogTool = dialog.objectCast(); + const QPointer dialogTool = qobject_cast(dialog); SCASSERT(not dialogTool.isNull()) VToolCubicBezierPathInitData initData; @@ -103,7 +103,7 @@ VToolCubicBezierPath *VToolCubicBezierPath::Create(QSharedPointer di VToolCubicBezierPath* spl = Create(initData); if (spl != nullptr) { - spl->m_dialog = dialogTool; + spl->m_dialog = dialog; } return spl; } diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezierpath.h b/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezierpath.h index f28451330..120289198 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezierpath.h +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezierpath.h @@ -64,7 +64,7 @@ class VToolCubicBezierPath:public VAbstractSpline public: virtual ~VToolCubicBezierPath() Q_DECL_EQ_DEFAULT; virtual void setDialog() override; - static VToolCubicBezierPath *Create(QSharedPointer dialog, VMainGraphicsScene *scene, + static VToolCubicBezierPath *Create(const QPointer &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data); static VToolCubicBezierPath *Create(VToolCubicBezierPathInitData initData); diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolellipticalarc.cpp b/src/libs/vtools/tools/drawTools/toolcurve/vtoolellipticalarc.cpp index e3feaf8f7..fa8b4e572 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolellipticalarc.cpp +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolellipticalarc.cpp @@ -81,7 +81,7 @@ VToolEllipticalArc::VToolEllipticalArc(const VToolEllipticalArcInitData &initDat void VToolEllipticalArc::setDialog() { SCASSERT(not m_dialog.isNull()) - QSharedPointer dialogTool = m_dialog.objectCast(); + const QPointer dialogTool = qobject_cast(m_dialog); SCASSERT(not dialogTool.isNull()) const QSharedPointer elArc = VAbstractTool::data.GeometricObject(m_id); dialogTool->SetCenter(elArc->GetCenter().id()); @@ -102,11 +102,11 @@ void VToolEllipticalArc::setDialog() * @param doc dom document container * @param data container with variables */ -VToolEllipticalArc* VToolEllipticalArc::Create(QSharedPointer dialog, VMainGraphicsScene *scene, +VToolEllipticalArc* VToolEllipticalArc::Create(const QPointer &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data) { SCASSERT(not dialog.isNull()) - QSharedPointer dialogTool = dialog.objectCast(); + const QPointer dialogTool = qobject_cast(dialog); SCASSERT(not dialogTool.isNull()) VToolEllipticalArcInitData initData; @@ -128,7 +128,7 @@ VToolEllipticalArc* VToolEllipticalArc::Create(QSharedPointer dialog VToolEllipticalArc* point = Create(initData); if (point != nullptr) { - point->m_dialog = dialogTool; + point->m_dialog = dialog; } return point; } @@ -367,7 +367,7 @@ void VToolEllipticalArc::SaveDialog(QDomElement &domElement, QList &old QList &newDependencies) { SCASSERT(not m_dialog.isNull()) - QSharedPointer dialogTool = m_dialog.objectCast(); + const QPointer dialogTool = qobject_cast(m_dialog); SCASSERT(not dialogTool.isNull()) const auto elArc = VAbstractTool::data.GeometricObject(m_id); diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolellipticalarc.h b/src/libs/vtools/tools/drawTools/toolcurve/vtoolellipticalarc.h index e5e7d43e9..da3634b9d 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolellipticalarc.h +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolellipticalarc.h @@ -71,7 +71,7 @@ class VToolEllipticalArc : public VToolAbstractArc Q_OBJECT public: virtual void setDialog() override; - static VToolEllipticalArc* Create(QSharedPointer dialog, VMainGraphicsScene *scene, + static VToolEllipticalArc* Create(const QPointer &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data); static VToolEllipticalArc* Create(VToolEllipticalArcInitData &initData); static const QString ToolType; diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolspline.cpp b/src/libs/vtools/tools/drawTools/toolcurve/vtoolspline.cpp index d82b89f7c..f9498568a 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolspline.cpp +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolspline.cpp @@ -127,7 +127,7 @@ VToolSpline::VToolSpline(VToolSplineInitData initData, QGraphicsItem *parent) void VToolSpline::setDialog() { SCASSERT(not m_dialog.isNull()) - QSharedPointer dialogTool = m_dialog.objectCast(); + const QPointer dialogTool = qobject_cast(m_dialog); SCASSERT(not dialogTool.isNull()) const auto spl = VAbstractTool::data.GeometricObject(m_id); dialogTool->SetSpline(*spl); @@ -142,11 +142,11 @@ void VToolSpline::setDialog() * @param data container with variables. * @return the created tool */ -VToolSpline* VToolSpline::Create(QSharedPointer dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, +VToolSpline* VToolSpline::Create(const QPointer &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data) { SCASSERT(not dialog.isNull()) - QSharedPointer dialogTool = dialog.objectCast(); + const QPointer dialogTool = qobject_cast(dialog); SCASSERT(not dialogTool.isNull()) VToolSplineInitData initData; @@ -160,7 +160,7 @@ VToolSpline* VToolSpline::Create(QSharedPointer dialog, VMainGraphic if (spl != nullptr) { - spl->m_dialog = dialogTool; + spl->m_dialog = dialog; } return spl; } diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolspline.h b/src/libs/vtools/tools/drawTools/toolcurve/vtoolspline.h index 387d459c7..fec692e71 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolspline.h +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolspline.h @@ -76,7 +76,7 @@ class VToolSpline:public VAbstractSpline public: virtual ~VToolSpline() =default; virtual void setDialog() override; - static VToolSpline *Create(QSharedPointer dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, + static VToolSpline *Create(const QPointer &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data); static VToolSpline *Create(VToolSplineInitData &initData, VSpline *spline); static VToolSpline *Create(VToolSplineInitData &initData); diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolsplinepath.cpp b/src/libs/vtools/tools/drawTools/toolcurve/vtoolsplinepath.cpp index bc9e3de6c..8a3a26425 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolsplinepath.cpp +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolsplinepath.cpp @@ -138,7 +138,7 @@ VToolSplinePath::VToolSplinePath(const VToolSplinePathInitData &initData, QGraph void VToolSplinePath::setDialog() { SCASSERT(not m_dialog.isNull()) - QSharedPointer dialogTool = m_dialog.objectCast(); + const QPointer dialogTool = qobject_cast(m_dialog); SCASSERT(not dialogTool.isNull()) const QSharedPointer splPath = VAbstractTool::data.GeometricObject(m_id); dialogTool->SetPath(*splPath); @@ -152,11 +152,11 @@ void VToolSplinePath::setDialog() * @param doc dom document container. * @param data container with variables. */ -VToolSplinePath* VToolSplinePath::Create(QSharedPointer dialog, VMainGraphicsScene *scene, +VToolSplinePath* VToolSplinePath::Create(const QPointer &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data) { SCASSERT(not dialog.isNull()) - QSharedPointer dialogTool = dialog.objectCast(); + const QPointer dialogTool = qobject_cast(dialog); SCASSERT(not dialogTool.isNull()) VToolSplinePathInitData initData; @@ -175,7 +175,7 @@ VToolSplinePath* VToolSplinePath::Create(QSharedPointer dialog, VMai VToolSplinePath* spl = Create(initData, path); if (spl != nullptr) { - spl->m_dialog = dialogTool; + spl->m_dialog = dialog; } return spl; } @@ -466,7 +466,7 @@ void VToolSplinePath::SaveDialog(QDomElement &domElement, QList &oldDep QList &newDependencies) { SCASSERT(not m_dialog.isNull()) - QSharedPointer dialogTool = m_dialog.objectCast(); + const QPointer dialogTool = qobject_cast(m_dialog); SCASSERT(not dialogTool.isNull()) const auto oldSplPath = VAbstractTool::data.GeometricObject(m_id); diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolsplinepath.h b/src/libs/vtools/tools/drawTools/toolcurve/vtoolsplinepath.h index e8176c302..5830d6d15 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolsplinepath.h +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolsplinepath.h @@ -75,7 +75,7 @@ class VToolSplinePath:public VAbstractSpline public: virtual ~VToolSplinePath() =default; virtual void setDialog() override; - static VToolSplinePath *Create(QSharedPointer dialog, VMainGraphicsScene *scene, + static VToolSplinePath *Create(const QPointer &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data); static VToolSplinePath *Create(VToolSplinePathInitData &initData, VSplinePath *path); static VToolSplinePath *Create(VToolSplinePathInitData &initData); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/tooldoublepoint/vtooltruedarts.cpp b/src/libs/vtools/tools/drawTools/toolpoint/tooldoublepoint/vtooltruedarts.cpp index ee6a1e930..c36e26646 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/tooldoublepoint/vtooltruedarts.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/tooldoublepoint/vtooltruedarts.cpp @@ -94,7 +94,7 @@ void VToolTrueDarts::FindPoint(const QPointF &baseLineP1, const QPointF &baseLin void VToolTrueDarts::setDialog() { SCASSERT(not m_dialog.isNull()) - QSharedPointer dialogTool = m_dialog.objectCast(); + const QPointer dialogTool = qobject_cast(m_dialog); SCASSERT(not dialogTool.isNull()) const QSharedPointer p1 = VAbstractTool::data.GeometricObject(p1id); @@ -110,11 +110,11 @@ void VToolTrueDarts::setDialog() } //--------------------------------------------------------------------------------------------------------------------- -VToolTrueDarts *VToolTrueDarts::Create(QSharedPointer dialog, VMainGraphicsScene *scene, +VToolTrueDarts *VToolTrueDarts::Create(const QPointer &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data) { SCASSERT(not dialog.isNull()) - QSharedPointer dialogTool = dialog.objectCast(); + const QPointer dialogTool = qobject_cast(dialog); SCASSERT(not dialogTool.isNull()) VToolTrueDartsInitData initData; @@ -134,7 +134,7 @@ VToolTrueDarts *VToolTrueDarts::Create(QSharedPointer dialog, VMainG VToolTrueDarts *point = Create(initData); if (point != nullptr) { - point->m_dialog = dialogTool; + point->m_dialog = dialog; } return point; } @@ -265,7 +265,7 @@ void VToolTrueDarts::SaveDialog(QDomElement &domElement, QList &oldDepe QList &newDependencies) { SCASSERT(not m_dialog.isNull()) - QSharedPointer dialogTool = m_dialog.objectCast(); + const QPointer dialogTool = qobject_cast(m_dialog); SCASSERT(not dialogTool.isNull()) AddDependence(oldDependencies, baseLineP1Id); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/tooldoublepoint/vtooltruedarts.h b/src/libs/vtools/tools/drawTools/toolpoint/tooldoublepoint/vtooltruedarts.h index 56ef6dbd1..24a5e7f3d 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/tooldoublepoint/vtooltruedarts.h +++ b/src/libs/vtools/tools/drawTools/toolpoint/tooldoublepoint/vtooltruedarts.h @@ -89,7 +89,7 @@ public: static void FindPoint(const QPointF &baseLineP1, const QPointF &baseLineP2, const QPointF &dartP1, const QPointF &dartP2, const QPointF &dartP3, QPointF &p1, QPointF &p2); virtual void setDialog() override; - static VToolTrueDarts* Create(QSharedPointer dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, + static VToolTrueDarts* Create(const QPointer &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data); static VToolTrueDarts* Create(VToolTrueDartsInitData initData); static const QString ToolType; 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 20dca6775..129f4539c 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutarc.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutarc.cpp @@ -75,7 +75,7 @@ VToolCutArc::VToolCutArc(const VToolCutArcInitData &initData, QGraphicsItem * pa void VToolCutArc::setDialog() { SCASSERT(not m_dialog.isNull()) - QSharedPointer dialogTool = m_dialog.objectCast(); + const QPointer dialogTool = qobject_cast(m_dialog); SCASSERT(not dialogTool.isNull()) const QSharedPointer point = VAbstractTool::data.GeometricObject(m_id); dialogTool->SetFormula(formula); @@ -91,11 +91,11 @@ void VToolCutArc::setDialog() * @param doc dom document container. * @param data container with variables. */ -VToolCutArc* VToolCutArc::Create(QSharedPointer dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, +VToolCutArc* VToolCutArc::Create(const QPointer &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data) { SCASSERT(not dialog.isNull()) - QSharedPointer dialogTool = dialog.objectCast(); + const QPointer dialogTool = qobject_cast(dialog); SCASSERT(not dialogTool.isNull()) VToolCutArcInitData initData; @@ -111,7 +111,7 @@ VToolCutArc* VToolCutArc::Create(QSharedPointer dialog, VMainGraphic VToolCutArc* point = Create(initData); if (point != nullptr) { - point->m_dialog = dialogTool; + point->m_dialog = dialog; } return point; } @@ -199,7 +199,7 @@ void VToolCutArc::SaveDialog(QDomElement &domElement, QList &oldDepende QList &newDependencies) { SCASSERT(not m_dialog.isNull()) - QSharedPointer dialogTool = m_dialog.objectCast(); + const QPointer dialogTool = qobject_cast(m_dialog); SCASSERT(not dialogTool.isNull()) AddDependence(oldDependencies, curveCutId); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutarc.h b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutarc.h index 201675d07..61155d242 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutarc.h +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutarc.h @@ -63,7 +63,7 @@ class VToolCutArc : public VToolCut Q_OBJECT public: virtual void setDialog() override; - static VToolCutArc* Create(QSharedPointer dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, + static VToolCutArc* Create(const QPointer &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data); static VToolCutArc* Create(VToolCutArcInitData &initData); static const QString ToolType; 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 d3992901a..f059e46a4 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.cpp @@ -78,7 +78,7 @@ VToolCutSpline::VToolCutSpline(const VToolCutSplineInitData &initData, QGraphics void VToolCutSpline::setDialog() { SCASSERT(not m_dialog.isNull()) - QSharedPointer dialogTool = m_dialog.objectCast(); + QPointer dialogTool = qobject_cast(m_dialog); SCASSERT(not dialogTool.isNull()) const QSharedPointer point = VAbstractTool::data.GeometricObject(m_id); dialogTool->SetFormula(formula); @@ -94,11 +94,11 @@ void VToolCutSpline::setDialog() * @param doc dom document container. * @param data container with variables. */ -VToolCutSpline* VToolCutSpline::Create(QSharedPointer dialog, VMainGraphicsScene *scene, +VToolCutSpline* VToolCutSpline::Create(const QPointer &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data) { SCASSERT(not dialog.isNull()) - QSharedPointer dialogTool = dialog.objectCast(); + const QPointer dialogTool = qobject_cast(dialog); SCASSERT(not dialogTool.isNull()) VToolCutSplineInitData initData; @@ -114,7 +114,7 @@ VToolCutSpline* VToolCutSpline::Create(QSharedPointer dialog, VMainG VToolCutSpline* point = Create(initData); if (point != nullptr) { - point->m_dialog = dialogTool; + point->m_dialog = dialog; } return point; } @@ -198,7 +198,7 @@ void VToolCutSpline::SaveDialog(QDomElement &domElement, QList &oldDepe QList &newDependencies) { SCASSERT(not m_dialog.isNull()) - QSharedPointer dialogTool = m_dialog.objectCast(); + const QPointer dialogTool = qobject_cast(m_dialog); SCASSERT(not dialogTool.isNull()) AddDependence(oldDependencies, curveCutId); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.h b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.h index 3652b57f5..45f2ae806 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.h +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.h @@ -63,7 +63,7 @@ class VToolCutSpline : public VToolCut Q_OBJECT public: virtual void setDialog() override; - static VToolCutSpline *Create(QSharedPointer dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, + static VToolCutSpline *Create(const QPointer &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data); static VToolCutSpline *Create(VToolCutSplineInitData &initData); static const QString ToolType; 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 fa1aed7c3..f383c5098 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.cpp @@ -81,7 +81,7 @@ VToolCutSplinePath::VToolCutSplinePath(const VToolCutSplinePathInitData &initDat void VToolCutSplinePath::setDialog() { SCASSERT(not m_dialog.isNull()) - QSharedPointer dialogTool = m_dialog.objectCast(); + const QPointer dialogTool = qobject_cast(m_dialog); SCASSERT(not dialogTool.isNull()) const QSharedPointer point = VAbstractTool::data.GeometricObject(m_id); dialogTool->SetFormula(formula); @@ -97,11 +97,11 @@ void VToolCutSplinePath::setDialog() * @param doc dom document container. * @param data container with variables. */ -VToolCutSplinePath* VToolCutSplinePath::Create(QSharedPointer dialog, VMainGraphicsScene *scene, +VToolCutSplinePath* VToolCutSplinePath::Create(const QPointer &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data) { SCASSERT(not dialog.isNull()) - QSharedPointer dialogTool = dialog.objectCast(); + const QPointer dialogTool = qobject_cast(dialog); SCASSERT(not dialogTool.isNull()) VToolCutSplinePathInitData initData; @@ -117,7 +117,7 @@ VToolCutSplinePath* VToolCutSplinePath::Create(QSharedPointer dialog VToolCutSplinePath* point = Create(initData); if (point != nullptr) { - point->m_dialog = dialogTool; + point->m_dialog = dialog; } return point; } @@ -289,7 +289,7 @@ void VToolCutSplinePath::SaveDialog(QDomElement &domElement, QList &old QList &newDependencies) { SCASSERT(not m_dialog.isNull()) - QSharedPointer dialogTool = m_dialog.objectCast(); + const QPointer dialogTool = qobject_cast(m_dialog); SCASSERT(not dialogTool.isNull()) AddDependence(oldDependencies, curveCutId); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.h b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.h index cf5d1e3a9..efd1ab6b0 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.h +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.h @@ -65,7 +65,7 @@ class VToolCutSplinePath : public VToolCut Q_OBJECT public: virtual void setDialog() override; - static VToolCutSplinePath *Create(QSharedPointer dialog, VMainGraphicsScene *scene, + static VToolCutSplinePath *Create(const QPointer &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data); static VToolCutSplinePath *Create(VToolCutSplinePathInitData &initData); static const QString ToolType; 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 9dce8e7c3..7872375e7 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolalongline.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolalongline.cpp @@ -91,7 +91,7 @@ void VToolAlongLine::SaveDialog(QDomElement &domElement, QList &oldDepe QList &newDependencies) { SCASSERT(not m_dialog.isNull()) - QSharedPointer dialogTool = m_dialog.objectCast(); + const QPointer dialogTool = qobject_cast(m_dialog); SCASSERT(not dialogTool.isNull()) AddDependence(oldDependencies, basePointId); @@ -198,7 +198,7 @@ void VToolAlongLine::ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quin void VToolAlongLine::setDialog() { SCASSERT(not m_dialog.isNull()) - QSharedPointer dialogTool = m_dialog.objectCast(); + const QPointer dialogTool = qobject_cast(m_dialog); SCASSERT(not dialogTool.isNull()) const QSharedPointer p = VAbstractTool::data.GeometricObject(m_id); dialogTool->SetTypeLine(m_lineType); @@ -217,11 +217,11 @@ void VToolAlongLine::setDialog() * @param doc dom document container. * @param data container with variables. */ -VToolAlongLine* VToolAlongLine::Create(QSharedPointer dialog, VMainGraphicsScene *scene, +VToolAlongLine* VToolAlongLine::Create(const QPointer &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data) { SCASSERT(not dialog.isNull()) - QSharedPointer dialogTool = dialog.objectCast(); + const QPointer dialogTool = qobject_cast(dialog); SCASSERT(not dialogTool.isNull()) VToolAlongLineInitData initData; @@ -240,7 +240,7 @@ VToolAlongLine* VToolAlongLine::Create(QSharedPointer dialog, VMainG VToolAlongLine *point = Create(initData); if (point != nullptr) { - point->m_dialog = dialogTool; + point->m_dialog = dialog; } return point; } diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolalongline.h b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolalongline.h index 7545348c0..cc47ecff5 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolalongline.h +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolalongline.h @@ -65,7 +65,7 @@ class VToolAlongLine : public VToolLinePoint Q_OBJECT public: virtual void setDialog() override; - static VToolAlongLine* Create(QSharedPointer dialog, VMainGraphicsScene *scene, + static VToolAlongLine* Create(const QPointer &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data); static VToolAlongLine* Create(VToolAlongLineInitData &initData); static const QString ToolType; 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 6eeabdca6..82658683b 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolbisector.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolbisector.cpp @@ -112,7 +112,7 @@ QPointF VToolBisector::FindPoint(const QPointF &firstPoint, const QPointF &secon void VToolBisector::setDialog() { SCASSERT(not m_dialog.isNull()) - QSharedPointer dialogTool = m_dialog.objectCast(); + const QPointer dialogTool = qobject_cast(m_dialog); SCASSERT(not dialogTool.isNull()) const QSharedPointer p = VAbstractTool::data.GeometricObject(m_id); dialogTool->SetTypeLine(m_lineType); @@ -132,11 +132,11 @@ void VToolBisector::setDialog() * @param doc dom document container. * @param data container with variables. */ -VToolBisector* VToolBisector::Create(QSharedPointer dialog, VMainGraphicsScene *scene, +VToolBisector* VToolBisector::Create(const QPointer &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data) { SCASSERT(not dialog.isNull()) - QSharedPointer dialogTool = dialog.objectCast(); + const QPointer dialogTool = qobject_cast(dialog); SCASSERT(not dialogTool.isNull()) VToolBisectorInitData initData; @@ -156,7 +156,7 @@ VToolBisector* VToolBisector::Create(QSharedPointer dialog, VMainGra VToolBisector *point = Create(initData); if (point != nullptr) { - point->m_dialog = dialogTool; + point->m_dialog = dialog; } return point; } @@ -244,7 +244,7 @@ void VToolBisector::SaveDialog(QDomElement &domElement, QList &oldDepen QList &newDependencies) { SCASSERT(not m_dialog.isNull()) - QSharedPointer dialogTool = m_dialog.objectCast(); + QPointer dialogTool = qobject_cast(m_dialog); SCASSERT(not dialogTool.isNull()) AddDependence(oldDependencies, firstPointId); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolbisector.h b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolbisector.h index 5347f180d..0370faaad 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolbisector.h +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolbisector.h @@ -71,7 +71,7 @@ public: static QPointF FindPoint(const QPointF &firstPoint, const QPointF &secondPoint, const QPointF &thirdPoint, const qreal& length); virtual void setDialog() override; - static VToolBisector* Create(QSharedPointer dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, + static VToolBisector* Create(const QPointer &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data); static VToolBisector* Create(VToolBisectorInitData &initData); static const QString ToolType; 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 e40c31441..3583f0a99 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolcurveintersectaxis.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolcurveintersectaxis.cpp @@ -86,7 +86,7 @@ void VToolCurveIntersectAxis::setDialog() { SCASSERT(not m_dialog.isNull()) m_dialog->setModal(true); - QSharedPointer dialogTool = m_dialog.objectCast(); + const QPointer dialogTool = qobject_cast(m_dialog); SCASSERT(not dialogTool.isNull()) const QSharedPointer p = VAbstractTool::data.GeometricObject(m_id); dialogTool->SetTypeLine(m_lineType); @@ -98,12 +98,12 @@ void VToolCurveIntersectAxis::setDialog() } //--------------------------------------------------------------------------------------------------------------------- -VToolCurveIntersectAxis *VToolCurveIntersectAxis::Create(QSharedPointer dialog, VMainGraphicsScene *scene, +VToolCurveIntersectAxis *VToolCurveIntersectAxis::Create(const QPointer &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data) { SCASSERT(not dialog.isNull()) - QSharedPointer dialogTool = dialog.objectCast(); + const QPointer dialogTool = qobject_cast(dialog); SCASSERT(not dialogTool.isNull()) VToolCurveIntersectAxisInitData initData; @@ -122,7 +122,7 @@ VToolCurveIntersectAxis *VToolCurveIntersectAxis::Create(QSharedPointerm_dialog = dialogTool; + point->m_dialog = dialog; } return point; } @@ -297,7 +297,7 @@ void VToolCurveIntersectAxis::SaveDialog(QDomElement &domElement, QList QList &newDependencies) { SCASSERT(not m_dialog.isNull()) - QSharedPointer dialogTool = m_dialog.objectCast(); + const QPointer dialogTool = qobject_cast(m_dialog); SCASSERT(not dialogTool.isNull()) AddDependence(oldDependencies, basePointId); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolcurveintersectaxis.h b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolcurveintersectaxis.h index e526355ea..60a914501 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolcurveintersectaxis.h +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolcurveintersectaxis.h @@ -67,7 +67,7 @@ public: virtual ~VToolCurveIntersectAxis() Q_DECL_EQ_DEFAULT; virtual void setDialog() override; - static VToolCurveIntersectAxis *Create(QSharedPointer dialog, VMainGraphicsScene *scene, + static VToolCurveIntersectAxis *Create(const QPointer &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data); static VToolCurveIntersectAxis *Create(VToolCurveIntersectAxisInitData &initData); 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 0a9abd5e9..f423e9347 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolendline.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolendline.cpp @@ -78,7 +78,7 @@ void VToolEndLine::setDialog() { SCASSERT(not m_dialog.isNull()) m_dialog->setModal(true); - QSharedPointer dialogTool = m_dialog.objectCast(); + QPointer dialogTool = qobject_cast(m_dialog); SCASSERT(not dialogTool.isNull()) const QSharedPointer p = VAbstractTool::data.GeometricObject(m_id); dialogTool->SetTypeLine(m_lineType); @@ -98,11 +98,11 @@ void VToolEndLine::setDialog() * @param data container with variables. * @return the created tool */ -VToolEndLine* VToolEndLine::Create(QSharedPointer dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, +VToolEndLine* VToolEndLine::Create(const QPointer &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data) { SCASSERT(not dialog.isNull()) - QSharedPointer dialogTool = dialog.objectCast(); + const QPointer dialogTool = qobject_cast(dialog); SCASSERT(not dialogTool.isNull()) VToolEndLineInitData initData; @@ -121,7 +121,7 @@ VToolEndLine* VToolEndLine::Create(QSharedPointer dialog, VMainGraph VToolEndLine *point = Create(initData); if (point != nullptr) { - point->m_dialog = dialogTool; + point->m_dialog = dialog; } return point; } @@ -178,7 +178,7 @@ void VToolEndLine::SaveDialog(QDomElement &domElement, QList &oldDepend QList &newDependencies) { SCASSERT(not m_dialog.isNull()) - QSharedPointer dialogTool = m_dialog.objectCast(); + const QPointer dialogTool = qobject_cast(m_dialog); SCASSERT(not dialogTool.isNull()) AddDependence(oldDependencies, basePointId); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolendline.h b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolendline.h index bca6c651d..b5fab6322 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolendline.h +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolendline.h @@ -67,7 +67,7 @@ class VToolEndLine : public VToolLinePoint public: virtual ~VToolEndLine() Q_DECL_EQ_DEFAULT; virtual void setDialog() override; - static VToolEndLine *Create(QSharedPointer dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, + static VToolEndLine *Create(const QPointer &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data); static VToolEndLine *Create(VToolEndLineInitData &initData); static const QString ToolType; 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 505f6fe79..f40db8918 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolheight.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolheight.cpp @@ -74,7 +74,7 @@ VToolHeight::VToolHeight(const VToolHeightInitData &initData, QGraphicsItem * pa void VToolHeight::setDialog() { SCASSERT(not m_dialog.isNull()) - QSharedPointer dialogTool = m_dialog.objectCast(); + const QPointer dialogTool = qobject_cast(m_dialog); SCASSERT(not dialogTool.isNull()) const QSharedPointer p = VAbstractTool::data.GeometricObject(m_id); dialogTool->SetTypeLine(m_lineType); @@ -94,11 +94,11 @@ void VToolHeight::setDialog() * @param data container with variables. * @return the created tool */ -VToolHeight* VToolHeight::Create(QSharedPointer dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, +VToolHeight* VToolHeight::Create(const QPointer &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data) { SCASSERT(not dialog.isNull()) - QSharedPointer dialogTool = dialog.objectCast(); + const QPointer dialogTool = qobject_cast(dialog); SCASSERT(not dialogTool.isNull()) VToolHeightInitData initData; @@ -117,7 +117,7 @@ VToolHeight* VToolHeight::Create(QSharedPointer dialog, VMainGraphic VToolHeight *point = Create(initData); if (point != nullptr) { - point->m_dialog = dialogTool; + point->m_dialog = dialog; } return point; } @@ -205,7 +205,7 @@ void VToolHeight::SaveDialog(QDomElement &domElement, QList &oldDepende QList &newDependencies) { SCASSERT(not m_dialog.isNull()) - QSharedPointer dialogTool = m_dialog.objectCast(); + const QPointer dialogTool = qobject_cast(m_dialog); SCASSERT(not dialogTool.isNull()) AddDependence(oldDependencies, basePointId); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolheight.h b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolheight.h index c8c66c9ca..03c27c8c4 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolheight.h +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolheight.h @@ -67,7 +67,7 @@ class VToolHeight: public VToolLinePoint Q_OBJECT public: virtual void setDialog() override; - static VToolHeight *Create(QSharedPointer dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, + static VToolHeight *Create(const QPointer &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data); static VToolHeight *Create(VToolHeightInitData initData); static QPointF FindPoint(const QLineF &line, const QPointF &point); 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 bda7524e4..d83ddb585 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollineintersectaxis.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollineintersectaxis.cpp @@ -72,7 +72,7 @@ void VToolLineIntersectAxis::setDialog() { SCASSERT(not m_dialog.isNull()) m_dialog->setModal(true); - QSharedPointer dialogTool = m_dialog.objectCast(); + const QPointer dialogTool = qobject_cast(m_dialog); SCASSERT(not dialogTool.isNull()) const QSharedPointer p = VAbstractTool::data.GeometricObject(m_id); dialogTool->SetTypeLine(m_lineType); @@ -85,11 +85,11 @@ void VToolLineIntersectAxis::setDialog() } //--------------------------------------------------------------------------------------------------------------------- -VToolLineIntersectAxis *VToolLineIntersectAxis::Create(QSharedPointer dialog, VMainGraphicsScene *scene, +VToolLineIntersectAxis *VToolLineIntersectAxis::Create(const QPointer &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data) { SCASSERT(not dialog.isNull()) - QSharedPointer dialogTool = dialog.objectCast(); + const QPointer dialogTool = qobject_cast(dialog); SCASSERT(not dialogTool.isNull()) VToolLineIntersectAxisInitData initData; @@ -109,7 +109,7 @@ VToolLineIntersectAxis *VToolLineIntersectAxis::Create(QSharedPointerm_dialog = dialogTool; + point->m_dialog = dialog; } return point; } @@ -259,7 +259,7 @@ void VToolLineIntersectAxis::SaveDialog(QDomElement &domElement, QList QList &newDependencies) { SCASSERT(not m_dialog.isNull()) - QSharedPointer dialogTool = m_dialog.objectCast(); + const QPointer dialogTool = qobject_cast(m_dialog); SCASSERT(not dialogTool.isNull()) AddDependence(oldDependencies, basePointId); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollineintersectaxis.h b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollineintersectaxis.h index e551ada26..954698cc8 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollineintersectaxis.h +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollineintersectaxis.h @@ -69,7 +69,7 @@ public: virtual ~VToolLineIntersectAxis() Q_DECL_EQ_DEFAULT; virtual void setDialog() override; - static VToolLineIntersectAxis *Create(QSharedPointer dialog, VMainGraphicsScene *scene, + static VToolLineIntersectAxis *Create(const QPointer &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data); static VToolLineIntersectAxis *Create(VToolLineIntersectAxisInitData &initData); 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 f3c757a5d..7164f5d79 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolnormal.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolnormal.cpp @@ -78,7 +78,7 @@ VToolNormal::VToolNormal(const VToolNormalInitData &initData, QGraphicsItem *par void VToolNormal::setDialog() { SCASSERT(not m_dialog.isNull()) - QSharedPointer dialogTool = m_dialog.objectCast(); + const QPointer dialogTool = qobject_cast(m_dialog); SCASSERT(not dialogTool.isNull()) const QSharedPointer p = VAbstractTool::data.GeometricObject(m_id); dialogTool->SetTypeLine(m_lineType); @@ -97,11 +97,11 @@ void VToolNormal::setDialog() * @param doc dom document container. * @param data container with variables. */ -VToolNormal* VToolNormal::Create(QSharedPointer dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, +VToolNormal* VToolNormal::Create(const QPointer &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data) { SCASSERT(not dialog.isNull()) - QSharedPointer dialogTool = dialog.objectCast(); + const QPointer dialogTool = qobject_cast(dialog); SCASSERT(not dialogTool.isNull()) VToolNormalInitData initData; @@ -121,7 +121,7 @@ VToolNormal* VToolNormal::Create(QSharedPointer dialog, VMainGraphic VToolNormal *point = Create(initData); if (point != nullptr) { - point->m_dialog = dialogTool; + point->m_dialog = dialog; } return point; } @@ -217,7 +217,7 @@ void VToolNormal::SaveDialog(QDomElement &domElement, QList &oldDepende QList &newDependencies) { SCASSERT(not m_dialog.isNull()) - QSharedPointer dialogTool = m_dialog.objectCast(); + const QPointer dialogTool = qobject_cast(m_dialog); SCASSERT(not dialogTool.isNull()) AddDependence(oldDependencies, basePointId); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolnormal.h b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolnormal.h index 6a0dd533b..e2e68532a 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolnormal.h +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolnormal.h @@ -68,7 +68,7 @@ class VToolNormal : public VToolLinePoint Q_OBJECT public: virtual void setDialog() override; - static VToolNormal* Create(QSharedPointer dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, + static VToolNormal* Create(const QPointer &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data); static VToolNormal* Create(VToolNormalInitData initData); static QPointF FindPoint(const QPointF &firstPoint, const QPointF &secondPoint, const qreal &length, 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 884b3a0c7..942cc6185 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolshoulderpoint.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolshoulderpoint.cpp @@ -80,7 +80,7 @@ VToolShoulderPoint::VToolShoulderPoint(const VToolShoulderPointInitData &initDat void VToolShoulderPoint::setDialog() { SCASSERT(not m_dialog.isNull()) - QSharedPointer dialogTool = m_dialog.objectCast(); + const QPointer dialogTool = qobject_cast(m_dialog); SCASSERT(not dialogTool.isNull()) const QSharedPointer p = VAbstractTool::data.GeometricObject(m_id); dialogTool->SetTypeLine(m_lineType); @@ -146,11 +146,11 @@ QPointF VToolShoulderPoint::FindPoint(const QPointF &p1Line, const QPointF &p2Li * @param data container with variables. * @return the created tool */ -VToolShoulderPoint* VToolShoulderPoint::Create(QSharedPointer dialog, VMainGraphicsScene *scene, +VToolShoulderPoint* VToolShoulderPoint::Create(const QPointer &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data) { SCASSERT(not dialog.isNull()) - QSharedPointer dialogTool = dialog.objectCast(); + const QPointer dialogTool = qobject_cast(dialog); SCASSERT(not dialogTool.isNull()) VToolShoulderPointInitData initData; @@ -170,7 +170,7 @@ VToolShoulderPoint* VToolShoulderPoint::Create(QSharedPointer dialog VToolShoulderPoint * point = Create(initData); if (point != nullptr) { - point->m_dialog = dialogTool; + point->m_dialog = dialog; } return point; } @@ -262,7 +262,7 @@ void VToolShoulderPoint::SaveDialog(QDomElement &domElement, QList &old QList &newDependencies) { SCASSERT(not m_dialog.isNull()) - QSharedPointer dialogTool = m_dialog.objectCast(); + const QPointer dialogTool = qobject_cast(m_dialog); SCASSERT(not dialogTool.isNull()) AddDependence(oldDependencies, basePointId); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolshoulderpoint.h b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolshoulderpoint.h index f122ee8bc..20a9230da 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolshoulderpoint.h +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolshoulderpoint.h @@ -71,7 +71,7 @@ public: virtual void setDialog() override; static QPointF FindPoint(const QPointF &p1Line, const QPointF &p2Line, const QPointF &pShoulder, const qreal &length); - static VToolShoulderPoint* Create(QSharedPointer dialog, VMainGraphicsScene *scene, + static VToolShoulderPoint* Create(const QPointer &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data); static VToolShoulderPoint* Create(VToolShoulderPointInitData &initData); static const QString ToolType; diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolbasepoint.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolbasepoint.cpp index df0bf3674..813ae62de 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolbasepoint.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolbasepoint.cpp @@ -93,7 +93,7 @@ VToolBasePoint::VToolBasePoint (const VToolBasePointInitData &initData, QGraphic void VToolBasePoint::setDialog() { SCASSERT(not m_dialog.isNull()) - QSharedPointer dialogTool = m_dialog.objectCast(); + const QPointer dialogTool = qobject_cast(m_dialog); SCASSERT(not dialogTool.isNull()) const QSharedPointer p = VAbstractTool::data.GeometricObject(m_id); dialogTool->SetData(p->name(), static_cast(*p)); @@ -291,7 +291,7 @@ void VToolBasePoint::SaveDialog(QDomElement &domElement, QList &oldDepe QList &newDependencies) { SCASSERT(not m_dialog.isNull()) - QSharedPointer dialogTool = m_dialog.objectCast(); + const QPointer dialogTool = qobject_cast(m_dialog); SCASSERT(not dialogTool.isNull()) Q_UNUSED(oldDependencies) diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoollineintersect.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoollineintersect.cpp index 47250b7ab..3723baac8 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoollineintersect.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoollineintersect.cpp @@ -78,7 +78,7 @@ VToolLineIntersect::VToolLineIntersect(const VToolLineIntersectInitData &initDat void VToolLineIntersect::setDialog() { SCASSERT(not m_dialog.isNull()) - QSharedPointer dialogTool = m_dialog.objectCast(); + const QPointer dialogTool = qobject_cast(m_dialog); SCASSERT(not dialogTool.isNull()) const QSharedPointer p = VAbstractTool::data.GeometricObject(m_id); dialogTool->SetP1Line1(p1Line1); @@ -97,11 +97,11 @@ void VToolLineIntersect::setDialog() * @param data container with variables. * @return the created tool */ -VToolLineIntersect* VToolLineIntersect::Create(QSharedPointer dialog, VMainGraphicsScene *scene, +VToolLineIntersect* VToolLineIntersect::Create(const QPointer &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data) { SCASSERT(not dialog.isNull()) - QSharedPointer dialogTool = dialog.objectCast(); + const QPointer dialogTool = qobject_cast(dialog); SCASSERT(not dialogTool.isNull()) VToolLineIntersectInitData initData; @@ -119,7 +119,7 @@ VToolLineIntersect* VToolLineIntersect::Create(QSharedPointer dialog VToolLineIntersect* point = Create(initData); if (point != nullptr) { - point->m_dialog = dialogTool; + point->m_dialog = dialog; } return point; } @@ -236,7 +236,7 @@ void VToolLineIntersect::SaveDialog(QDomElement &domElement, QList &old QList &newDependencies) { SCASSERT(not m_dialog.isNull()) - QSharedPointer dialogTool = m_dialog.objectCast(); + const QPointer dialogTool = qobject_cast(m_dialog); SCASSERT(not dialogTool.isNull()) AddDependence(oldDependencies, p1Line1); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoollineintersect.h b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoollineintersect.h index deab65ea0..29a3a76c8 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoollineintersect.h +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoollineintersect.h @@ -67,7 +67,7 @@ class VToolLineIntersect:public VToolSinglePoint Q_OBJECT public: virtual void setDialog() override; - static VToolLineIntersect *Create(QSharedPointer dialog, VMainGraphicsScene *scene, + static VToolLineIntersect *Create(const QPointer &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data); static VToolLineIntersect *Create(VToolLineIntersectInitData initData); static const QString ToolType; diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromarcandtangent.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromarcandtangent.cpp index 1cd9c3bf8..07f90ad12 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromarcandtangent.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromarcandtangent.cpp @@ -70,7 +70,7 @@ VToolPointFromArcAndTangent::VToolPointFromArcAndTangent(const VToolPointFromArc void VToolPointFromArcAndTangent::setDialog() { SCASSERT(not m_dialog.isNull()) - QSharedPointer dialogTool = m_dialog.objectCast(); + const QPointer dialogTool = qobject_cast(m_dialog); SCASSERT(not dialogTool.isNull()) const QSharedPointer p = VAbstractTool::data.GeometricObject(m_id); dialogTool->SetArcId(arcId); @@ -80,12 +80,12 @@ void VToolPointFromArcAndTangent::setDialog() } //--------------------------------------------------------------------------------------------------------------------- -VToolPointFromArcAndTangent *VToolPointFromArcAndTangent::Create(QSharedPointer dialog, +VToolPointFromArcAndTangent *VToolPointFromArcAndTangent::Create(const QPointer &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data) { SCASSERT(not dialog.isNull()) - QSharedPointer dialogTool = dialog.objectCast(); + const QPointer dialogTool = qobject_cast(dialog); SCASSERT(not dialogTool.isNull()) VToolPointFromArcAndTangentInitData initData; @@ -102,7 +102,7 @@ VToolPointFromArcAndTangent *VToolPointFromArcAndTangent::Create(QSharedPointer< VToolPointFromArcAndTangent *point = Create(initData); if (point != nullptr) { - point->m_dialog = dialogTool; + point->m_dialog = dialog; } return point; } @@ -284,7 +284,7 @@ void VToolPointFromArcAndTangent::SaveDialog(QDomElement &domElement, QList &newDependencies) { SCASSERT(not m_dialog.isNull()) - QSharedPointer dialogTool = m_dialog.objectCast(); + const QPointer dialogTool = qobject_cast(m_dialog); SCASSERT(not dialogTool.isNull()) AddDependence(oldDependencies, arcId); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromarcandtangent.h b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromarcandtangent.h index dc5f79c88..10ba8aa59 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromarcandtangent.h +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromarcandtangent.h @@ -63,7 +63,7 @@ class VToolPointFromArcAndTangent : public VToolSinglePoint Q_OBJECT public: virtual void setDialog() override; - static VToolPointFromArcAndTangent *Create(QSharedPointer dialog, VMainGraphicsScene *scene, + static VToolPointFromArcAndTangent *Create(const QPointer &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data); static VToolPointFromArcAndTangent *Create(VToolPointFromArcAndTangentInitData initData); static bool FindPoint(const QPointF &p, const VArc *arc, const CrossCirclesPoint pType, QPointF *intersectionPoint); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromcircleandtangent.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromcircleandtangent.cpp index fc53b3292..3e1c811b8 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromcircleandtangent.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromcircleandtangent.cpp @@ -72,7 +72,8 @@ VToolPointFromCircleAndTangent::VToolPointFromCircleAndTangent(const VToolPointF void VToolPointFromCircleAndTangent::setDialog() { SCASSERT(not m_dialog.isNull()) - QSharedPointer dialogTool = m_dialog.objectCast(); + const QPointer dialogTool = + qobject_cast(m_dialog); SCASSERT(not dialogTool.isNull()) const QSharedPointer p = VAbstractTool::data.GeometricObject(m_id); dialogTool->SetCircleCenterId(circleCenterId); @@ -83,12 +84,13 @@ void VToolPointFromCircleAndTangent::setDialog() } //--------------------------------------------------------------------------------------------------------------------- -VToolPointFromCircleAndTangent *VToolPointFromCircleAndTangent::Create(QSharedPointer dialog, +VToolPointFromCircleAndTangent *VToolPointFromCircleAndTangent::Create(const QPointer &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data) { SCASSERT(not dialog.isNull()) - QSharedPointer dialogTool = dialog.objectCast(); + const QPointer dialogTool = + qobject_cast(dialog); SCASSERT(not dialogTool.isNull()) VToolPointFromCircleAndTangentInitData initData; @@ -106,7 +108,7 @@ VToolPointFromCircleAndTangent *VToolPointFromCircleAndTangent::Create(QSharedPo VToolPointFromCircleAndTangent *point = Create(initData); if (point != nullptr) { - point->m_dialog = dialogTool; + point->m_dialog = dialog; } return point; } @@ -272,7 +274,8 @@ void VToolPointFromCircleAndTangent::SaveDialog(QDomElement &domElement, QList &newDependencies) { SCASSERT(not m_dialog.isNull()) - QSharedPointer dialogTool = m_dialog.objectCast(); + const QPointer dialogTool = + qobject_cast(m_dialog); SCASSERT(not dialogTool.isNull()) AddDependence(oldDependencies, circleCenterId); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromcircleandtangent.h b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromcircleandtangent.h index 72253691e..ffe19ab95 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromcircleandtangent.h +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromcircleandtangent.h @@ -66,7 +66,7 @@ class VToolPointFromCircleAndTangent : public VToolSinglePoint Q_OBJECT public: virtual void setDialog() override; - static VToolPointFromCircleAndTangent *Create(QSharedPointer dialog, VMainGraphicsScene *scene, + static VToolPointFromCircleAndTangent *Create(const QPointer &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data); static VToolPointFromCircleAndTangent *Create(VToolPointFromCircleAndTangentInitData &initData); static bool FindPoint(const QPointF &p, const QPointF ¢er, qreal radius, const CrossCirclesPoint crossPoint, diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofcontact.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofcontact.cpp index 098b2edef..77a2c8905 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofcontact.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofcontact.cpp @@ -84,7 +84,7 @@ VToolPointOfContact::VToolPointOfContact(const VToolPointOfContactInitData &init void VToolPointOfContact::setDialog() { SCASSERT(not m_dialog.isNull()) - QSharedPointer dialogTool = m_dialog.objectCast(); + const QPointer dialogTool = qobject_cast(m_dialog); SCASSERT(not dialogTool.isNull()) const QSharedPointer p = VAbstractTool::data.GeometricObject(m_id); dialogTool->setRadius(arcRadius); @@ -166,11 +166,11 @@ bool VToolPointOfContact::FindPoint(qreal radius, const QPointF ¢er, const Q * @param doc dom document container. * @param data container with variables. */ -VToolPointOfContact* VToolPointOfContact::Create(QSharedPointer dialog, VMainGraphicsScene *scene, +VToolPointOfContact* VToolPointOfContact::Create(const QPointer &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data) { SCASSERT(not dialog.isNull()) - QSharedPointer dialogTool = dialog.objectCast(); + const QPointer dialogTool = qobject_cast(dialog); SCASSERT(not dialogTool.isNull()) VToolPointOfContactInitData initData; @@ -188,7 +188,7 @@ VToolPointOfContact* VToolPointOfContact::Create(QSharedPointer dial VToolPointOfContact *point = Create(initData); if (point != nullptr) { - point->m_dialog = dialogTool; + point->m_dialog = dialog; } return point; } @@ -297,7 +297,7 @@ void VToolPointOfContact::SaveDialog(QDomElement &domElement, QList &ol QList &newDependencies) { SCASSERT(not m_dialog.isNull()) - QSharedPointer dialogTool = m_dialog.objectCast(); + const QPointer dialogTool = qobject_cast(m_dialog); SCASSERT(not dialogTool.isNull()) AddDependence(oldDependencies, center); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofcontact.h b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofcontact.h index a3d77f48a..3fc0ee216 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofcontact.h +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofcontact.h @@ -71,7 +71,7 @@ public: virtual void setDialog() override; static bool FindPoint(qreal radius, const QPointF ¢er, const QPointF &firstPoint, const QPointF &secondPoint, QPointF *intersectionPoint); - static VToolPointOfContact* Create(QSharedPointer dialog, VMainGraphicsScene *scene, + static VToolPointOfContact* Create(const QPointer &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data); static VToolPointOfContact* Create(VToolPointOfContactInitData &initData); static const QString ToolType; diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersection.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersection.cpp index 4e3d619f6..b681d0f2d 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersection.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersection.cpp @@ -75,7 +75,7 @@ VToolPointOfIntersection::VToolPointOfIntersection(const VToolPointOfIntersectio void VToolPointOfIntersection::setDialog() { SCASSERT(not m_dialog.isNull()) - QSharedPointer dialogTool = m_dialog.objectCast(); + const QPointer dialogTool = qobject_cast(m_dialog); SCASSERT(not dialogTool.isNull()) const QSharedPointer p = VAbstractTool::data.GeometricObject(m_id); dialogTool->SetFirstPointId(firstPointId); @@ -92,11 +92,12 @@ void VToolPointOfIntersection::setDialog() * @param data container with variables. * @return the created tool */ -VToolPointOfIntersection *VToolPointOfIntersection::Create(QSharedPointer dialog, VMainGraphicsScene *scene, - VAbstractPattern *doc, VContainer *data) +VToolPointOfIntersection *VToolPointOfIntersection::Create(const QPointer &dialog, + VMainGraphicsScene *scene, VAbstractPattern *doc, + VContainer *data) { SCASSERT(not dialog.isNull()) - QSharedPointer dialogTool = dialog.objectCast(); + const QPointer dialogTool = qobject_cast(dialog); SCASSERT(not dialogTool.isNull()) VToolPointOfIntersectionInitData initData; @@ -112,7 +113,7 @@ VToolPointOfIntersection *VToolPointOfIntersection::Create(QSharedPointerm_dialog = dialogTool; + point->m_dialog = dialog; } return point; } @@ -193,7 +194,7 @@ void VToolPointOfIntersection::SaveDialog(QDomElement &domElement, QList &newDependencies) { SCASSERT(not m_dialog.isNull()) - QSharedPointer dialogTool = m_dialog.objectCast(); + const QPointer dialogTool = qobject_cast(m_dialog); SCASSERT(not dialogTool.isNull()) AddDependence(oldDependencies, firstPointId); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersection.h b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersection.h index 54e9c247f..1ffbe9bfd 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersection.h +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersection.h @@ -63,7 +63,7 @@ class VToolPointOfIntersection : public VToolSinglePoint Q_OBJECT public: virtual void setDialog() override; - static VToolPointOfIntersection *Create(QSharedPointer dialog, VMainGraphicsScene *scene, + static VToolPointOfIntersection *Create(const QPointer &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data); static VToolPointOfIntersection *Create(VToolPointOfIntersectionInitData initData); static const QString ToolType; diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectionarcs.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectionarcs.cpp index 49cd5db84..a4bfa2dd9 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectionarcs.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectionarcs.cpp @@ -70,7 +70,7 @@ VToolPointOfIntersectionArcs::VToolPointOfIntersectionArcs(const VToolPointOfInt void VToolPointOfIntersectionArcs::setDialog() { SCASSERT(not m_dialog.isNull()) - QSharedPointer dialogTool = m_dialog.objectCast(); + const QPointer dialogTool = qobject_cast(m_dialog); SCASSERT(not dialogTool.isNull()) const QSharedPointer p = VAbstractTool::data.GeometricObject(m_id); dialogTool->SetFirstArcId(firstArcId); @@ -80,12 +80,12 @@ void VToolPointOfIntersectionArcs::setDialog() } //--------------------------------------------------------------------------------------------------------------------- -VToolPointOfIntersectionArcs *VToolPointOfIntersectionArcs::Create(QSharedPointer dialog, +VToolPointOfIntersectionArcs *VToolPointOfIntersectionArcs::Create(const QPointer &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data) { SCASSERT(not dialog.isNull()) - QSharedPointer dialogTool = dialog.objectCast(); + const QPointer dialogTool = qobject_cast(dialog); SCASSERT(not dialogTool.isNull()) VToolPointOfIntersectionArcsInitData initData; @@ -102,7 +102,7 @@ VToolPointOfIntersectionArcs *VToolPointOfIntersectionArcs::Create(QSharedPointe VToolPointOfIntersectionArcs *point = Create(initData); if (point != nullptr) { - point->m_dialog = dialogTool; + point->m_dialog = dialog; } return point; } @@ -306,7 +306,7 @@ void VToolPointOfIntersectionArcs::SaveDialog(QDomElement &domElement, QList &newDependencies) { SCASSERT(not m_dialog.isNull()) - QSharedPointer dialogTool = m_dialog.objectCast(); + const QPointer dialogTool = qobject_cast(m_dialog); SCASSERT(not dialogTool.isNull()) AddDependence(oldDependencies, firstArcId); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectionarcs.h b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectionarcs.h index 9e1630c72..8e143ba9a 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectionarcs.h +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectionarcs.h @@ -64,7 +64,7 @@ class VToolPointOfIntersectionArcs : public VToolSinglePoint public: virtual void setDialog() override; - static VToolPointOfIntersectionArcs *Create(QSharedPointer dialog, VMainGraphicsScene *scene, + static VToolPointOfIntersectionArcs *Create(const QPointer &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data); static VToolPointOfIntersectionArcs *Create(VToolPointOfIntersectionArcsInitData initData); static bool FindPoint(const VArc *arc1, const VArc *arc2, const CrossCirclesPoint pType, diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncircles.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncircles.cpp index e6bdd678e..3387a4b58 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncircles.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncircles.cpp @@ -73,8 +73,8 @@ VToolPointOfIntersectionCircles::VToolPointOfIntersectionCircles( void VToolPointOfIntersectionCircles::setDialog() { SCASSERT(not m_dialog.isNull()) - QSharedPointer dialogTool = - m_dialog.objectCast(); + const QPointer dialogTool = + qobject_cast(m_dialog); SCASSERT(not dialogTool.isNull()) const QSharedPointer p = VAbstractTool::data.GeometricObject(m_id); dialogTool->SetFirstCircleCenterId(firstCircleCenterId); @@ -86,12 +86,13 @@ void VToolPointOfIntersectionCircles::setDialog() } //--------------------------------------------------------------------------------------------------------------------- -VToolPointOfIntersectionCircles *VToolPointOfIntersectionCircles::Create(QSharedPointer dialog, +VToolPointOfIntersectionCircles *VToolPointOfIntersectionCircles::Create(const QPointer &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data) { SCASSERT(not dialog.isNull()) - QSharedPointer dialogTool = dialog.objectCast(); + const QPointer dialogTool = + qobject_cast(dialog); SCASSERT(not dialogTool.isNull()) VToolPointOfIntersectionCirclesInitData initData; @@ -110,7 +111,7 @@ VToolPointOfIntersectionCircles *VToolPointOfIntersectionCircles::Create(QShared VToolPointOfIntersectionCircles *point = Create(initData); if (point != nullptr) { - point->m_dialog = dialogTool; + point->m_dialog = dialog; } return point; } @@ -311,8 +312,8 @@ void VToolPointOfIntersectionCircles::SaveDialog(QDomElement &domElement, QList< QList &newDependencies) { SCASSERT(not m_dialog.isNull()) - QSharedPointer dialogTool = - m_dialog.objectCast(); + const QPointer dialogTool = + qobject_cast(m_dialog); SCASSERT(not dialogTool.isNull()) AddDependence(oldDependencies, firstCircleCenterId); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncircles.h b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncircles.h index c14e8b11e..c431c6e0b 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncircles.h +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncircles.h @@ -68,7 +68,7 @@ class VToolPointOfIntersectionCircles : public VToolSinglePoint Q_OBJECT public: virtual void setDialog() override; - static VToolPointOfIntersectionCircles *Create(QSharedPointer dialog, VMainGraphicsScene *scene, + static VToolPointOfIntersectionCircles *Create(const QPointer &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data); static VToolPointOfIntersectionCircles *Create(VToolPointOfIntersectionCirclesInitData &initData); static bool FindPoint(const QPointF &c1Point, const QPointF &c2Point, qreal c1Radius, qreal c2Radius, diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncurves.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncurves.cpp index ca2b6ed03..76d04bb93 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncurves.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncurves.cpp @@ -82,12 +82,13 @@ void VToolPointOfIntersectionCurves::setDialog() } //--------------------------------------------------------------------------------------------------------------------- -VToolPointOfIntersectionCurves *VToolPointOfIntersectionCurves::Create(QSharedPointer dialog, +VToolPointOfIntersectionCurves *VToolPointOfIntersectionCurves::Create(const QPointer &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data) { SCASSERT(not dialog.isNull()) - QSharedPointer dialogTool = dialog.objectCast(); + const QPointer dialogTool = + qobject_cast(dialog); SCASSERT(not dialogTool.isNull()) VToolPointOfIntersectionCurvesInitData initData; @@ -105,7 +106,7 @@ VToolPointOfIntersectionCurves *VToolPointOfIntersectionCurves::Create(QSharedPo VToolPointOfIntersectionCurves *point = Create(initData); if (point != nullptr) { - point->m_dialog = dialogTool; + point->m_dialog = dialog; } return point; } diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncurves.h b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncurves.h index 8ed555fea..14e6395d9 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncurves.h +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncurves.h @@ -66,7 +66,7 @@ class VToolPointOfIntersectionCurves : public VToolSinglePoint Q_OBJECT public: virtual void setDialog() override; - static VToolPointOfIntersectionCurves *Create(QSharedPointer dialog, VMainGraphicsScene *scene, + static VToolPointOfIntersectionCurves *Create(const QPointer &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data); static VToolPointOfIntersectionCurves *Create(VToolPointOfIntersectionCurvesInitData initData); static bool FindPoint(const QVector &curve1Points, const QVector &curve2Points, diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtooltriangle.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtooltriangle.cpp index d40accc2c..f5bca3d92 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtooltriangle.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtooltriangle.cpp @@ -79,7 +79,7 @@ VToolTriangle::VToolTriangle(const VToolTriangleInitData &initData, QGraphicsIte void VToolTriangle::setDialog() { SCASSERT(not m_dialog.isNull()) - QSharedPointer dialogTool = m_dialog.objectCast(); + const QPointer dialogTool = qobject_cast(m_dialog); SCASSERT(not dialogTool.isNull()) const QSharedPointer p = VAbstractTool::data.GeometricObject(m_id); dialogTool->SetAxisP1Id(axisP1Id); @@ -98,11 +98,11 @@ void VToolTriangle::setDialog() * @param data container with variables. * @return the created tool */ -VToolTriangle* VToolTriangle::Create(QSharedPointer dialog, VMainGraphicsScene *scene, +VToolTriangle* VToolTriangle::Create(const QPointer &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data) { SCASSERT(not dialog.isNull()) - QSharedPointer dialogTool = dialog.objectCast(); + const QPointer dialogTool = qobject_cast(dialog); SCASSERT(not dialogTool.isNull()) VToolTriangleInitData initData; @@ -120,7 +120,7 @@ VToolTriangle* VToolTriangle::Create(QSharedPointer dialog, VMainGra VToolTriangle* point = Create(initData); if (point != nullptr) { - point->m_dialog = dialogTool; + point->m_dialog = dialog; } return point; } @@ -282,7 +282,7 @@ void VToolTriangle::SaveDialog(QDomElement &domElement, QList &oldDepen QList &newDependencies) { SCASSERT(not m_dialog.isNull()) - QSharedPointer dialogTool = m_dialog.objectCast(); + const QPointer dialogTool = qobject_cast(m_dialog); SCASSERT(not dialogTool.isNull()) AddDependence(oldDependencies, axisP1Id); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtooltriangle.h b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtooltriangle.h index 1d6e24048..76fdec27b 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtooltriangle.h +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtooltriangle.h @@ -69,7 +69,7 @@ class VToolTriangle : public VToolSinglePoint Q_OBJECT public: virtual void setDialog() override; - static VToolTriangle *Create(QSharedPointer dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, + static VToolTriangle *Create(const QPointer &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data); static VToolTriangle *Create(VToolTriangleInitData initData); static bool FindPoint(const QPointF &axisP1, const QPointF &axisP2, const QPointF &firstPoint, diff --git a/src/libs/vtools/tools/drawTools/vdrawtool.h b/src/libs/vtools/tools/drawTools/vdrawtool.h index 21f9d1012..7be7bca28 100644 --- a/src/libs/vtools/tools/drawTools/vdrawtool.h +++ b/src/libs/vtools/tools/drawTools/vdrawtool.h @@ -260,7 +260,7 @@ void VDrawTool::ContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 itemI { qCDebug(vTool, "Show options."); emit qApp->getSceneView()->itemClicked(nullptr); - m_dialog = QSharedPointer(new Dialog(getData(), m_id, qApp->getMainWindow())); + m_dialog = QPointer(new Dialog(getData(), m_id, qApp->getMainWindow())); m_dialog->setModal(true); connect(m_dialog.data(), &DialogTool::DialogClosed, this, &VDrawTool::FullUpdateFromGuiOk); diff --git a/src/libs/vtools/tools/drawTools/vtoolline.cpp b/src/libs/vtools/tools/drawTools/vtoolline.cpp index 65b42bf43..324bcda90 100644 --- a/src/libs/vtools/tools/drawTools/vtoolline.cpp +++ b/src/libs/vtools/tools/drawTools/vtoolline.cpp @@ -86,7 +86,7 @@ VToolLine::VToolLine(const VToolLineInitData &initData, QGraphicsItem *parent) void VToolLine::setDialog() { SCASSERT(not m_dialog.isNull()) - QSharedPointer dialogTool = m_dialog.objectCast(); + const QPointer dialogTool = qobject_cast(m_dialog); SCASSERT(not dialogTool.isNull()) dialogTool->SetFirstPoint(firstPoint); dialogTool->SetSecondPoint(secondPoint); @@ -102,11 +102,11 @@ void VToolLine::setDialog() * @param doc dom document container. * @param data container with variables. */ -VToolLine *VToolLine::Create(QSharedPointer dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, +VToolLine *VToolLine::Create(const QPointer &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data) { SCASSERT(not dialog.isNull()) - QSharedPointer dialogTool = dialog.objectCast(); + const QPointer dialogTool = qobject_cast(dialog); SCASSERT(not dialogTool.isNull()) VToolLineInitData initData; @@ -123,7 +123,7 @@ VToolLine *VToolLine::Create(QSharedPointer dialog, VMainGraphicsSce VToolLine *line = Create(initData); if (line != nullptr) { - line->m_dialog = dialogTool; + line->m_dialog = dialog; } return line; } @@ -379,7 +379,7 @@ void VToolLine::SaveDialog(QDomElement &domElement, QList &oldDependenc QList &newDependencies) { SCASSERT(not m_dialog.isNull()) - QSharedPointer dialogTool = m_dialog.objectCast(); + const QPointer dialogTool = qobject_cast(m_dialog); SCASSERT(not dialogTool.isNull()) AddDependence(oldDependencies, firstPoint); diff --git a/src/libs/vtools/tools/drawTools/vtoolline.h b/src/libs/vtools/tools/drawTools/vtoolline.h index eb270e21f..6488f7505 100644 --- a/src/libs/vtools/tools/drawTools/vtoolline.h +++ b/src/libs/vtools/tools/drawTools/vtoolline.h @@ -68,7 +68,7 @@ class VToolLine: public VDrawTool, public VScaledLine Q_OBJECT public: virtual void setDialog() override; - static VToolLine *Create(QSharedPointer dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, + static VToolLine *Create(const QPointer &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data); static VToolLine *Create(VToolLineInitData initData); diff --git a/src/libs/vtools/tools/nodeDetails/vtoolpiecepath.cpp b/src/libs/vtools/tools/nodeDetails/vtoolpiecepath.cpp index e6474f401..df684936c 100644 --- a/src/libs/vtools/tools/nodeDetails/vtoolpiecepath.cpp +++ b/src/libs/vtools/tools/nodeDetails/vtoolpiecepath.cpp @@ -34,11 +34,11 @@ #include "../vtoolseamallowance.h" //--------------------------------------------------------------------------------------------------------------------- -VToolPiecePath *VToolPiecePath::Create(QSharedPointer dialog, VMainGraphicsScene *scene, +VToolPiecePath *VToolPiecePath::Create(const QPointer &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data) { SCASSERT(not dialog.isNull()); - QSharedPointer dialogTool = dialog.objectCast(); + const QPointer dialogTool = qobject_cast(dialog); SCASSERT(not dialogTool.isNull()) VToolPiecePathInitData initData; diff --git a/src/libs/vtools/tools/nodeDetails/vtoolpiecepath.h b/src/libs/vtools/tools/nodeDetails/vtoolpiecepath.h index a1e863eeb..829b3fd69 100644 --- a/src/libs/vtools/tools/nodeDetails/vtoolpiecepath.h +++ b/src/libs/vtools/tools/nodeDetails/vtoolpiecepath.h @@ -49,7 +49,7 @@ class VToolPiecePath : public VAbstractNode, public QGraphicsPathItem { Q_OBJECT public: - static VToolPiecePath* Create(QSharedPointer dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, + static VToolPiecePath* Create(const QPointer &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data); static VToolPiecePath *Create(VToolPiecePathInitData initData); diff --git a/src/libs/vtools/tools/nodeDetails/vtoolpin.cpp b/src/libs/vtools/tools/nodeDetails/vtoolpin.cpp index 0542a9f96..32b42e305 100644 --- a/src/libs/vtools/tools/nodeDetails/vtoolpin.cpp +++ b/src/libs/vtools/tools/nodeDetails/vtoolpin.cpp @@ -35,10 +35,10 @@ const QString VToolPin::ToolType = QStringLiteral("pin"); //--------------------------------------------------------------------------------------------------------------------- -VToolPin *VToolPin::Create(QSharedPointer dialog, VAbstractPattern *doc, VContainer *data) +VToolPin *VToolPin::Create(const QPointer &dialog, VAbstractPattern *doc, VContainer *data) { SCASSERT(not dialog.isNull()); - QSharedPointer dialogTool = dialog.objectCast(); + const QPointer dialogTool = qobject_cast(dialog); SCASSERT(not dialogTool.isNull()) VToolPinInitData initData; diff --git a/src/libs/vtools/tools/nodeDetails/vtoolpin.h b/src/libs/vtools/tools/nodeDetails/vtoolpin.h index 1a3ec3d77..185e773a4 100644 --- a/src/libs/vtools/tools/nodeDetails/vtoolpin.h +++ b/src/libs/vtools/tools/nodeDetails/vtoolpin.h @@ -49,7 +49,7 @@ class VToolPin : public VAbstractNode { Q_OBJECT public: - static VToolPin* Create(QSharedPointer dialog, VAbstractPattern *doc, VContainer *data); + static VToolPin* Create(const QPointer &dialog, VAbstractPattern *doc, VContainer *data); static VToolPin *Create(VToolPinInitData initData); static const QString ToolType; diff --git a/src/libs/vtools/tools/nodeDetails/vtoolplacelabel.cpp b/src/libs/vtools/tools/nodeDetails/vtoolplacelabel.cpp index 653aa7ebb..bbac16b57 100644 --- a/src/libs/vtools/tools/nodeDetails/vtoolplacelabel.cpp +++ b/src/libs/vtools/tools/nodeDetails/vtoolplacelabel.cpp @@ -36,10 +36,10 @@ const QString VToolPlaceLabel::ToolType = QStringLiteral("placeLabel"); //--------------------------------------------------------------------------------------------------------------------- -VToolPlaceLabel *VToolPlaceLabel::Create(QSharedPointer dialog, VAbstractPattern *doc, VContainer *data) +VToolPlaceLabel *VToolPlaceLabel::Create(const QPointer &dialog, VAbstractPattern *doc, VContainer *data) { SCASSERT(not dialog.isNull()); - QSharedPointer dialogTool = dialog.objectCast(); + const QPointer dialogTool = qobject_cast(dialog); SCASSERT(not dialogTool.isNull()) VToolPlaceLabelInitData initData; diff --git a/src/libs/vtools/tools/nodeDetails/vtoolplacelabel.h b/src/libs/vtools/tools/nodeDetails/vtoolplacelabel.h index a06e8d6e9..008867e4e 100644 --- a/src/libs/vtools/tools/nodeDetails/vtoolplacelabel.h +++ b/src/libs/vtools/tools/nodeDetails/vtoolplacelabel.h @@ -59,7 +59,7 @@ class VToolPlaceLabel : public VAbstractNode { Q_OBJECT public: - static VToolPlaceLabel* Create(QSharedPointer dialog, VAbstractPattern *doc, VContainer *data); + static VToolPlaceLabel* Create(const QPointer &dialog, VAbstractPattern *doc, VContainer *data); static VToolPlaceLabel* Create(VToolPlaceLabelInitData &initData); static const QString ToolType; diff --git a/src/libs/vtools/tools/vinteractivetool.cpp b/src/libs/vtools/tools/vinteractivetool.cpp index e0359e0c6..bfa08a831 100644 --- a/src/libs/vtools/tools/vinteractivetool.cpp +++ b/src/libs/vtools/tools/vinteractivetool.cpp @@ -38,7 +38,7 @@ VInteractiveTool::VInteractiveTool(VAbstractPattern *doc, VContainer *data, quin //--------------------------------------------------------------------------------------------------------------------- void VInteractiveTool::DialogLinkDestroy() { - m_dialog.clear(); + m_dialog->deleteLater(); } //--------------------------------------------------------------------------------------------------------------------- @@ -52,7 +52,7 @@ void VInteractiveTool::FullUpdateFromGuiOk(int result) { SaveDialogChange(); } - m_dialog.clear(); + DialogLinkDestroy(); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vtools/tools/vinteractivetool.h b/src/libs/vtools/tools/vinteractivetool.h index 3a7147bf0..eba32efde 100644 --- a/src/libs/vtools/tools/vinteractivetool.h +++ b/src/libs/vtools/tools/vinteractivetool.h @@ -49,7 +49,7 @@ public slots: protected: /** @brief m_dialog tool's dialog options.*/ - QSharedPointer m_dialog; + QPointer m_dialog; /** @brief setDialog set dialog when user want change tool option. */ virtual void setDialog() {/*do nothing by default*/} diff --git a/src/libs/vtools/tools/vtoolseamallowance.cpp b/src/libs/vtools/tools/vtoolseamallowance.cpp index 5f2ee7076..44a583e66 100644 --- a/src/libs/vtools/tools/vtoolseamallowance.cpp +++ b/src/libs/vtools/tools/vtoolseamallowance.cpp @@ -83,11 +83,11 @@ const QString VToolSeamAllowance::AttrTopPin = QStringLiteral("top const QString VToolSeamAllowance::AttrBottomPin = QStringLiteral("bottomPin"); //--------------------------------------------------------------------------------------------------------------------- -VToolSeamAllowance *VToolSeamAllowance::Create(QSharedPointer dialog, VMainGraphicsScene *scene, +VToolSeamAllowance *VToolSeamAllowance::Create(const QPointer &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data) { SCASSERT(not dialog.isNull()); - QSharedPointer dialogTool = dialog.objectCast(); + const QPointer dialogTool = qobject_cast(dialog); SCASSERT(not dialogTool.isNull()) VToolSeamAllowanceInitData initData; @@ -105,7 +105,7 @@ VToolSeamAllowance *VToolSeamAllowance::Create(QSharedPointer dialog if (piece != nullptr) { - piece->m_dialog = dialogTool; + piece->m_dialog = dialog; } return piece; } @@ -152,11 +152,11 @@ VToolSeamAllowance *VToolSeamAllowance::Create(VToolSeamAllowanceInitData &initD } //--------------------------------------------------------------------------------------------------------------------- -VToolSeamAllowance *VToolSeamAllowance::Duplicate(QSharedPointer dialog, VMainGraphicsScene *scene, +VToolSeamAllowance *VToolSeamAllowance::Duplicate(const QPointer &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc) { SCASSERT(not dialog.isNull()); - QSharedPointer dialogTool = dialog.objectCast(); + const QPointer dialogTool = qobject_cast(dialog); SCASSERT(not dialogTool.isNull()) VToolSeamAllowanceInitData initData; @@ -1270,7 +1270,7 @@ void VToolSeamAllowance::keyReleaseEvent(QKeyEvent *event) void VToolSeamAllowance::SetDialog() { SCASSERT(not m_dialog.isNull()); - QSharedPointer dialogTool = m_dialog.objectCast(); + const QPointer dialogTool = qobject_cast(m_dialog); SCASSERT(not dialogTool.isNull()) dialogTool->SetPiece(VAbstractTool::data.GetPiece(m_id)); dialogTool->EnableApply(true); @@ -1465,8 +1465,7 @@ void VToolSeamAllowance::SaveDialogChange(const QString &undoText) //--------------------------------------------------------------------------------------------------------------------- void VToolSeamAllowance::ShowOptions() { - QSharedPointer dialog = - QSharedPointer(new DialogSeamAllowance(getData(), doc, m_id, qApp->getMainWindow())); + QPointer dialog = new DialogSeamAllowance(getData(), doc, m_id, qApp->getMainWindow()); dialog->EnableApply(true); m_dialog = dialog; m_dialog->setModal(true); diff --git a/src/libs/vtools/tools/vtoolseamallowance.h b/src/libs/vtools/tools/vtoolseamallowance.h index 417ee81c0..f582f957f 100644 --- a/src/libs/vtools/tools/vtoolseamallowance.h +++ b/src/libs/vtools/tools/vtoolseamallowance.h @@ -61,10 +61,10 @@ class VToolSeamAllowance : public VInteractiveTool, public QGraphicsPathItem public: virtual ~VToolSeamAllowance() Q_DECL_EQ_DEFAULT; - static VToolSeamAllowance* Create(QSharedPointer dialog, VMainGraphicsScene *scene, + static VToolSeamAllowance* Create(const QPointer &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data); static VToolSeamAllowance* Create(VToolSeamAllowanceInitData &initData); - static VToolSeamAllowance* Duplicate(QSharedPointer dialog, VMainGraphicsScene *scene, + static VToolSeamAllowance* Duplicate(const QPointer &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc); static VToolSeamAllowance* Duplicate(VToolSeamAllowanceInitData &initData); diff --git a/src/libs/vtools/tools/vtooluniondetails.cpp b/src/libs/vtools/tools/vtooluniondetails.cpp index 9d41f196a..131fec99c 100644 --- a/src/libs/vtools/tools/vtooluniondetails.cpp +++ b/src/libs/vtools/tools/vtooluniondetails.cpp @@ -1728,11 +1728,11 @@ void VToolUnionDetails::GroupVisibility(quint32 object, bool visible) * @param doc dom document container. * @param data container with variables. */ -VToolUnionDetails* VToolUnionDetails::Create(QSharedPointer dialog, VMainGraphicsScene *scene, +VToolUnionDetails* VToolUnionDetails::Create(const QPointer &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data) { SCASSERT(not dialog.isNull()) - QSharedPointer dialogTool = dialog.objectCast(); + const QPointer dialogTool = qobject_cast(dialog); SCASSERT(not dialogTool.isNull()) VToolUnionDetailsInitData initData; diff --git a/src/libs/vtools/tools/vtooluniondetails.h b/src/libs/vtools/tools/vtooluniondetails.h index 3415a0c10..01d277ee3 100644 --- a/src/libs/vtools/tools/vtooluniondetails.h +++ b/src/libs/vtools/tools/vtooluniondetails.h @@ -76,7 +76,7 @@ class VToolUnionDetails : public VAbstractTool { Q_OBJECT public: - static VToolUnionDetails *Create(QSharedPointer dialog, VMainGraphicsScene *scene, + static VToolUnionDetails *Create(const QPointer &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data); static VToolUnionDetails *Create(VToolUnionDetailsInitData initData);