Refactoring to recognize child that called a contex menu.

--HG--
branch : feature
This commit is contained in:
Roman Telezhynskyi 2017-09-15 17:32:23 +03:00
parent edadf60279
commit 2864be7342
73 changed files with 419 additions and 445 deletions

View File

@ -167,6 +167,20 @@ void VToolFlippingByAxis::ShowVisualization(bool show)
ShowToolVisualization<VisToolFlippingByAxis>(show);
}
//---------------------------------------------------------------------------------------------------------------------
void VToolFlippingByAxis::ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id)
{
try
{
ContextMenu<DialogFlippingByAxis>(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<VGObject>
SaveSourceDestination(tag);
}
//---------------------------------------------------------------------------------------------------------------------
void VToolFlippingByAxis::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{
try
{
ContextMenu<DialogFlippingByAxis>(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,

View File

@ -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<VGObject> &obj) Q_DECL_OVERRIDE;
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ) Q_DECL_OVERRIDE;
private:
Q_DISABLE_COPY(VToolFlippingByAxis)

View File

@ -153,6 +153,20 @@ void VToolFlippingByLine::ShowVisualization(bool show)
ShowToolVisualization<VisToolFlippingByLine>(show);
}
//---------------------------------------------------------------------------------------------------------------------
void VToolFlippingByLine::ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id)
{
try
{
ContextMenu<DialogFlippingByLine>(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<VGObject>
SaveSourceDestination(tag);
}
//---------------------------------------------------------------------------------------------------------------------
void VToolFlippingByLine::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{
try
{
ContextMenu<DialogFlippingByLine>(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,

View File

@ -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<VGObject> &obj) Q_DECL_OVERRIDE;
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ) Q_DECL_OVERRIDE;
private:
Q_DISABLE_COPY(VToolFlippingByLine)

View File

@ -284,6 +284,20 @@ void VToolMove::ShowVisualization(bool show)
ShowToolVisualization<VisToolMove>(show);
}
//---------------------------------------------------------------------------------------------------------------------
void VToolMove::ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id)
{
try
{
ContextMenu<DialogMove>(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<VGObject> &obj)
SaveSourceDestination(tag);
}
//---------------------------------------------------------------------------------------------------------------------
void VToolMove::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{
try
{
ContextMenu<DialogMove>(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,

View File

@ -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<VGObject> &obj) Q_DECL_OVERRIDE;
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ) Q_DECL_OVERRIDE;
private:
Q_DISABLE_COPY(VToolMove)

View File

@ -285,6 +285,20 @@ void VToolRotation::ShowVisualization(bool show)
ShowToolVisualization<VisToolRotation>(show);
}
//---------------------------------------------------------------------------------------------------------------------
void VToolRotation::ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id)
{
try
{
ContextMenu<DialogRotation>(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<VGObject> &obj)
SaveSourceDestination(tag);
}
//---------------------------------------------------------------------------------------------------------------------
void VToolRotation::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{
try
{
ContextMenu<DialogRotation>(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)

View File

@ -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<VGObject> &obj) Q_DECL_OVERRIDE;
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ) Q_DECL_OVERRIDE;
private:
Q_DISABLE_COPY(VToolRotation)

View File

@ -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

View File

@ -112,6 +112,7 @@ protected:
virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE;
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &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;

View File

@ -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<DialogArc>(this, event);
ContextMenu<DialogArc>(event, id);
}
catch(const VExceptionToolWasDeleted &e)
{

View File

@ -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<VGObject> &obj) Q_DECL_OVERRIDE;

View File

@ -276,11 +276,11 @@ void VToolArcWithLength::ShowVisualization(bool show)
}
//---------------------------------------------------------------------------------------------------------------------
void VToolArcWithLength::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
void VToolArcWithLength::ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id)
{
try
{
ContextMenu<DialogArcWithLength>(this, event);
ContextMenu<DialogArcWithLength>(event, id);
}
catch(const VExceptionToolWasDeleted &e)
{

View File

@ -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<VGObject> &obj) Q_DECL_OVERRIDE;

View File

@ -189,11 +189,11 @@ void VToolCubicBezier::ShowVisualization(bool show)
}
//---------------------------------------------------------------------------------------------------------------------
void VToolCubicBezier::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
void VToolCubicBezier::ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id)
{
try
{
ContextMenu<DialogCubicBezier>(this, event);
ContextMenu<DialogCubicBezier>(event, id);
}
catch(const VExceptionToolWasDeleted &e)
{

View File

@ -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<VGObject> &obj) Q_DECL_OVERRIDE;

View File

@ -173,11 +173,11 @@ void VToolCubicBezierPath::ShowVisualization(bool show)
}
//---------------------------------------------------------------------------------------------------------------------
void VToolCubicBezierPath::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
void VToolCubicBezierPath::ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id)
{
try
{
ContextMenu<DialogCubicBezierPath>(this, event);
ContextMenu<DialogCubicBezierPath>(event, id);
}
catch(const VExceptionToolWasDeleted &e)
{

View File

@ -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<VGObject> &obj) Q_DECL_OVERRIDE;

View File

@ -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<DialogEllipticalArc>(this, event);
ContextMenu<DialogEllipticalArc>(event, id);
}
catch(const VExceptionToolWasDeleted &e)
{

View File

@ -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<VGObject> &obj) Q_DECL_OVERRIDE;

