From 2864be73424d9a6aedf52685828edd7a30766fac Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Fri, 15 Sep 2017 17:32:23 +0300 Subject: [PATCH] Refactoring to recognize child that called a contex menu. --HG-- branch : feature --- .../flipping/vtoolflippingbyaxis.cpp | 28 ++++++++-------- .../operation/flipping/vtoolflippingbyaxis.h | 3 +- .../flipping/vtoolflippingbyline.cpp | 28 ++++++++-------- .../operation/flipping/vtoolflippingbyline.h | 3 +- .../tools/drawTools/operation/vtoolmove.cpp | 28 ++++++++-------- .../tools/drawTools/operation/vtoolmove.h | 4 +-- .../drawTools/operation/vtoolrotation.cpp | 28 ++++++++-------- .../tools/drawTools/operation/vtoolrotation.h | 4 +-- .../drawTools/toolcurve/vabstractspline.cpp | 6 ++++ .../drawTools/toolcurve/vabstractspline.h | 1 + .../tools/drawTools/toolcurve/vtoolarc.cpp | 8 ++--- .../tools/drawTools/toolcurve/vtoolarc.h | 3 +- .../toolcurve/vtoolarcwithlength.cpp | 4 +-- .../drawTools/toolcurve/vtoolarcwithlength.h | 3 +- .../drawTools/toolcurve/vtoolcubicbezier.cpp | 4 +-- .../drawTools/toolcurve/vtoolcubicbezier.h | 3 +- .../toolcurve/vtoolcubicbezierpath.cpp | 4 +-- .../toolcurve/vtoolcubicbezierpath.h | 3 +- .../toolcurve/vtoolellipticalarc.cpp | 8 ++--- .../drawTools/toolcurve/vtoolellipticalarc.h | 4 +-- .../tools/drawTools/toolcurve/vtoolspline.cpp | 32 ++++++++---------- .../tools/drawTools/toolcurve/vtoolspline.h | 3 +- .../drawTools/toolcurve/vtoolsplinepath.cpp | 32 ++++++++---------- .../drawTools/toolcurve/vtoolsplinepath.h | 3 +- .../tooldoublepoint/vtooldoublepoint.cpp | 2 +- .../tooldoublepoint/vtooltruedarts.cpp | 4 +-- .../tooldoublepoint/vtooltruedarts.h | 3 +- .../toolsinglepoint/toolcut/vtoolcutarc.cpp | 8 ++--- .../toolsinglepoint/toolcut/vtoolcutarc.h | 3 +- .../toolcut/vtoolcutspline.cpp | 8 ++--- .../toolsinglepoint/toolcut/vtoolcutspline.h | 3 +- .../toolcut/vtoolcutsplinepath.cpp | 8 ++--- .../toolcut/vtoolcutsplinepath.h | 3 +- .../toollinepoint/vtoolalongline.cpp | 33 ++++++++----------- .../toollinepoint/vtoolalongline.h | 3 +- .../toollinepoint/vtoolbisector.cpp | 32 ++++++++---------- .../toollinepoint/vtoolbisector.h | 3 +- .../toollinepoint/vtoolcurveintersectaxis.cpp | 4 +-- .../toollinepoint/vtoolcurveintersectaxis.h | 3 +- .../toollinepoint/vtoolendline.cpp | 32 ++++++++---------- .../toollinepoint/vtoolendline.h | 3 +- .../toollinepoint/vtoolheight.cpp | 32 ++++++++---------- .../toollinepoint/vtoolheight.h | 3 +- .../toollinepoint/vtoollineintersectaxis.cpp | 4 +-- .../toollinepoint/vtoollineintersectaxis.h | 3 +- .../toollinepoint/vtoolnormal.cpp | 32 ++++++++---------- .../toollinepoint/vtoolnormal.h | 3 +- .../toollinepoint/vtoolshoulderpoint.cpp | 32 ++++++++---------- .../toollinepoint/vtoolshoulderpoint.h | 3 +- .../toolsinglepoint/vtoolbasepoint.cpp | 10 ++---- .../toolsinglepoint/vtoolbasepoint.h | 3 +- .../toolsinglepoint/vtoollineintersect.cpp | 32 ++++++++---------- .../toolsinglepoint/vtoollineintersect.h | 3 +- .../vtoolpointfromarcandtangent.cpp | 28 ++++++++-------- .../vtoolpointfromarcandtangent.h | 3 +- .../vtoolpointfromcircleandtangent.cpp | 28 ++++++++-------- .../vtoolpointfromcircleandtangent.h | 3 +- .../toolsinglepoint/vtoolpointofcontact.cpp | 32 ++++++++---------- .../toolsinglepoint/vtoolpointofcontact.h | 3 +- .../vtoolpointofintersection.cpp | 32 ++++++++---------- .../vtoolpointofintersection.h | 3 +- .../vtoolpointofintersectionarcs.cpp | 28 ++++++++-------- .../vtoolpointofintersectionarcs.h | 3 +- .../vtoolpointofintersectioncircles.cpp | 28 ++++++++-------- .../vtoolpointofintersectioncircles.h | 3 +- .../vtoolpointofintersectioncurves.cpp | 28 ++++++++-------- .../vtoolpointofintersectioncurves.h | 3 +- .../toolsinglepoint/vtoolsinglepoint.cpp | 2 +- .../toolsinglepoint/vtooltriangle.cpp | 32 ++++++++---------- .../toolpoint/toolsinglepoint/vtooltriangle.h | 3 +- src/libs/vtools/tools/drawTools/vdrawtool.h | 20 ++++++----- src/libs/vtools/tools/drawTools/vtoolline.cpp | 18 ++++++---- src/libs/vtools/tools/drawTools/vtoolline.h | 2 ++ 73 files changed, 419 insertions(+), 445 deletions(-) diff --git a/src/libs/vtools/tools/drawTools/operation/flipping/vtoolflippingbyaxis.cpp b/src/libs/vtools/tools/drawTools/operation/flipping/vtoolflippingbyaxis.cpp index bc8af184f..76365e933 100644 --- a/src/libs/vtools/tools/drawTools/operation/flipping/vtoolflippingbyaxis.cpp +++ b/src/libs/vtools/tools/drawTools/operation/flipping/vtoolflippingbyaxis.cpp @@ -167,6 +167,20 @@ void VToolFlippingByAxis::ShowVisualization(bool show) ShowToolVisualization(show); } +//--------------------------------------------------------------------------------------------------------------------- +void VToolFlippingByAxis::ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id) +{ + try + { + ContextMenu(event, id); + } + catch(const VExceptionToolWasDeleted &e) + { + Q_UNUSED(e) + return;//Leave this method immediately!!! + } +} + //--------------------------------------------------------------------------------------------------------------------- void VToolFlippingByAxis::SetVisualization() { @@ -215,20 +229,6 @@ void VToolFlippingByAxis::SaveOptions(QDomElement &tag, QSharedPointer SaveSourceDestination(tag); } -//--------------------------------------------------------------------------------------------------------------------- -void VToolFlippingByAxis::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) -{ - try - { - ContextMenu(this, event); - } - catch(const VExceptionToolWasDeleted &e) - { - Q_UNUSED(e) - return;//Leave this method immediately!!! - } -} - //--------------------------------------------------------------------------------------------------------------------- VToolFlippingByAxis::VToolFlippingByAxis(VAbstractPattern *doc, VContainer *data, quint32 id, quint32 originPointId, AxisType axisType, const QString &suffix, diff --git a/src/libs/vtools/tools/drawTools/operation/flipping/vtoolflippingbyaxis.h b/src/libs/vtools/tools/drawTools/operation/flipping/vtoolflippingbyaxis.h index 575d6ec6d..85cf1a92d 100644 --- a/src/libs/vtools/tools/drawTools/operation/flipping/vtoolflippingbyaxis.h +++ b/src/libs/vtools/tools/drawTools/operation/flipping/vtoolflippingbyaxis.h @@ -58,12 +58,13 @@ public: QString OriginPointName() const; virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE; +protected slots: + virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE; protected: virtual void SetVisualization() Q_DECL_OVERRIDE; virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE; virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE; virtual void SaveOptions(QDomElement &tag, QSharedPointer &obj) Q_DECL_OVERRIDE; - virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ) Q_DECL_OVERRIDE; private: Q_DISABLE_COPY(VToolFlippingByAxis) diff --git a/src/libs/vtools/tools/drawTools/operation/flipping/vtoolflippingbyline.cpp b/src/libs/vtools/tools/drawTools/operation/flipping/vtoolflippingbyline.cpp index 1fe000a41..6ff449632 100644 --- a/src/libs/vtools/tools/drawTools/operation/flipping/vtoolflippingbyline.cpp +++ b/src/libs/vtools/tools/drawTools/operation/flipping/vtoolflippingbyline.cpp @@ -153,6 +153,20 @@ void VToolFlippingByLine::ShowVisualization(bool show) ShowToolVisualization(show); } +//--------------------------------------------------------------------------------------------------------------------- +void VToolFlippingByLine::ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id) +{ + try + { + ContextMenu(event, id); + } + catch(const VExceptionToolWasDeleted &e) + { + Q_UNUSED(e) + return;//Leave this method immediately!!! + } +} + //--------------------------------------------------------------------------------------------------------------------- void VToolFlippingByLine::SetVisualization() { @@ -201,20 +215,6 @@ void VToolFlippingByLine::SaveOptions(QDomElement &tag, QSharedPointer SaveSourceDestination(tag); } -//--------------------------------------------------------------------------------------------------------------------- -void VToolFlippingByLine::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) -{ - try - { - ContextMenu(this, event); - } - catch(const VExceptionToolWasDeleted &e) - { - Q_UNUSED(e) - return;//Leave this method immediately!!! - } -} - //--------------------------------------------------------------------------------------------------------------------- VToolFlippingByLine::VToolFlippingByLine(VAbstractPattern *doc, VContainer *data, quint32 id, quint32 firstLinePointId, quint32 secondLinePointId, const QString &suffix, diff --git a/src/libs/vtools/tools/drawTools/operation/flipping/vtoolflippingbyline.h b/src/libs/vtools/tools/drawTools/operation/flipping/vtoolflippingbyline.h index a3099642a..3efd5a593 100644 --- a/src/libs/vtools/tools/drawTools/operation/flipping/vtoolflippingbyline.h +++ b/src/libs/vtools/tools/drawTools/operation/flipping/vtoolflippingbyline.h @@ -56,12 +56,13 @@ public: QString SecondLinePointName() const; virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE; +protected slots: + virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE; protected: virtual void SetVisualization() Q_DECL_OVERRIDE; virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE; virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE; virtual void SaveOptions(QDomElement &tag, QSharedPointer &obj) Q_DECL_OVERRIDE; - virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ) Q_DECL_OVERRIDE; private: Q_DISABLE_COPY(VToolFlippingByLine) diff --git a/src/libs/vtools/tools/drawTools/operation/vtoolmove.cpp b/src/libs/vtools/tools/drawTools/operation/vtoolmove.cpp index a789105ea..148c265d8 100644 --- a/src/libs/vtools/tools/drawTools/operation/vtoolmove.cpp +++ b/src/libs/vtools/tools/drawTools/operation/vtoolmove.cpp @@ -284,6 +284,20 @@ void VToolMove::ShowVisualization(bool show) ShowToolVisualization(show); } +//--------------------------------------------------------------------------------------------------------------------- +void VToolMove::ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id) +{ + try + { + ContextMenu(event, id); + } + catch(const VExceptionToolWasDeleted &e) + { + Q_UNUSED(e) + return;//Leave this method immediately!!! + } +} + //--------------------------------------------------------------------------------------------------------------------- void VToolMove::SetVisualization() { @@ -333,20 +347,6 @@ void VToolMove::SaveOptions(QDomElement &tag, QSharedPointer &obj) SaveSourceDestination(tag); } -//--------------------------------------------------------------------------------------------------------------------- -void VToolMove::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) -{ - try - { - ContextMenu(this, event); - } - catch(const VExceptionToolWasDeleted &e) - { - Q_UNUSED(e) - return;//Leave this method immediately!!! - } -} - //--------------------------------------------------------------------------------------------------------------------- VToolMove::VToolMove(VAbstractPattern *doc, VContainer *data, quint32 id, const QString &formulaAngle, const QString &formulaLength, const QString &suffix, diff --git a/src/libs/vtools/tools/drawTools/operation/vtoolmove.h b/src/libs/vtools/tools/drawTools/operation/vtoolmove.h index 15ca1e1b1..1426936e1 100644 --- a/src/libs/vtools/tools/drawTools/operation/vtoolmove.h +++ b/src/libs/vtools/tools/drawTools/operation/vtoolmove.h @@ -70,13 +70,13 @@ public: void SetFormulaLength(const VFormula &value); virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE; - +protected slots: + virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE; protected: virtual void SetVisualization() Q_DECL_OVERRIDE; virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE; virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE; virtual void SaveOptions(QDomElement &tag, QSharedPointer &obj) Q_DECL_OVERRIDE; - virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ) Q_DECL_OVERRIDE; private: Q_DISABLE_COPY(VToolMove) diff --git a/src/libs/vtools/tools/drawTools/operation/vtoolrotation.cpp b/src/libs/vtools/tools/drawTools/operation/vtoolrotation.cpp index f7f083124..be8d27c6a 100644 --- a/src/libs/vtools/tools/drawTools/operation/vtoolrotation.cpp +++ b/src/libs/vtools/tools/drawTools/operation/vtoolrotation.cpp @@ -285,6 +285,20 @@ void VToolRotation::ShowVisualization(bool show) ShowToolVisualization(show); } +//--------------------------------------------------------------------------------------------------------------------- +void VToolRotation::ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id) +{ + try + { + ContextMenu(event, id); + } + catch(const VExceptionToolWasDeleted &e) + { + Q_UNUSED(e) + return;//Leave this method immediately!!! + } +} + //--------------------------------------------------------------------------------------------------------------------- void VToolRotation::SetVisualization() { @@ -333,20 +347,6 @@ void VToolRotation::SaveOptions(QDomElement &tag, QSharedPointer &obj) SaveSourceDestination(tag); } -//--------------------------------------------------------------------------------------------------------------------- -void VToolRotation::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) -{ - try - { - ContextMenu(this, event); - } - catch(const VExceptionToolWasDeleted &e) - { - Q_UNUSED(e) - return;//Leave this method immediately!!! - } -} - //--------------------------------------------------------------------------------------------------------------------- DestinationItem VToolRotation::CreatePoint(quint32 idTool, quint32 idItem, const QPointF &origin, qreal angle, const QString &suffix, VContainer *data) diff --git a/src/libs/vtools/tools/drawTools/operation/vtoolrotation.h b/src/libs/vtools/tools/drawTools/operation/vtoolrotation.h index e943c6551..2292eab98 100644 --- a/src/libs/vtools/tools/drawTools/operation/vtoolrotation.h +++ b/src/libs/vtools/tools/drawTools/operation/vtoolrotation.h @@ -69,13 +69,13 @@ public: void SetFormulaAngle(const VFormula &value); virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE; - +protected slots: + virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE; protected: virtual void SetVisualization() Q_DECL_OVERRIDE; virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE; virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE; virtual void SaveOptions(QDomElement &tag, QSharedPointer &obj) Q_DECL_OVERRIDE; - virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ) Q_DECL_OVERRIDE; private: Q_DISABLE_COPY(VToolRotation) diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vabstractspline.cpp b/src/libs/vtools/tools/drawTools/toolcurve/vabstractspline.cpp index 64704663f..d3f533caf 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vabstractspline.cpp +++ b/src/libs/vtools/tools/drawTools/toolcurve/vabstractspline.cpp @@ -315,6 +315,12 @@ void VAbstractSpline::RefreshCtrlPoints() // do nothing } +//--------------------------------------------------------------------------------------------------------------------- +void VAbstractSpline::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) +{ + ShowContextMenu(event); +} + //--------------------------------------------------------------------------------------------------------------------- VSpline VAbstractSpline::CorrectedSpline(const VSpline &spline, const SplinePointPosition &position, const QPointF &pos) const diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vabstractspline.h b/src/libs/vtools/tools/drawTools/toolcurve/vabstractspline.h index 2e67893ea..dc9e4bc83 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vabstractspline.h +++ b/src/libs/vtools/tools/drawTools/toolcurve/vabstractspline.h @@ -112,6 +112,7 @@ protected: virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE; virtual void SaveOptions(QDomElement &tag, QSharedPointer &obj) Q_DECL_OVERRIDE; virtual void RefreshCtrlPoints(); + virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ) Q_DECL_OVERRIDE; VSpline CorrectedSpline(const VSpline &spline, const SplinePointPosition &position, const QPointF &pos) const; diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolarc.cpp b/src/libs/vtools/tools/drawTools/toolcurve/vtoolarc.cpp index 0a27ac1e9..a42cfb74b 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolarc.cpp +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolarc.cpp @@ -310,15 +310,11 @@ void VToolArc::ShowVisualization(bool show) } //--------------------------------------------------------------------------------------------------------------------- -/** - * @brief contextMenuEvent handle context menu events. - * @param event context menu event. - */ -void VToolArc::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) +void VToolArc::ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id) { try { - ContextMenu(this, event); + ContextMenu(event, id); } catch(const VExceptionToolWasDeleted &e) { diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolarc.h b/src/libs/vtools/tools/drawTools/toolcurve/vtoolarc.h index abcd2c50e..2e0ae4c04 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolarc.h +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolarc.h @@ -77,8 +77,9 @@ public: void SetFormulaF2(const VFormula &value); virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE; +protected slots: + virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE; protected: - virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ) Q_DECL_OVERRIDE; virtual void RemoveReferens() Q_DECL_OVERRIDE; virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE; virtual void SaveOptions(QDomElement &tag, QSharedPointer &obj) Q_DECL_OVERRIDE; diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolarcwithlength.cpp b/src/libs/vtools/tools/drawTools/toolcurve/vtoolarcwithlength.cpp index 6bf095412..b3c4e3acf 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolarcwithlength.cpp +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolarcwithlength.cpp @@ -276,11 +276,11 @@ void VToolArcWithLength::ShowVisualization(bool show) } //--------------------------------------------------------------------------------------------------------------------- -void VToolArcWithLength::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) +void VToolArcWithLength::ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id) { try { - ContextMenu(this, event); + ContextMenu(event, id); } catch(const VExceptionToolWasDeleted &e) { diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolarcwithlength.h b/src/libs/vtools/tools/drawTools/toolcurve/vtoolarcwithlength.h index ba0a1d6c2..fe1f70857 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolarcwithlength.h +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolarcwithlength.h @@ -75,8 +75,9 @@ public: void SetFormulaLength(const VFormula &value); virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE; +protected slots: + virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE; protected: - virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ) Q_DECL_OVERRIDE; virtual void RemoveReferens() Q_DECL_OVERRIDE; virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE; virtual void SaveOptions(QDomElement &tag, QSharedPointer &obj) Q_DECL_OVERRIDE; diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezier.cpp b/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezier.cpp index 25a07b436..3fefdd047 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezier.cpp +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezier.cpp @@ -189,11 +189,11 @@ void VToolCubicBezier::ShowVisualization(bool show) } //--------------------------------------------------------------------------------------------------------------------- -void VToolCubicBezier::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) +void VToolCubicBezier::ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id) { try { - ContextMenu(this, event); + ContextMenu(event, id); } catch(const VExceptionToolWasDeleted &e) { diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezier.h b/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezier.h index 7abeaf983..8f3750f66 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezier.h +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezier.h @@ -67,8 +67,9 @@ public: void setSpline(const VCubicBezier &spl); virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE; +protected slots: + virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE; protected: - virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ) Q_DECL_OVERRIDE; virtual void RemoveReferens() Q_DECL_OVERRIDE; virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE; virtual void SaveOptions(QDomElement &tag, QSharedPointer &obj) Q_DECL_OVERRIDE; diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezierpath.cpp b/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezierpath.cpp index 638e8a1e4..5d7376d58 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezierpath.cpp +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezierpath.cpp @@ -173,11 +173,11 @@ void VToolCubicBezierPath::ShowVisualization(bool show) } //--------------------------------------------------------------------------------------------------------------------- -void VToolCubicBezierPath::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) +void VToolCubicBezierPath::ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id) { try { - ContextMenu(this, event); + ContextMenu(event, id); } catch(const VExceptionToolWasDeleted &e) { diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezierpath.h b/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezierpath.h index 1537b616f..77ced21be 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezierpath.h +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezierpath.h @@ -64,8 +64,9 @@ public: void setSplinePath(const VCubicBezierPath &splPath); virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE; +protected slots: + virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE; protected: - virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ) Q_DECL_OVERRIDE; virtual void RemoveReferens() Q_DECL_OVERRIDE; virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE; virtual void SaveOptions(QDomElement &tag, QSharedPointer &obj) Q_DECL_OVERRIDE; diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolellipticalarc.cpp b/src/libs/vtools/tools/drawTools/toolcurve/vtoolellipticalarc.cpp index 6a5fd9c64..b8af92abc 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolellipticalarc.cpp +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolellipticalarc.cpp @@ -376,15 +376,11 @@ void VToolEllipticalArc::ShowVisualization(bool show) } //--------------------------------------------------------------------------------------------------------------------- -/** - * @brief contextMenuEvent handle context menu events. - * @param event context menu event. - */ -void VToolEllipticalArc::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) +void VToolEllipticalArc::ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id) { try { - ContextMenu(this, event); + ContextMenu(event, id); } catch(const VExceptionToolWasDeleted &e) { diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolellipticalarc.h b/src/libs/vtools/tools/drawTools/toolcurve/vtoolellipticalarc.h index d8b040df4..4802c9643 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolellipticalarc.h +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolellipticalarc.h @@ -84,9 +84,9 @@ public: void SetFormulaRotationAngle(const VFormula &value); virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE; - +protected slots: + virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE; protected: - virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ) Q_DECL_OVERRIDE; virtual void RemoveReferens() Q_DECL_OVERRIDE; virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE; virtual void SaveOptions(QDomElement &tag, QSharedPointer &obj) Q_DECL_OVERRIDE; diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolspline.cpp b/src/libs/vtools/tools/drawTools/toolcurve/vtoolspline.cpp index 60349dc2c..b855a09a0 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolspline.cpp +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolspline.cpp @@ -286,24 +286,6 @@ void VToolSpline::EnableToolMove(bool move) this->setFlag(QGraphicsItem::ItemIsMovable, move); } -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief contextMenuEvent handle context menu events. - * @param event context menu event. - */ -void VToolSpline::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) -{ - try - { - ContextMenu(this, event); - } - catch(const VExceptionToolWasDeleted &e) - { - Q_UNUSED(e) - return;//Leave this method immediately!!! - } -} - //--------------------------------------------------------------------------------------------------------------------- /** * @brief RemoveReferens decrement value of reference. @@ -566,6 +548,20 @@ void VToolSpline::RefreshCtrlPoints() } } +//--------------------------------------------------------------------------------------------------------------------- +void VToolSpline::ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id) +{ + try + { + ContextMenu(event, id); + } + catch(const VExceptionToolWasDeleted &e) + { + Q_UNUSED(e) + return;//Leave this method immediately!!! + } +} + //--------------------------------------------------------------------------------------------------------------------- void VToolSpline::SetSplineAttributes(QDomElement &domElement, const VSpline &spl) { diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolspline.h b/src/libs/vtools/tools/drawTools/toolcurve/vtoolspline.h index ed7f09faf..cddeaab28 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolspline.h +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolspline.h @@ -75,8 +75,9 @@ public slots: void ControlPointChangePosition (const qint32 &indexSpline, const SplinePointPosition &position, const QPointF &pos); virtual void EnableToolMove(bool move) Q_DECL_OVERRIDE; +protected slots: + virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE; protected: - virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ) Q_DECL_OVERRIDE; virtual void RemoveReferens() Q_DECL_OVERRIDE; virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE; virtual void SaveOptions(QDomElement &tag, QSharedPointer &obj) Q_DECL_OVERRIDE; diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolsplinepath.cpp b/src/libs/vtools/tools/drawTools/toolcurve/vtoolsplinepath.cpp index 2968e8a44..983c05d60 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolsplinepath.cpp +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolsplinepath.cpp @@ -281,6 +281,20 @@ void VToolSplinePath::EnableToolMove(bool move) this->setFlag(QGraphicsItem::ItemIsMovable, move); } +//--------------------------------------------------------------------------------------------------------------------- +void VToolSplinePath::ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id) +{ + try + { + ContextMenu(event, id); + } + catch(const VExceptionToolWasDeleted &e) + { + Q_UNUSED(e) + return;//Leave this method immediately!!! + } +} + //--------------------------------------------------------------------------------------------------------------------- /** * @brief UpdateControlPoints update position points control points in file. @@ -364,24 +378,6 @@ void VToolSplinePath::ShowVisualization(bool show) ShowToolVisualization(show); } -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief contextMenuEvent handle context menu events. - * @param event context menu event. - */ -void VToolSplinePath::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) -{ - try - { - ContextMenu(this, event); - } - catch(const VExceptionToolWasDeleted &e) - { - Q_UNUSED(e) - return;//Leave this method immediately!!! - } -} - //--------------------------------------------------------------------------------------------------------------------- /** * @brief AddPathPoint write path point to pattern file. diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolsplinepath.h b/src/libs/vtools/tools/drawTools/toolcurve/vtoolsplinepath.h index 0866b249b..c6cba6075 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolsplinepath.h +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolsplinepath.h @@ -90,8 +90,9 @@ public slots: void ControlPointChangePosition(const qint32 &indexSpline, const SplinePointPosition &position, const QPointF &pos); virtual void EnableToolMove(bool move) Q_DECL_OVERRIDE; +protected slots: + virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE; protected: - virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ) Q_DECL_OVERRIDE; virtual void RemoveReferens() Q_DECL_OVERRIDE; virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE; virtual void SaveOptions(QDomElement &tag, QSharedPointer &obj) Q_DECL_OVERRIDE; diff --git a/src/libs/vtools/tools/drawTools/toolpoint/tooldoublepoint/vtooldoublepoint.cpp b/src/libs/vtools/tools/drawTools/toolpoint/tooldoublepoint/vtooldoublepoint.cpp index 23821aa24..fd28c852d 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/tooldoublepoint/vtooldoublepoint.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/tooldoublepoint/vtooldoublepoint.cpp @@ -312,7 +312,7 @@ void VToolDoublePoint::keyReleaseEvent(QKeyEvent *event) //--------------------------------------------------------------------------------------------------------------------- void VToolDoublePoint::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) { - Q_UNUSED(event) + ShowContextMenu(event); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vtools/tools/drawTools/toolpoint/tooldoublepoint/vtooltruedarts.cpp b/src/libs/vtools/tools/drawTools/toolpoint/tooldoublepoint/vtooltruedarts.cpp index 45c93bb91..a8538bd24 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/tooldoublepoint/vtooltruedarts.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/tooldoublepoint/vtooltruedarts.cpp @@ -334,11 +334,11 @@ void VToolTrueDarts::SetDartP3Id(const quint32 &value) } //--------------------------------------------------------------------------------------------------------------------- -void VToolTrueDarts::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) +void VToolTrueDarts::ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id) { try { - ContextMenu(this, event); + ContextMenu(event, id); } catch(const VExceptionToolWasDeleted &e) { diff --git a/src/libs/vtools/tools/drawTools/toolpoint/tooldoublepoint/vtooltruedarts.h b/src/libs/vtools/tools/drawTools/toolpoint/tooldoublepoint/vtooltruedarts.h index 4571093cd..ab993334a 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/tooldoublepoint/vtooltruedarts.h +++ b/src/libs/vtools/tools/drawTools/toolpoint/tooldoublepoint/vtooltruedarts.h @@ -91,8 +91,9 @@ public: quint32 GetDartP3Id() const; void SetDartP3Id(const quint32 &value); +protected slots: + virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE; protected: - virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ) Q_DECL_OVERRIDE; virtual void RemoveReferens() Q_DECL_OVERRIDE; virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE; virtual void SaveOptions(QDomElement &tag, QSharedPointer &obj) Q_DECL_OVERRIDE; 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 0e6ce4490..1e7095e59 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutarc.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutarc.cpp @@ -188,15 +188,11 @@ void VToolCutArc::ShowVisualization(bool show) } //--------------------------------------------------------------------------------------------------------------------- -/** - * @brief contextMenuEvent handle context menu events. - * @param event context menu event. - */ -void VToolCutArc::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) +void VToolCutArc::ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id) { try { - ContextMenu(this, event); + ContextMenu(event, id); } catch(const VExceptionToolWasDeleted &e) { 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 0aba3a311..df46da7de 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutarc.h +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutarc.h @@ -61,8 +61,9 @@ public: virtual int type() const Q_DECL_OVERRIDE {return Type;} enum { Type = UserType + static_cast(Tool::CutArc)}; virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE; +protected slots: + virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE; protected: - virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ) Q_DECL_OVERRIDE; virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE; virtual void SaveOptions(QDomElement &tag, QSharedPointer &obj) Q_DECL_OVERRIDE; virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE; 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 23d971ba9..3f714c0d9 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.cpp @@ -188,15 +188,11 @@ void VToolCutSpline::ShowVisualization(bool show) } //--------------------------------------------------------------------------------------------------------------------- -/** - * @brief contextMenuEvent handle context menu events. - * @param event context menu event. - */ -void VToolCutSpline::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) +void VToolCutSpline::ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id) { try { - ContextMenu(this, event); + ContextMenu(event, id); } catch(const VExceptionToolWasDeleted &e) { 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 51bab816c..d849c2db0 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.h +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.h @@ -63,8 +63,9 @@ public: virtual int type() const Q_DECL_OVERRIDE {return Type;} enum { Type = UserType + static_cast(Tool::CutSpline)}; virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE; +protected slots: + virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE; protected: - virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ) Q_DECL_OVERRIDE; virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE; virtual void SaveOptions(QDomElement &tag, QSharedPointer &obj) Q_DECL_OVERRIDE; virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE; 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 fdc9009b5..7cbc98ee5 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.cpp @@ -275,15 +275,11 @@ VPointF *VToolCutSplinePath::CutSplinePath(qreal length, const QSharedPointer(this, event); + ContextMenu(event, id); } catch(const VExceptionToolWasDeleted &e) { 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 080352bbd..a5b815ae7 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.h +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.h @@ -69,8 +69,9 @@ public: const QSharedPointer &splPath, const QString &pName, VSplinePath **splPath1, VSplinePath **splPath2); +protected slots: + virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE; protected: - virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ) Q_DECL_OVERRIDE; virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE; virtual void SaveOptions(QDomElement &tag, QSharedPointer &obj) Q_DECL_OVERRIDE; virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE; 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 9777303c2..65d01e47c 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolalongline.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolalongline.cpp @@ -80,25 +80,6 @@ VToolAlongLine::VToolAlongLine(VAbstractPattern *doc, VContainer *data, quint32 ToolCreation(typeCreation); } -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief contextMenuEvent handle context menu events. handle context menu event. - * @param event context menu event. - */ -//cppcheck-suppress unusedFunction -void VToolAlongLine::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) -{ - try - { - ContextMenu(this, event); - } - catch(const VExceptionToolWasDeleted &e) - { - Q_UNUSED(e) - return;//Leave this method immediately!!! - } -} - //--------------------------------------------------------------------------------------------------------------------- /** * @brief RemoveReferens decrement value of reference. @@ -214,6 +195,20 @@ void VToolAlongLine::ShowVisualization(bool show) ShowToolVisualization(show); } +//--------------------------------------------------------------------------------------------------------------------- +void VToolAlongLine::ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id) +{ + try + { + ContextMenu(event, id); + } + catch(const VExceptionToolWasDeleted &e) + { + Q_UNUSED(e) + return;//Leave this method immediately!!! + } +} + //--------------------------------------------------------------------------------------------------------------------- /** * @brief setDialog set dialog when user want change tool option. 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 434192e68..dc873e96a 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolalongline.h +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolalongline.h @@ -68,8 +68,9 @@ public: quint32 GetSecondPointId() const; void SetSecondPointId(const quint32 &value); virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE; +protected slots: + virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE; protected: - virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ) Q_DECL_OVERRIDE; virtual void RemoveReferens() Q_DECL_OVERRIDE; virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE; virtual void SaveOptions(QDomElement &tag, QSharedPointer &obj) Q_DECL_OVERRIDE; 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 db8242cf6..de414c60b 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolbisector.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolbisector.cpp @@ -241,24 +241,6 @@ QString VToolBisector::ThirdPointName() const return VAbstractTool::data.GetGObject(thirdPointId)->name(); } -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief contextMenuEvent handle context menu events. - * @param event context menu event. - */ -void VToolBisector::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) -{ - try - { - ContextMenu(this, event); - } - catch(const VExceptionToolWasDeleted &e) - { - Q_UNUSED(e) - return;//Leave this method immediately!!! - } -} - //--------------------------------------------------------------------------------------------------------------------- /** * @brief RemoveReferens decrement value of reference. @@ -355,6 +337,20 @@ void VToolBisector::ShowVisualization(bool show) ShowToolVisualization(show); } +//--------------------------------------------------------------------------------------------------------------------- +void VToolBisector::ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id) +{ + try + { + ContextMenu(event, id); + } + catch(const VExceptionToolWasDeleted &e) + { + Q_UNUSED(e) + return;//Leave this method immediately!!! + } +} + //--------------------------------------------------------------------------------------------------------------------- quint32 VToolBisector::GetFirstPointId() const { 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 3a413775e..185ce7940 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolbisector.h +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolbisector.h @@ -77,8 +77,9 @@ public: void SetThirdPointId(const quint32 &value); virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE; +protected slots: + virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE; protected: - virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ) Q_DECL_OVERRIDE; virtual void RemoveReferens() Q_DECL_OVERRIDE; virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE; virtual void SaveOptions(QDomElement &tag, QSharedPointer &obj) Q_DECL_OVERRIDE; 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 05831cc3a..dac92aed2 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolcurveintersectaxis.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolcurveintersectaxis.cpp @@ -262,11 +262,11 @@ void VToolCurveIntersectAxis::ShowVisualization(bool show) } //--------------------------------------------------------------------------------------------------------------------- -void VToolCurveIntersectAxis::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) +void VToolCurveIntersectAxis::ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id) { try { - ContextMenu(this, event); + ContextMenu(event, id); } catch(const VExceptionToolWasDeleted &e) { 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 baf01e7d8..e5ca57bf9 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolcurveintersectaxis.h +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolcurveintersectaxis.h @@ -76,8 +76,9 @@ public: void setCurveId(const quint32 &value); virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE; +protected slots: + virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE; protected: - virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ) Q_DECL_OVERRIDE; virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE; virtual void SaveOptions(QDomElement &tag, QSharedPointer &obj) Q_DECL_OVERRIDE; virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE; 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 b34845f5a..d5cc465d9 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolendline.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolendline.cpp @@ -189,24 +189,6 @@ VToolEndLine* VToolEndLine::Create(const quint32 _id, const QString &pointName, return nullptr; } -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief contextMenuEvent handle context menu events. - * @param event context menu event. - */ -void VToolEndLine::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) -{ - try - { - ContextMenu(this, event); - } - catch(const VExceptionToolWasDeleted &e) - { - Q_UNUSED(e) - return;//Leave this method immediately!!! - } -} - //--------------------------------------------------------------------------------------------------------------------- /** * @brief SaveDialog save options into file after change in dialog. @@ -288,3 +270,17 @@ void VToolEndLine::ShowVisualization(bool show) { ShowToolVisualization(show); } + +//--------------------------------------------------------------------------------------------------------------------- +void VToolEndLine::ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id) +{ + try + { + ContextMenu(event, id); + } + catch(const VExceptionToolWasDeleted &e) + { + Q_UNUSED(e) + return;//Leave this method immediately!!! + } +} 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 10cf8e750..5c234b382 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolendline.h +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolendline.h @@ -68,8 +68,9 @@ public: VFormula GetFormulaAngle() const; void SetFormulaAngle(const VFormula &value); virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE; +protected slots: + virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE; protected: - virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ) Q_DECL_OVERRIDE; virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE; virtual void SaveOptions(QDomElement &tag, QSharedPointer &obj) Q_DECL_OVERRIDE; virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE; 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 169940ea7..effa4c4ff 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolheight.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolheight.cpp @@ -213,24 +213,6 @@ QString VToolHeight::SecondLinePointName() const return VAbstractTool::data.GetGObject(p2LineId)->name(); } -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief contextMenuEvent handle context menu events. - * @param event context menu event. - */ -void VToolHeight::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) -{ - try - { - ContextMenu(this, event); - } - catch(const VExceptionToolWasDeleted &e) - { - Q_UNUSED(e) - return;//Leave this method immediately!!! - } -} - //--------------------------------------------------------------------------------------------------------------------- /** * @brief SaveDialog save options into file after change in dialog. @@ -339,6 +321,20 @@ void VToolHeight::ShowVisualization(bool show) ShowToolVisualization(show); } +//--------------------------------------------------------------------------------------------------------------------- +void VToolHeight::ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id) +{ + try + { + ContextMenu(event, id); + } + catch(const VExceptionToolWasDeleted &e) + { + Q_UNUSED(e) + return;//Leave this method immediately!!! + } +} + //--------------------------------------------------------------------------------------------------------------------- quint32 VToolHeight::GetP1LineId() const { 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 a3b5de6d7..c22e50215 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolheight.h +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolheight.h @@ -75,8 +75,9 @@ public: void SetP2LineId(const quint32 &value); virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE; +protected slots: + virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE; protected: - virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ) Q_DECL_OVERRIDE; virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE; virtual void SaveOptions(QDomElement &tag, QSharedPointer &obj) Q_DECL_OVERRIDE; virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE; 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 4cbec8946..ea8351368 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollineintersectaxis.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollineintersectaxis.cpp @@ -264,11 +264,11 @@ void VToolLineIntersectAxis::ShowVisualization(bool show) } //--------------------------------------------------------------------------------------------------------------------- -void VToolLineIntersectAxis::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) +void VToolLineIntersectAxis::ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id) { try { - ContextMenu(this, event); + ContextMenu(event, id); } catch(const VExceptionToolWasDeleted &e) { 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 67821e646..6547c1f42 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollineintersectaxis.h +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollineintersectaxis.h @@ -81,8 +81,9 @@ public: void SetSecondPointId(const quint32 &value); virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE; +protected slots: + virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE; protected: - virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ) Q_DECL_OVERRIDE; virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE; virtual void SaveOptions(QDomElement &tag, QSharedPointer &obj) Q_DECL_OVERRIDE; virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE; 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 cefc4d031..bb901a15e 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolnormal.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolnormal.cpp @@ -217,24 +217,6 @@ QString VToolNormal::SecondPointName() const return VAbstractTool::data.GetGObject(secondPointId)->name(); } -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief contextMenuEvent handle context menu events. - * @param event context menu event. - */ -void VToolNormal::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) -{ - try - { - ContextMenu(this, event); - } - catch(const VExceptionToolWasDeleted &e) - { - Q_UNUSED(e) - return;//Leave this method immediately!!! - } -} - //--------------------------------------------------------------------------------------------------------------------- /** * @brief RemoveReferens decrement value of reference. @@ -327,3 +309,17 @@ void VToolNormal::ShowVisualization(bool show) { ShowToolVisualization(show); } + +//--------------------------------------------------------------------------------------------------------------------- +void VToolNormal::ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id) +{ + try + { + ContextMenu(event, id); + } + catch(const VExceptionToolWasDeleted &e) + { + Q_UNUSED(e) + return;//Leave this method immediately!!! + } +} 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 3218bad9f..a02d8e0b8 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolnormal.h +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolnormal.h @@ -72,8 +72,9 @@ public: void SetSecondPointId(const quint32 &value); virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE; +protected slots: + virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE; protected: - virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ) Q_DECL_OVERRIDE; virtual void RemoveReferens() Q_DECL_OVERRIDE; virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE; virtual void SaveOptions(QDomElement &tag, QSharedPointer &obj) Q_DECL_OVERRIDE; 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 7a9e3db4d..6c798f71c 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolshoulderpoint.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolshoulderpoint.cpp @@ -259,24 +259,6 @@ QString VToolShoulderPoint::ShoulderPointName() const return VAbstractTool::data.GetGObject(pShoulder)->name(); } -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief contextMenuEvent handle context menu events. - * @param event context menu event. - */ -void VToolShoulderPoint::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) -{ - try - { - ContextMenu(this, event); - } - catch(const VExceptionToolWasDeleted &e) - { - Q_UNUSED(e) - return;//Leave this method immediately!!! - } -} - //--------------------------------------------------------------------------------------------------------------------- /** * @brief RemoveReferens decrement value of reference. @@ -374,6 +356,20 @@ QString VToolShoulderPoint::MakeToolTip() const return toolTip; } +//--------------------------------------------------------------------------------------------------------------------- +void VToolShoulderPoint::ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id) +{ + try + { + ContextMenu(event, id); + } + catch(const VExceptionToolWasDeleted &e) + { + Q_UNUSED(e) + return;//Leave this method immediately!!! + } +} + //--------------------------------------------------------------------------------------------------------------------- // cppcheck-suppress unusedFunction quint32 VToolShoulderPoint::getPShoulder() const 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 bb20162ca..18ae1c0c9 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolshoulderpoint.h +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolshoulderpoint.h @@ -78,13 +78,14 @@ public: virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE; protected: - virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ) Q_DECL_OVERRIDE; virtual void RemoveReferens() Q_DECL_OVERRIDE; virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE; virtual void SaveOptions(QDomElement &tag, QSharedPointer &obj) Q_DECL_OVERRIDE; virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE; virtual void SetVisualization() Q_DECL_OVERRIDE; virtual QString MakeToolTip() const Q_DECL_OVERRIDE; +private slots: + virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE; private: Q_DISABLE_COPY(VToolShoulderPoint) diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolbasepoint.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolbasepoint.cpp index 7070218a6..587e82d01 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolbasepoint.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolbasepoint.cpp @@ -371,11 +371,7 @@ void VToolBasePoint::ReadToolAttributes(const QDomElement &domElement) } //--------------------------------------------------------------------------------------------------------------------- -/** - * @brief contextMenuEvent handle context menu events. - * @param event context menu event. - */ -void VToolBasePoint::contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ) +void VToolBasePoint::ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id) { qCDebug(vTool, "Context menu base point"); #ifndef QT_NO_CURSOR @@ -388,12 +384,12 @@ void VToolBasePoint::contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ) if (doc->CountPP() > 1) { qCDebug(vTool, "PP count > 1"); - ContextMenu(this, event, RemoveOption::Enable, Referens::Ignore); + ContextMenu(event, id, RemoveOption::Enable, Referens::Ignore); } else { qCDebug(vTool, "PP count = 1"); - ContextMenu(this, event, RemoveOption::Disable); + ContextMenu(event, id, RemoveOption::Disable); } } catch(const VExceptionToolWasDeleted &e) diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolbasepoint.h b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolbasepoint.h index c41fd8dce..47f7cc351 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolbasepoint.h +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolbasepoint.h @@ -75,7 +75,6 @@ signals: */ void LiteUpdateTree(); protected: - virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ) Q_DECL_OVERRIDE; virtual void AddToFile() Q_DECL_OVERRIDE; virtual QVariant itemChange ( GraphicsItemChange change, const QVariant &value ) Q_DECL_OVERRIDE; virtual void DeleteTool(bool ask = true) Q_DECL_OVERRIDE; @@ -87,6 +86,8 @@ protected: virtual void SaveOptions(QDomElement &tag, QSharedPointer &obj) Q_DECL_OVERRIDE; virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE; virtual void SetVisualization() Q_DECL_OVERRIDE {} +private slots: + virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE; private: Q_DISABLE_COPY(VToolBasePoint) diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoollineintersect.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoollineintersect.cpp index ebc62a94b..a16881b57 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoollineintersect.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoollineintersect.cpp @@ -223,24 +223,6 @@ QString VToolLineIntersect::Line2P2Name() const return VAbstractTool::data.GetGObject(p2Line2)->name(); } -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief contextMenuEvent handle context menu events. - * @param event context menu event. - */ -void VToolLineIntersect::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) -{ - try - { - ContextMenu(this, event); - } - catch(const VExceptionToolWasDeleted &e) - { - Q_UNUSED(e) - return;//Leave this method immediately!!! - } -} - //--------------------------------------------------------------------------------------------------------------------- /** * @brief RemoveReferens decrement value of reference. @@ -367,6 +349,20 @@ void VToolLineIntersect::ShowVisualization(bool show) ShowToolVisualization(show); } +//--------------------------------------------------------------------------------------------------------------------- +void VToolLineIntersect::ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id) +{ + try + { + ContextMenu(event, id); + } + catch(const VExceptionToolWasDeleted &e) + { + Q_UNUSED(e) + return;//Leave this method immediately!!! + } +} + //--------------------------------------------------------------------------------------------------------------------- quint32 VToolLineIntersect::GetP1Line2() const { diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoollineintersect.h b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoollineintersect.h index 950dc7587..cf7820099 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoollineintersect.h +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoollineintersect.h @@ -80,8 +80,9 @@ public: void SetP2Line2(const quint32 &value); virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE; +protected slots: + virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE; protected: - virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ) Q_DECL_OVERRIDE; virtual void RemoveReferens() Q_DECL_OVERRIDE; virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE; virtual void SaveOptions(QDomElement &tag, QSharedPointer &obj) Q_DECL_OVERRIDE; diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromarcandtangent.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromarcandtangent.cpp index 114896457..c580d910a 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromarcandtangent.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromarcandtangent.cpp @@ -284,6 +284,20 @@ void VToolPointFromArcAndTangent::ShowVisualization(bool show) ShowToolVisualization(show); } +//--------------------------------------------------------------------------------------------------------------------- +void VToolPointFromArcAndTangent::ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id) +{ + try + { + ContextMenu(event, id); + } + catch(const VExceptionToolWasDeleted &e) + { + Q_UNUSED(e) + return;//Leave this method immediately!!! + } +} + //--------------------------------------------------------------------------------------------------------------------- void VToolPointFromArcAndTangent::RemoveReferens() { @@ -294,20 +308,6 @@ void VToolPointFromArcAndTangent::RemoveReferens() doc->DecrementReferens(tP->getIdTool()); } -//--------------------------------------------------------------------------------------------------------------------- -void VToolPointFromArcAndTangent::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) -{ - try - { - ContextMenu(this, event); - } - catch(const VExceptionToolWasDeleted &e) - { - Q_UNUSED(e) - return;//Leave this method immediately!!! - } -} - //--------------------------------------------------------------------------------------------------------------------- void VToolPointFromArcAndTangent::SaveDialog(QDomElement &domElement) { diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromarcandtangent.h b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromarcandtangent.h index 75c9bc8bb..9e9b0f8ea 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromarcandtangent.h +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromarcandtangent.h @@ -73,9 +73,10 @@ public: void SetCrossCirclesPoint(const CrossCirclesPoint &value); virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE; +protected slots: + virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE; protected: virtual void RemoveReferens() Q_DECL_OVERRIDE; - virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ) Q_DECL_OVERRIDE; virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE; virtual void SaveOptions(QDomElement &tag, QSharedPointer &obj) Q_DECL_OVERRIDE; virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE; diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromcircleandtangent.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromcircleandtangent.cpp index edf47eabf..01979c794 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromcircleandtangent.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromcircleandtangent.cpp @@ -269,6 +269,20 @@ void VToolPointFromCircleAndTangent::ShowVisualization(bool show) ShowToolVisualization(show); } +//--------------------------------------------------------------------------------------------------------------------- +void VToolPointFromCircleAndTangent::ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id) +{ + try + { + ContextMenu(event, id); + } + catch(const VExceptionToolWasDeleted &e) + { + Q_UNUSED(e) + return;//Leave this method immediately!!! + } +} + //--------------------------------------------------------------------------------------------------------------------- void VToolPointFromCircleAndTangent::RemoveReferens() { @@ -279,20 +293,6 @@ void VToolPointFromCircleAndTangent::RemoveReferens() doc->DecrementReferens(tangentPoint->getIdTool()); } -//--------------------------------------------------------------------------------------------------------------------- -void VToolPointFromCircleAndTangent::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) -{ - try - { - ContextMenu(this, event); - } - catch(const VExceptionToolWasDeleted &e) - { - Q_UNUSED(e) - return;//Leave this method immediately!!! - } -} - //--------------------------------------------------------------------------------------------------------------------- void VToolPointFromCircleAndTangent::SaveDialog(QDomElement &domElement) { diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromcircleandtangent.h b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromcircleandtangent.h index 915bfe8d2..892a54094 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromcircleandtangent.h +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromcircleandtangent.h @@ -78,9 +78,10 @@ public: void SetCrossCirclesPoint(const CrossCirclesPoint &value); virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE; +protected slots: + virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE; protected: virtual void RemoveReferens() Q_DECL_OVERRIDE; - virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ) Q_DECL_OVERRIDE; virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE; virtual void SaveOptions(QDomElement &tag, QSharedPointer &obj) Q_DECL_OVERRIDE; virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE; diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofcontact.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofcontact.cpp index 6a485ad78..85aff7237 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofcontact.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofcontact.cpp @@ -269,24 +269,6 @@ QString VToolPointOfContact::SecondPointName() const return VAbstractTool::data.GetGObject(secondPointId)->name(); } -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief contextMenuEvent handle context menu events. - * @param event context menu event. - */ -void VToolPointOfContact::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) -{ - try - { - ContextMenu(this, event); - } - catch(const VExceptionToolWasDeleted &e) - { - Q_UNUSED(e) - return;//Leave this method immediately!!! - } -} - //--------------------------------------------------------------------------------------------------------------------- /** * @brief RemoveReferens decrement value of reference. @@ -403,6 +385,20 @@ void VToolPointOfContact::ShowVisualization(bool show) ShowToolVisualization(show); } +//--------------------------------------------------------------------------------------------------------------------- +void VToolPointOfContact::ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id) +{ + try + { + ContextMenu(event, id); + } + catch(const VExceptionToolWasDeleted &e) + { + Q_UNUSED(e) + return;//Leave this method immediately!!! + } +} + //--------------------------------------------------------------------------------------------------------------------- quint32 VToolPointOfContact::GetFirstPointId() const { diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofcontact.h b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofcontact.h index 5ef7fb410..b08b57bd5 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofcontact.h +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofcontact.h @@ -84,8 +84,9 @@ public: void SetSecondPointId(const quint32 &value); virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE; +protected slots: + virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE; protected: - virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ) Q_DECL_OVERRIDE; virtual void RemoveReferens() Q_DECL_OVERRIDE; virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE; virtual void SaveOptions(QDomElement &tag, QSharedPointer &obj) Q_DECL_OVERRIDE; diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersection.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersection.cpp index 7a920d9bd..4960f5283 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersection.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersection.cpp @@ -195,24 +195,6 @@ void VToolPointOfIntersection::RemoveReferens() doc->DecrementReferens(secondPoint->getIdTool()); } -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief contextMenuEvent handle context menu events. - * @param event context menu event. - */ -void VToolPointOfIntersection::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) -{ - try - { - ContextMenu(this, event); - } - catch(const VExceptionToolWasDeleted &e) - { - Q_UNUSED(e) - return;//Leave this method immediately!!! - } -} - //--------------------------------------------------------------------------------------------------------------------- /** * @brief SaveDialog save options into file after change in dialog. @@ -258,6 +240,20 @@ void VToolPointOfIntersection::SetVisualization() } } +//--------------------------------------------------------------------------------------------------------------------- +void VToolPointOfIntersection::ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id) +{ + try + { + ContextMenu(event, id); + } + catch(const VExceptionToolWasDeleted &e) + { + Q_UNUSED(e) + return;//Leave this method immediately!!! + } +} + //--------------------------------------------------------------------------------------------------------------------- quint32 VToolPointOfIntersection::GetSecondPointId() const { diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersection.h b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersection.h index f316a786f..1e8a61fff 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersection.h +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersection.h @@ -73,11 +73,12 @@ public: virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE; protected: virtual void RemoveReferens() Q_DECL_OVERRIDE; - virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ) Q_DECL_OVERRIDE; virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE; virtual void SaveOptions(QDomElement &tag, QSharedPointer &obj) Q_DECL_OVERRIDE; virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE; virtual void SetVisualization() Q_DECL_OVERRIDE; +private slots: + virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE; private: Q_DISABLE_COPY(VToolPointOfIntersection) diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectionarcs.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectionarcs.cpp index 4b698ec9f..663ba92d6 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectionarcs.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectionarcs.cpp @@ -291,6 +291,20 @@ void VToolPointOfIntersectionArcs::ShowVisualization(bool show) ShowToolVisualization(show); } +//--------------------------------------------------------------------------------------------------------------------- +void VToolPointOfIntersectionArcs::ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id) +{ + try + { + ContextMenu(event, id); + } + catch(const VExceptionToolWasDeleted &e) + { + Q_UNUSED(e) + return;//Leave this method immediately!!! + } +} + //--------------------------------------------------------------------------------------------------------------------- void VToolPointOfIntersectionArcs::RemoveReferens() { @@ -301,20 +315,6 @@ void VToolPointOfIntersectionArcs::RemoveReferens() doc->DecrementReferens(secondArc->getIdTool()); } -//--------------------------------------------------------------------------------------------------------------------- -void VToolPointOfIntersectionArcs::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) -{ - try - { - ContextMenu(this, event); - } - catch(const VExceptionToolWasDeleted &e) - { - Q_UNUSED(e) - return;//Leave this method immediately!!! - } -} - //--------------------------------------------------------------------------------------------------------------------- void VToolPointOfIntersectionArcs::SaveDialog(QDomElement &domElement) { diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectionarcs.h b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectionarcs.h index 132b981a5..779a145f5 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectionarcs.h +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectionarcs.h @@ -75,9 +75,10 @@ public: void SetCrossCirclesPoint(const CrossCirclesPoint &value); virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE; +protected slots: + virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE; protected: virtual void RemoveReferens() Q_DECL_OVERRIDE; - virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ) Q_DECL_OVERRIDE; virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE; virtual void SaveOptions(QDomElement &tag, QSharedPointer &obj) Q_DECL_OVERRIDE; virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE; diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncircles.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncircles.cpp index 272d0f2ac..7328976b5 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncircles.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncircles.cpp @@ -308,6 +308,20 @@ void VToolPointOfIntersectionCircles::ShowVisualization(bool show) ShowToolVisualization(show); } +//--------------------------------------------------------------------------------------------------------------------- +void VToolPointOfIntersectionCircles::ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id) +{ + try + { + ContextMenu(event, id); + } + catch(const VExceptionToolWasDeleted &e) + { + Q_UNUSED(e) + return;//Leave this method immediately!!! + } +} + //--------------------------------------------------------------------------------------------------------------------- void VToolPointOfIntersectionCircles::RemoveReferens() { @@ -318,20 +332,6 @@ void VToolPointOfIntersectionCircles::RemoveReferens() doc->DecrementReferens(secondCircleCenter->getIdTool()); } -//--------------------------------------------------------------------------------------------------------------------- -void VToolPointOfIntersectionCircles::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) -{ - try - { - ContextMenu(this, event); - } - catch(const VExceptionToolWasDeleted &e) - { - Q_UNUSED(e) - return;//Leave this method immediately!!! - } -} - //--------------------------------------------------------------------------------------------------------------------- void VToolPointOfIntersectionCircles::SaveDialog(QDomElement &domElement) { diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncircles.h b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncircles.h index 7bf004115..f961be30e 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncircles.h +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncircles.h @@ -84,9 +84,10 @@ public: void SetCrossCirclesPoint(const CrossCirclesPoint &value); virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE; +protected slots: + virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE; protected: virtual void RemoveReferens() Q_DECL_OVERRIDE; - virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ) Q_DECL_OVERRIDE; virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE; virtual void SaveOptions(QDomElement &tag, QSharedPointer &obj) Q_DECL_OVERRIDE; virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE; diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncurves.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncurves.cpp index 3242ce3e2..f552d800a 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncurves.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncurves.cpp @@ -346,6 +346,20 @@ void VToolPointOfIntersectionCurves::ShowVisualization(bool show) ShowToolVisualization(show); } +//--------------------------------------------------------------------------------------------------------------------- +void VToolPointOfIntersectionCurves::ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id) +{ + try + { + ContextMenu(event, id); + } + catch(const VExceptionToolWasDeleted &e) + { + Q_UNUSED(e) + return;//Leave this method immediately!!! + } +} + //--------------------------------------------------------------------------------------------------------------------- void VToolPointOfIntersectionCurves::RemoveReferens() { @@ -356,20 +370,6 @@ void VToolPointOfIntersectionCurves::RemoveReferens() doc->DecrementReferens(curve2->getIdTool()); } -//--------------------------------------------------------------------------------------------------------------------- -void VToolPointOfIntersectionCurves::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) -{ - try - { - ContextMenu(this, event); - } - catch(const VExceptionToolWasDeleted &e) - { - Q_UNUSED(e) - return;//Leave this method immediately!!! - } -} - //--------------------------------------------------------------------------------------------------------------------- void VToolPointOfIntersectionCurves::SaveDialog(QDomElement &domElement) { diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncurves.h b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncurves.h index 976320aa8..57e69153e 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncurves.h +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncurves.h @@ -80,9 +80,10 @@ public: void SetHCrossPoint(const HCrossCurvesPoint &value); virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE; +protected slots: + virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE; protected: virtual void RemoveReferens() Q_DECL_OVERRIDE; - virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ) Q_DECL_OVERRIDE; virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE; virtual void SaveOptions(QDomElement &tag, QSharedPointer &obj) Q_DECL_OVERRIDE; virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE; diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolsinglepoint.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolsinglepoint.cpp index 76d34a05e..ea00e9ad4 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolsinglepoint.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolsinglepoint.cpp @@ -271,7 +271,7 @@ void VToolSinglePoint::keyReleaseEvent(QKeyEvent *event) //--------------------------------------------------------------------------------------------------------------------- void VToolSinglePoint::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) { - Q_UNUSED(event) + ShowContextMenu(event, id); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtooltriangle.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtooltriangle.cpp index f6d504703..27f64d3d4 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtooltriangle.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtooltriangle.cpp @@ -273,24 +273,6 @@ void VToolTriangle::RemoveReferens() doc->DecrementReferens(secondPoint->getIdTool()); } -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief contextMenuEvent handle context menu events. - * @param event context menu event. - */ -void VToolTriangle::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) -{ - try - { - ContextMenu(this, event); - } - catch(const VExceptionToolWasDeleted &e) - { - Q_UNUSED(e) - return;//Leave this method immediately!!! - } -} - //--------------------------------------------------------------------------------------------------------------------- /** * @brief SaveDialog save options into file after change in dialog. @@ -344,6 +326,20 @@ void VToolTriangle::SetVisualization() } } +//--------------------------------------------------------------------------------------------------------------------- +void VToolTriangle::ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id) +{ + try + { + ContextMenu(event, id); + } + catch(const VExceptionToolWasDeleted &e) + { + Q_UNUSED(e) + return;//Leave this method immediately!!! + } +} + //--------------------------------------------------------------------------------------------------------------------- quint32 VToolTriangle::GetSecondPointId() const { diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtooltriangle.h b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtooltriangle.h index aacc401ee..4d00789f2 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtooltriangle.h +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtooltriangle.h @@ -85,11 +85,12 @@ public: virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE; protected: virtual void RemoveReferens() Q_DECL_OVERRIDE; - virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ) Q_DECL_OVERRIDE; virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE; virtual void SaveOptions(QDomElement &tag, QSharedPointer &obj) Q_DECL_OVERRIDE; virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE; virtual void SetVisualization() Q_DECL_OVERRIDE; +private slots: + virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE; private: Q_DISABLE_COPY(VToolTriangle) /** @brief axisP1Id id first axis point. */ diff --git a/src/libs/vtools/tools/drawTools/vdrawtool.h b/src/libs/vtools/tools/drawTools/vdrawtool.h index 98202cf50..12e4ebf77 100644 --- a/src/libs/vtools/tools/drawTools/vdrawtool.h +++ b/src/libs/vtools/tools/drawTools/vdrawtool.h @@ -76,6 +76,8 @@ public slots: virtual void EnableToolMove(bool move); virtual void Disable(bool disable, const QString &namePP)=0; virtual void DetailsMode(bool mode); +protected slots: + virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID)=0; protected: enum class RemoveOption : bool {Disable = false, Enable = true}; @@ -102,8 +104,8 @@ protected: void ReadAttributes(); virtual void ReadToolAttributes(const QDomElement &domElement)=0; - template - void ContextMenu(Tool *tool, QGraphicsSceneContextMenuEvent *event, + template + void ContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 itemId, const RemoveOption &showRemove = RemoveOption::Enable, const Referens &ref = Referens::Follow); @@ -120,18 +122,18 @@ private: }; //--------------------------------------------------------------------------------------------------------------------- -template +template /** * @brief ContextMenu show context menu for tool. - * @param tool tool. * @param event context menu event. + * @param itemId id of point. 0 if not a point * @param showRemove true - tool enable option delete. * @param ref true - do not ignore referens value. */ -void VDrawTool::ContextMenu(Tool *tool, QGraphicsSceneContextMenuEvent *event, const RemoveOption &showRemove, +void VDrawTool::ContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 itemId, const RemoveOption &showRemove, const Referens &ref) { - SCASSERT(tool != nullptr) + Q_UNUSED(itemId) SCASSERT(event != nullptr) if (m_suppressContextMenu) @@ -178,10 +180,10 @@ void VDrawTool::ContextMenu(Tool *tool, QGraphicsSceneContextMenuEvent *event, c m_dialog = QSharedPointer(new Dialog(getData(), id, qApp->getMainWindow())); m_dialog->setModal(true); - connect(m_dialog.data(), &DialogTool::DialogClosed, tool, &Tool::FullUpdateFromGuiOk); - connect(m_dialog.data(), &DialogTool::DialogApplied, tool, &Tool::FullUpdateFromGuiApply); + connect(m_dialog.data(), &DialogTool::DialogClosed, this, &VDrawTool::FullUpdateFromGuiOk); + connect(m_dialog.data(), &DialogTool::DialogApplied, this, &VDrawTool::FullUpdateFromGuiApply); - tool->setDialog(); + this->setDialog(); m_dialog->show(); } diff --git a/src/libs/vtools/tools/drawTools/vtoolline.cpp b/src/libs/vtools/tools/drawTools/vtoolline.cpp index 0e8cdb8d9..dc59a6a73 100644 --- a/src/libs/vtools/tools/drawTools/vtoolline.cpp +++ b/src/libs/vtools/tools/drawTools/vtoolline.cpp @@ -256,15 +256,11 @@ void VToolLine::AllowSelecting(bool enabled) } //--------------------------------------------------------------------------------------------------------------------- -/** - * @brief contextMenuEvent handle context menu events. - * @param event context menu event. - */ -void VToolLine::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) +void VToolLine::ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id) { try { - ContextMenu(this, event); + ContextMenu(event, id); } catch(const VExceptionToolWasDeleted &e) { @@ -273,6 +269,16 @@ void VToolLine::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) } } +//--------------------------------------------------------------------------------------------------------------------- +/** + * @brief contextMenuEvent handle context menu events. + * @param event context menu event. + */ +void VToolLine::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) +{ + ShowContextMenu(event); +} + //--------------------------------------------------------------------------------------------------------------------- /** * @brief AddToFile add tag with informations about tool into file. diff --git a/src/libs/vtools/tools/drawTools/vtoolline.h b/src/libs/vtools/tools/drawTools/vtoolline.h index 337a2ccd6..9bca1b25a 100644 --- a/src/libs/vtools/tools/drawTools/vtoolline.h +++ b/src/libs/vtools/tools/drawTools/vtoolline.h @@ -89,6 +89,8 @@ public slots: virtual void Disable(bool disable, const QString &namePP) Q_DECL_OVERRIDE; virtual void AllowHover(bool enabled) Q_DECL_OVERRIDE; virtual void AllowSelecting(bool enabled) Q_DECL_OVERRIDE; +protected slots: + virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE; protected: virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ) Q_DECL_OVERRIDE; virtual void AddToFile() Q_DECL_OVERRIDE;