diff --git a/src/tools/drawTools/vtoolalongline.cpp b/src/tools/drawTools/vtoolalongline.cpp index eaa07dd9f..978d18b6f 100644 --- a/src/tools/drawTools/vtoolalongline.cpp +++ b/src/tools/drawTools/vtoolalongline.cpp @@ -91,6 +91,11 @@ void VToolAlongLine::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) ContextMenu(dialogAlongLine, this, event); } +void VToolAlongLine::ShowContextMenu(QGraphicsSceneContextMenuEvent *event) +{ + ContextMenu(dialogAlongLine, this, event); +} + void VToolAlongLine::AddToFile() { const VPointF *point = VAbstractTool::data.GeometricObject(id); diff --git a/src/tools/drawTools/vtoolalongline.h b/src/tools/drawTools/vtoolalongline.h index b989b0583..171fa4e99 100644 --- a/src/tools/drawTools/vtoolalongline.h +++ b/src/tools/drawTools/vtoolalongline.h @@ -106,12 +106,13 @@ public slots: * @param factor */ virtual void SetFactor(qreal factor); + virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event); protected: /** * @brief contextMenuEvent * @param event */ - virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); + virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); /** * @brief AddToFile */ diff --git a/src/tools/drawTools/vtoolbisector.cpp b/src/tools/drawTools/vtoolbisector.cpp index 01eb4fd30..8393cd93c 100644 --- a/src/tools/drawTools/vtoolbisector.cpp +++ b/src/tools/drawTools/vtoolbisector.cpp @@ -182,6 +182,11 @@ void VToolBisector::SetFactor(qreal factor) RefreshGeometry(); } +void VToolBisector::ShowContextMenu(QGraphicsSceneContextMenuEvent *event) +{ + ContextMenu(dialogBisector, this, event); +} + void VToolBisector::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) { ContextMenu(dialogBisector, this, event); diff --git a/src/tools/drawTools/vtoolbisector.h b/src/tools/drawTools/vtoolbisector.h index a94fc4f2f..3e9ea92c5 100644 --- a/src/tools/drawTools/vtoolbisector.h +++ b/src/tools/drawTools/vtoolbisector.h @@ -119,6 +119,7 @@ public slots: * @param factor */ virtual void SetFactor(qreal factor); + virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event); protected: /** * @brief contextMenuEvent diff --git a/src/tools/drawTools/vtoolendline.cpp b/src/tools/drawTools/vtoolendline.cpp index d5bd9b0ab..f2f69cd92 100644 --- a/src/tools/drawTools/vtoolendline.cpp +++ b/src/tools/drawTools/vtoolendline.cpp @@ -151,6 +151,11 @@ void VToolEndLine::FullUpdateFromGui(int result) dialogEndLine.clear(); } +void VToolEndLine::ShowContextMenu(QGraphicsSceneContextMenuEvent *event) +{ + ContextMenu(dialogEndLine, this, event); +} + void VToolEndLine::AddToFile() { const VPointF *point = VAbstractTool::data.GeometricObject(id); diff --git a/src/tools/drawTools/vtoolendline.h b/src/tools/drawTools/vtoolendline.h index 32cfe0365..eca302231 100644 --- a/src/tools/drawTools/vtoolendline.h +++ b/src/tools/drawTools/vtoolendline.h @@ -101,6 +101,7 @@ public slots: * @param result */ virtual void FullUpdateFromGui(int result); + virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event); protected: /** * @brief contextMenuEvent diff --git a/src/tools/drawTools/vtoolheight.cpp b/src/tools/drawTools/vtoolheight.cpp index 96300b696..35802c133 100644 --- a/src/tools/drawTools/vtoolheight.cpp +++ b/src/tools/drawTools/vtoolheight.cpp @@ -166,6 +166,11 @@ void VToolHeight::FullUpdateFromGui(int result) dialogHeight.clear(); } +void VToolHeight::ShowContextMenu(QGraphicsSceneContextMenuEvent *event) +{ + ContextMenu(dialogHeight, this, event); +} + void VToolHeight::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) { ContextMenu(dialogHeight, this, event); diff --git a/src/tools/drawTools/vtoolheight.h b/src/tools/drawTools/vtoolheight.h index d336f7d2d..b6bf93ad8 100644 --- a/src/tools/drawTools/vtoolheight.h +++ b/src/tools/drawTools/vtoolheight.h @@ -108,6 +108,7 @@ public slots: * @param result */ virtual void FullUpdateFromGui(int result); + virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event); protected: /** * @brief contextMenuEvent diff --git a/src/tools/drawTools/vtoollineintersect.cpp b/src/tools/drawTools/vtoollineintersect.cpp index 3f2cd45a5..6cd5d6123 100644 --- a/src/tools/drawTools/vtoollineintersect.cpp +++ b/src/tools/drawTools/vtoollineintersect.cpp @@ -163,6 +163,11 @@ void VToolLineIntersect::SetFactor(qreal factor) RefreshPointGeometry(*VAbstractTool::data.GeometricObject(id)); } +void VToolLineIntersect::ShowContextMenu(QGraphicsSceneContextMenuEvent *event) +{ + ContextMenu(dialogLineIntersect, this, event); +} + void VToolLineIntersect::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) { ContextMenu(dialogLineIntersect, this, event); diff --git a/src/tools/drawTools/vtoollineintersect.h b/src/tools/drawTools/vtoollineintersect.h index 98a90a32e..2bef1c257 100644 --- a/src/tools/drawTools/vtoollineintersect.h +++ b/src/tools/drawTools/vtoollineintersect.h @@ -106,6 +106,7 @@ public slots: * @param factor */ virtual void SetFactor(qreal factor); + virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event); protected: /** * @brief contextMenuEvent diff --git a/src/tools/drawTools/vtoolnormal.cpp b/src/tools/drawTools/vtoolnormal.cpp index 1c3cb0134..dcceb0f8d 100644 --- a/src/tools/drawTools/vtoolnormal.cpp +++ b/src/tools/drawTools/vtoolnormal.cpp @@ -167,6 +167,11 @@ void VToolNormal::SetFactor(qreal factor) RefreshGeometry(); } +void VToolNormal::ShowContextMenu(QGraphicsSceneContextMenuEvent *event) +{ + ContextMenu(dialogNormal, this, event); +} + void VToolNormal::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) { ContextMenu(dialogNormal, this, event); diff --git a/src/tools/drawTools/vtoolnormal.h b/src/tools/drawTools/vtoolnormal.h index 61e7fe6fc..b9d45655c 100644 --- a/src/tools/drawTools/vtoolnormal.h +++ b/src/tools/drawTools/vtoolnormal.h @@ -120,6 +120,7 @@ public slots: * @param factor */ virtual void SetFactor(qreal factor); + virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event); protected: /** * @brief contextMenuEvent diff --git a/src/tools/drawTools/vtoolpoint.cpp b/src/tools/drawTools/vtoolpoint.cpp index a0fe4ffd9..e5ff1e066 100644 --- a/src/tools/drawTools/vtoolpoint.cpp +++ b/src/tools/drawTools/vtoolpoint.cpp @@ -34,11 +34,13 @@ VToolPoint::VToolPoint(VDomDocument *doc, VContainer *data, qint64 id, QGraphics QGraphicsEllipseItem(parent), radius(toPixel(2)), namePoint(0), lineName(0) { namePoint = new VGraphicsSimpleTextItem(this); + Q_ASSERT(namePoint != 0); + connect(namePoint, &VGraphicsSimpleTextItem::ShowContextMenu, this, &VToolPoint::ShowContextMenu); namePoint->setBrush(Qt::black); lineName = new QGraphicsLineItem(this); + Q_ASSERT(lineName != 0); lineName->setPen(QPen(Qt::black)); - connect(namePoint, &VGraphicsSimpleTextItem::NameChangePosition, this, - &VToolPoint::NameChangePosition); + connect(namePoint, &VGraphicsSimpleTextItem::NameChangePosition, this, &VToolPoint::NameChangePosition); this->setBrush(QBrush(Qt::NoBrush)); this->setFlag(QGraphicsItem::ItemIsSelectable, true); this->setFlag(QGraphicsItem::ItemIsFocusable, true); @@ -105,6 +107,11 @@ void VToolPoint::SetFactor(qreal factor) RefreshPointGeometry(*VAbstractTool::data.GeometricObject(id)); } +void VToolPoint::ShowContextMenu(QGraphicsSceneContextMenuEvent *event) +{ + Q_UNUSED(event); +} + void VToolPoint::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { if (event->button() == Qt::LeftButton) diff --git a/src/tools/drawTools/vtoolpoint.h b/src/tools/drawTools/vtoolpoint.h index 11914ba80..73d60d995 100644 --- a/src/tools/drawTools/vtoolpoint.h +++ b/src/tools/drawTools/vtoolpoint.h @@ -80,6 +80,7 @@ public slots: * @param factor */ virtual void SetFactor(qreal factor); + virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event); protected: /** * @brief radius diff --git a/src/tools/drawTools/vtoolpointofcontact.cpp b/src/tools/drawTools/vtoolpointofcontact.cpp index 0abf7981e..85ea30731 100644 --- a/src/tools/drawTools/vtoolpointofcontact.cpp +++ b/src/tools/drawTools/vtoolpointofcontact.cpp @@ -186,6 +186,11 @@ void VToolPointOfContact::SetFactor(qreal factor) RefreshPointGeometry(*VAbstractTool::data.GeometricObject(id)); } +void VToolPointOfContact::ShowContextMenu(QGraphicsSceneContextMenuEvent *event) +{ + ContextMenu(dialogPointOfContact, this, event); +} + void VToolPointOfContact::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) { ContextMenu(dialogPointOfContact, this, event); diff --git a/src/tools/drawTools/vtoolpointofcontact.h b/src/tools/drawTools/vtoolpointofcontact.h index c38a23bcb..c853830cc 100644 --- a/src/tools/drawTools/vtoolpointofcontact.h +++ b/src/tools/drawTools/vtoolpointofcontact.h @@ -116,6 +116,7 @@ public slots: * @param factor */ virtual void SetFactor(qreal factor); + virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event); protected: /** * @brief contextMenuEvent diff --git a/src/tools/drawTools/vtoolpointofintersection.cpp b/src/tools/drawTools/vtoolpointofintersection.cpp index 1c2d67e25..21cc206cb 100644 --- a/src/tools/drawTools/vtoolpointofintersection.cpp +++ b/src/tools/drawTools/vtoolpointofintersection.cpp @@ -128,6 +128,11 @@ void VToolPointOfIntersection::FullUpdateFromGui(int result) dialogPointOfIntersection.clear(); } +void VToolPointOfIntersection::ShowContextMenu(QGraphicsSceneContextMenuEvent *event) +{ + ContextMenu(dialogPointOfIntersection, this, event); +} + void VToolPointOfIntersection::RemoveReferens() { doc->DecrementReferens(firstPointId); diff --git a/src/tools/drawTools/vtoolpointofintersection.h b/src/tools/drawTools/vtoolpointofintersection.h index f19e8c982..ec2057b0f 100644 --- a/src/tools/drawTools/vtoolpointofintersection.h +++ b/src/tools/drawTools/vtoolpointofintersection.h @@ -97,6 +97,7 @@ public slots: * @param result */ virtual void FullUpdateFromGui(int result); + virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event); protected: /** * @brief RemoveReferens diff --git a/src/tools/drawTools/vtoolshoulderpoint.cpp b/src/tools/drawTools/vtoolshoulderpoint.cpp index 0e34bc11f..ea46e79c4 100644 --- a/src/tools/drawTools/vtoolshoulderpoint.cpp +++ b/src/tools/drawTools/vtoolshoulderpoint.cpp @@ -190,6 +190,11 @@ void VToolShoulderPoint::SetFactor(qreal factor) RefreshGeometry(); } +void VToolShoulderPoint::ShowContextMenu(QGraphicsSceneContextMenuEvent *event) +{ + ContextMenu(dialogShoulderPoint, this, event); +} + void VToolShoulderPoint::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) { ContextMenu(dialogShoulderPoint, this, event); diff --git a/src/tools/drawTools/vtoolshoulderpoint.h b/src/tools/drawTools/vtoolshoulderpoint.h index 95c0565cd..b3356a41b 100644 --- a/src/tools/drawTools/vtoolshoulderpoint.h +++ b/src/tools/drawTools/vtoolshoulderpoint.h @@ -118,6 +118,7 @@ public slots: * @param factor */ virtual void SetFactor(qreal factor); + virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event); protected: /** * @brief contextMenuEvent diff --git a/src/tools/drawTools/vtoolsinglepoint.cpp b/src/tools/drawTools/vtoolsinglepoint.cpp index 33727bf1a..a1aff559a 100644 --- a/src/tools/drawTools/vtoolsinglepoint.cpp +++ b/src/tools/drawTools/vtoolsinglepoint.cpp @@ -184,3 +184,8 @@ void VToolSinglePoint::SetFactor(qreal factor) VDrawTool::SetFactor(factor); RefreshPointGeometry(*(VAbstractTool::data.GeometricObject(id))); } + +void VToolSinglePoint::ShowContextMenu(QGraphicsSceneContextMenuEvent *event) +{ + ContextMenu(dialogSinglePoint, this, event, false); +} diff --git a/src/tools/drawTools/vtoolsinglepoint.h b/src/tools/drawTools/vtoolsinglepoint.h index 6d1ba456f..6ba3a0163 100644 --- a/src/tools/drawTools/vtoolsinglepoint.h +++ b/src/tools/drawTools/vtoolsinglepoint.h @@ -77,6 +77,7 @@ public slots: * @param factor */ virtual void SetFactor(qreal factor); + virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event); signals: /** * @brief FullUpdateTree diff --git a/src/tools/drawTools/vtooltriangle.cpp b/src/tools/drawTools/vtooltriangle.cpp index c4f9435d3..12b59448f 100644 --- a/src/tools/drawTools/vtooltriangle.cpp +++ b/src/tools/drawTools/vtooltriangle.cpp @@ -184,6 +184,11 @@ void VToolTriangle::FullUpdateFromGui(int result) dialogTriangle.clear(); } +void VToolTriangle::ShowContextMenu(QGraphicsSceneContextMenuEvent *event) +{ + ContextMenu(dialogTriangle, this, event); +} + void VToolTriangle::RemoveReferens() { doc->DecrementReferens(axisP1Id); diff --git a/src/tools/drawTools/vtooltriangle.h b/src/tools/drawTools/vtooltriangle.h index e6d13c8af..27767370f 100644 --- a/src/tools/drawTools/vtooltriangle.h +++ b/src/tools/drawTools/vtooltriangle.h @@ -111,6 +111,7 @@ public slots: * @param result */ virtual void FullUpdateFromGui(int result); + virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event); protected: /** * @brief RemoveReferens diff --git a/src/widgets/vgraphicssimpletextitem.cpp b/src/widgets/vgraphicssimpletextitem.cpp index 80a908fbb..65c7a818f 100644 --- a/src/widgets/vgraphicssimpletextitem.cpp +++ b/src/widgets/vgraphicssimpletextitem.cpp @@ -73,3 +73,8 @@ void VGraphicsSimpleTextItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) Q_UNUSED(event); this->setBrush(Qt::black); } + +void VGraphicsSimpleTextItem::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) +{ + emit ShowContextMenu(event); +} diff --git a/src/widgets/vgraphicssimpletextitem.h b/src/widgets/vgraphicssimpletextitem.h index 753a68497..ab46d6fff 100644 --- a/src/widgets/vgraphicssimpletextitem.h +++ b/src/widgets/vgraphicssimpletextitem.h @@ -60,6 +60,7 @@ signals: * @param pos */ void NameChangePosition(const QPointF pos); + void ShowContextMenu(QGraphicsSceneContextMenuEvent *event); protected: /** * @brief itemChange @@ -78,6 +79,7 @@ protected: * @param event */ virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ); + virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); private: /** * @brief fontSize