View File

@ -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<DialogSpline>(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<DialogSpline>(event, id);
}
catch(const VExceptionToolWasDeleted &e)
{
Q_UNUSED(e)
return;//Leave this method immediately!!!
}
}
//---------------------------------------------------------------------------------------------------------------------
void VToolSpline::SetSplineAttributes(QDomElement &domElement, const VSpline &spl)
{

View File

@ -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<VGObject> &obj) Q_DECL_OVERRIDE;

View File

@ -281,6 +281,20 @@ void VToolSplinePath::EnableToolMove(bool move)
this->setFlag(QGraphicsItem::ItemIsMovable, move);
}
//---------------------------------------------------------------------------------------------------------------------
void VToolSplinePath::ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id)
{
try
{
ContextMenu<DialogSplinePath>(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<VisToolSplinePath>(show);
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief contextMenuEvent handle context menu events.
* @param event context menu event.
*/
void VToolSplinePath::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{
try
{
ContextMenu<DialogSplinePath>(this, event);
}
catch(const VExceptionToolWasDeleted &e)
{
Q_UNUSED(e)
return;//Leave this method immediately!!!
}
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief AddPathPoint write path point to pattern file.

View File

@ -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<VGObject> &obj) Q_DECL_OVERRIDE;

View File

@ -312,7 +312,7 @@ void VToolDoublePoint::keyReleaseEvent(QKeyEvent *event)
//---------------------------------------------------------------------------------------------------------------------
void VToolDoublePoint::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{
Q_UNUSED(event)
ShowContextMenu(event);
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -334,11 +334,11 @@ void VToolTrueDarts::SetDartP3Id(const quint32 &value)
}
//---------------------------------------------------------------------------------------------------------------------
void VToolTrueDarts::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
void VToolTrueDarts::ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id)
{
try
{
ContextMenu<DialogTrueDarts>(this, event);
ContextMenu<DialogTrueDarts>(event, id);
}
catch(const VExceptionToolWasDeleted &e)
{

View File

@ -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<VGObject> &obj) Q_DECL_OVERRIDE;

View File

@ -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<DialogCutArc>(this, event);
ContextMenu<DialogCutArc>(event, id);
}
catch(const VExceptionToolWasDeleted &e)
{

View File

@ -61,8 +61,9 @@ public:
virtual int type() const Q_DECL_OVERRIDE {return Type;}
enum { Type = UserType + static_cast<int>(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<VGObject> &obj) Q_DECL_OVERRIDE;
virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE;

View File

@ -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<DialogCutSpline>(this, event);
ContextMenu<DialogCutSpline>(event, id);
}
catch(const VExceptionToolWasDeleted &e)
{

View File

@ -63,8 +63,9 @@ public:
virtual int type() const Q_DECL_OVERRIDE {return Type;}
enum { Type = UserType + static_cast<int>(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<VGObject> &obj) Q_DECL_OVERRIDE;
virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE;

View File

@ -275,15 +275,11 @@ VPointF *VToolCutSplinePath::CutSplinePath(qreal length, const QSharedPointer<VA
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief contextMenuEvent handle context menu events.
* @param event context menu event.
*/
void VToolCutSplinePath::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
void VToolCutSplinePath::ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id)
{
try
{
ContextMenu<DialogCutSplinePath>(this, event);
ContextMenu<DialogCutSplinePath>(event, id);
}
catch(const VExceptionToolWasDeleted &e)
{

View File

@ -69,8 +69,9 @@ public:
const QSharedPointer<VAbstractCubicBezierPath> &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<VGObject> &obj) Q_DECL_OVERRIDE;
virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE;

View File

@ -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<DialogAlongLine>(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<VisToolAlongLine>(show);
}
//---------------------------------------------------------------------------------------------------------------------
void VToolAlongLine::ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id)
{
try
{
ContextMenu<DialogAlongLine>(event, id);
}
catch(const VExceptionToolWasDeleted &e)
{
Q_UNUSED(e)
return;//Leave this method immediately!!!
}
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief setDialog set dialog when user want change tool option.

View File

@ -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<VGObject> &obj) Q_DECL_OVERRIDE;

View File

@ -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<DialogBisector>(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<VisToolBisector>(show);
}
//---------------------------------------------------------------------------------------------------------------------
void VToolBisector::ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id)
{
try
{
ContextMenu<DialogBisector>(event, id);
}
catch(const VExceptionToolWasDeleted &e)
{
Q_UNUSED(e)
return;//Leave this method immediately!!!
}
}
//---------------------------------------------------------------------------------------------------------------------
quint32 VToolBisector::GetFirstPointId() const
{

View File

@ -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<VGObject> &obj) Q_DECL_OVERRIDE;

View File

@ -262,11 +262,11 @@ void VToolCurveIntersectAxis::ShowVisualization(bool show)
}
//---------------------------------------------------------------------------------------------------------------------
void VToolCurveIntersectAxis::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
void VToolCurveIntersectAxis::ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id)
{
try
{
ContextMenu<DialogCurveIntersectAxis>(this, event);
ContextMenu<DialogCurveIntersectAxis>(event, id);
}
catch(const VExceptionToolWasDeleted &e)
{

View File

@ -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<VGObject> &obj) Q_DECL_OVERRIDE;
virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE;

View File

@ -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<DialogEndLine>(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<VisToolEndLine>(show);
}
//---------------------------------------------------------------------------------------------------------------------
void VToolEndLine::ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id)
{
try
{
ContextMenu<DialogEndLine>(event, id);
}
catch(const VExceptionToolWasDeleted &e)
{
Q_UNUSED(e)
return;//Leave this method immediately!!!
}
}

View File

@ -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<VGObject> &obj) Q_DECL_OVERRIDE;
virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE;

View File

@ -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<DialogHeight>(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<VisToolHeight>(show);
}
//---------------------------------------------------------------------------------------------------------------------
void VToolHeight::ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id)
{
try
{
ContextMenu<DialogHeight>(event, id);
}
catch(const VExceptionToolWasDeleted &e)
{
Q_UNUSED(e)
return;//Leave this method immediately!!!
}
}
//---------------------------------------------------------------------------------------------------------------------
quint32 VToolHeight::GetP1LineId() const
{

View File

@ -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<VGObject> &obj) Q_DECL_OVERRIDE;
virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE;

View File

@ -264,11 +264,11 @@ void VToolLineIntersectAxis::ShowVisualization(bool show)
}
//---------------------------------------------------------------------------------------------------------------------
void VToolLineIntersectAxis::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
void VToolLineIntersectAxis::ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id)
{
try
{
ContextMenu<DialogLineIntersectAxis>(this, event);
ContextMenu<DialogLineIntersectAxis>(event, id);
}
catch(const VExceptionToolWasDeleted &e)
{

View File

@ -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<VGObject> &obj) Q_DECL_OVERRIDE;
virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE;

View File

@ -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<DialogNormal>(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<VisToolNormal>(show);
}
//---------------------------------------------------------------------------------------------------------------------
void VToolNormal::ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id)
{
try
{
ContextMenu<DialogNormal>(event, id);
}
catch(const VExceptionToolWasDeleted &e)
{
Q_UNUSED(e)
return;//Leave this method immediately!!!
}
}

View File

@ -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<VGObject> &obj) Q_DECL_OVERRIDE;

View File

@ -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<DialogShoulderPoint>(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<DialogShoulderPoint>(event, id);
}
catch(const VExceptionToolWasDeleted &e)
{
Q_UNUSED(e)
return;//Leave this method immediately!!!
}
}
//---------------------------------------------------------------------------------------------------------------------
// cppcheck-suppress unusedFunction
quint32 VToolShoulderPoint::getPShoulder() const

View File

@ -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<VGObject> &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)

View File

@ -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<DialogSinglePoint>(this, event, RemoveOption::Enable, Referens::Ignore);
ContextMenu<DialogSinglePoint>(event, id, RemoveOption::Enable, Referens::Ignore);
}
else
{
qCDebug(vTool, "PP count = 1");
ContextMenu<DialogSinglePoint>(this, event, RemoveOption::Disable);
ContextMenu<DialogSinglePoint>(event, id, RemoveOption::Disable);
}
}
catch(const VExceptionToolWasDeleted &e)

View File

@ -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<VGObject> &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)

View File

@ -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<DialogLineIntersect>(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<VisToolLineIntersect>(show);
}
//---------------------------------------------------------------------------------------------------------------------
void VToolLineIntersect::ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id)
{
try
{
ContextMenu<DialogLineIntersect>(event, id);
}
catch(const VExceptionToolWasDeleted &e)
{
Q_UNUSED(e)
return;//Leave this method immediately!!!
}
}
//---------------------------------------------------------------------------------------------------------------------
quint32 VToolLineIntersect::GetP1Line2() const
{

View File

@ -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<VGObject> &obj) Q_DECL_OVERRIDE;

View File

@ -284,6 +284,20 @@ void VToolPointFromArcAndTangent::ShowVisualization(bool show)
ShowToolVisualization<VisToolPointFromArcAndTangent>(show);
}
//---------------------------------------------------------------------------------------------------------------------
void VToolPointFromArcAndTangent::ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id)
{
try
{
ContextMenu<DialogPointFromArcAndTangent>(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<DialogPointFromArcAndTangent>(this, event);
}
catch(const VExceptionToolWasDeleted &e)
{
Q_UNUSED(e)
return;//Leave this method immediately!!!
}
}
//---------------------------------------------------------------------------------------------------------------------
void VToolPointFromArcAndTangent::SaveDialog(QDomElement &domElement)
{

View File

@ -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<VGObject> &obj) Q_DECL_OVERRIDE;
virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE;

View File

@ -269,6 +269,20 @@ void VToolPointFromCircleAndTangent::ShowVisualization(bool show)
ShowToolVisualization<VisToolPointFromCircleAndTangent>(show);
}
//---------------------------------------------------------------------------------------------------------------------
void VToolPointFromCircleAndTangent::ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id)
{
try
{
ContextMenu<DialogPointFromCircleAndTangent>(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<DialogPointFromCircleAndTangent>(this, event);
}
catch(const VExceptionToolWasDeleted &e)
{
Q_UNUSED(e)
return;//Leave this method immediately!!!
}
}
//---------------------------------------------------------------------------------------------------------------------
void VToolPointFromCircleAndTangent::SaveDialog(QDomElement &domElement)
{

View File

@ -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<VGObject> &obj) Q_DECL_OVERRIDE;
virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE;

View File

@ -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<DialogPointOfContact>(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<VisToolPointOfContact>(show);
}
//---------------------------------------------------------------------------------------------------------------------
void VToolPointOfContact::ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id)
{
try
{
ContextMenu<DialogPointOfContact>(event, id);
}
catch(const VExceptionToolWasDeleted &e)
{
Q_UNUSED(e)
return;//Leave this method immediately!!!
}
}
//---------------------------------------------------------------------------------------------------------------------
quint32 VToolPointOfContact::GetFirstPointId() const
{

View File

@ -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<VGObject> &obj) Q_DECL_OVERRIDE;

View File

@ -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<DialogPointOfIntersection>(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<DialogPointOfIntersection>(event, id);
}
catch(const VExceptionToolWasDeleted &e)
{
Q_UNUSED(e)
return;//Leave this method immediately!!!
}
}
//---------------------------------------------------------------------------------------------------------------------
quint32 VToolPointOfIntersection::GetSecondPointId() const
{

View File

@ -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<VGObject> &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)

View File

@ -291,6 +291,20 @@ void VToolPointOfIntersectionArcs::ShowVisualization(bool show)
ShowToolVisualization<VisToolPointOfIntersectionArcs>(show);
}
//---------------------------------------------------------------------------------------------------------------------
void VToolPointOfIntersectionArcs::ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id)
{
try
{
ContextMenu<DialogPointOfIntersectionArcs>(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<DialogPointOfIntersectionArcs>(this, event);
}
catch(const VExceptionToolWasDeleted &e)
{
Q_UNUSED(e)
return;//Leave this method immediately!!!
}
}
//---------------------------------------------------------------------------------------------------------------------
void VToolPointOfIntersectionArcs::SaveDialog(QDomElement &domElement)
{

View File

@ -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<VGObject> &obj) Q_DECL_OVERRIDE;
virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE;

View File

@ -308,6 +308,20 @@ void VToolPointOfIntersectionCircles::ShowVisualization(bool show)
ShowToolVisualization<VisToolPointOfIntersectionCircles>(show);
}
//---------------------------------------------------------------------------------------------------------------------
void VToolPointOfIntersectionCircles::ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id)
{
try
{
ContextMenu<DialogPointOfIntersectionCircles>(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<DialogPointOfIntersectionCircles>(this, event);
}
catch(const VExceptionToolWasDeleted &e)
{
Q_UNUSED(e)
return;//Leave this method immediately!!!
}
}
//---------------------------------------------------------------------------------------------------------------------
void VToolPointOfIntersectionCircles::SaveDialog(QDomElement &domElement)
{

View File

@ -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<VGObject> &obj) Q_DECL_OVERRIDE;
virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE;

View File

@ -346,6 +346,20 @@ void VToolPointOfIntersectionCurves::ShowVisualization(bool show)
ShowToolVisualization<VisToolPointOfIntersectionCurves>(show);
}
//---------------------------------------------------------------------------------------------------------------------
void VToolPointOfIntersectionCurves::ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id)
{
try
{
ContextMenu<DialogPointOfIntersectionCurves>(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<DialogPointOfIntersectionCurves>(this, event);
}
catch(const VExceptionToolWasDeleted &e)
{
Q_UNUSED(e)
return;//Leave this method immediately!!!
}
}
//---------------------------------------------------------------------------------------------------------------------
void VToolPointOfIntersectionCurves::SaveDialog(QDomElement &domElement)
{

View File

@ -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<VGObject> &obj) Q_DECL_OVERRIDE;
virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE;

View File

@ -271,7 +271,7 @@ void VToolSinglePoint::keyReleaseEvent(QKeyEvent *event)
//---------------------------------------------------------------------------------------------------------------------
void VToolSinglePoint::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{
Q_UNUSED(event)
ShowContextMenu(event, id);
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -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<DialogTriangle>(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<DialogTriangle>(event, id);
}
catch(const VExceptionToolWasDeleted &e)
{
Q_UNUSED(e)
return;//Leave this method immediately!!!
}
}
//---------------------------------------------------------------------------------------------------------------------
quint32 VToolTriangle::GetSecondPointId() const
{

View File

@ -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<VGObject> &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. */

View File

@ -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 <typename Dialog, typename Tool>
void ContextMenu(Tool *tool, QGraphicsSceneContextMenuEvent *event,
template <typename Dialog>
void ContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 itemId,
const RemoveOption &showRemove = RemoveOption::Enable,
const Referens &ref = Referens::Follow);
@ -120,18 +122,18 @@ private:
};
//---------------------------------------------------------------------------------------------------------------------
template <typename Dialog, typename Tool>
template <typename Dialog>
/**
* @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<Dialog>(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();
}

View File

@ -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<DialogLine>(this, event);
ContextMenu<DialogLine>(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.

View File

@ -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;