From 1d059ca9a58f2d0b8e26f1b893e3a22d2ca6f60e Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Wed, 25 May 2016 11:43:36 +0300 Subject: [PATCH] Show context menu VSimplePoint and VSimpleCurve. --HG-- branch : develop --- src/libs/vwidgets/vsimplecurve.cpp | 6 ++++++ src/libs/vwidgets/vsimplecurve.h | 1 + src/libs/vwidgets/vsimplepoint.cpp | 6 ++++++ src/libs/vwidgets/vsimplepoint.h | 1 + 4 files changed, 14 insertions(+) diff --git a/src/libs/vwidgets/vsimplecurve.cpp b/src/libs/vwidgets/vsimplecurve.cpp index daeb2f184..a6ce5908b 100644 --- a/src/libs/vwidgets/vsimplecurve.cpp +++ b/src/libs/vwidgets/vsimplecurve.cpp @@ -149,6 +149,12 @@ QVariant VSimpleCurve::itemChange(QGraphicsItem::GraphicsItemChange change, cons return QGraphicsPathItem::itemChange(change, value); } +//--------------------------------------------------------------------------------------------------------------------- +void VSimpleCurve::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) +{ + emit ShowContextMenu(event); +} + //--------------------------------------------------------------------------------------------------------------------- void VSimpleCurve::ShowPath() { diff --git a/src/libs/vwidgets/vsimplecurve.h b/src/libs/vwidgets/vsimplecurve.h index a50881f2f..45b11e70b 100644 --- a/src/libs/vwidgets/vsimplecurve.h +++ b/src/libs/vwidgets/vsimplecurve.h @@ -69,6 +69,7 @@ protected: virtual void hoverEnterEvent ( QGraphicsSceneHoverEvent * event ) Q_DECL_OVERRIDE; virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ) Q_DECL_OVERRIDE; virtual QVariant itemChange ( GraphicsItemChange change, const QVariant &value ) Q_DECL_OVERRIDE; + virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ) Q_DECL_OVERRIDE; private: Q_DISABLE_COPY(VSimpleCurve) diff --git a/src/libs/vwidgets/vsimplepoint.cpp b/src/libs/vwidgets/vsimplepoint.cpp index 8c32e3714..820cfc4dd 100644 --- a/src/libs/vwidgets/vsimplepoint.cpp +++ b/src/libs/vwidgets/vsimplepoint.cpp @@ -263,3 +263,9 @@ QVariant VSimplePoint::itemChange(QGraphicsItem::GraphicsItemChange change, cons return QGraphicsEllipseItem::itemChange(change, value); } + +//--------------------------------------------------------------------------------------------------------------------- +void VSimplePoint::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) +{ + emit ShowContextMenu(event); +} diff --git a/src/libs/vwidgets/vsimplepoint.h b/src/libs/vwidgets/vsimplepoint.h index a284be588..887c4507a 100644 --- a/src/libs/vwidgets/vsimplepoint.h +++ b/src/libs/vwidgets/vsimplepoint.h @@ -80,6 +80,7 @@ protected: virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ) Q_DECL_OVERRIDE; virtual void keyReleaseEvent ( QKeyEvent * event ) Q_DECL_OVERRIDE; virtual QVariant itemChange ( GraphicsItemChange change, const QVariant &value ) Q_DECL_OVERRIDE; + virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ) Q_DECL_OVERRIDE; private: Q_DISABLE_COPY(VSimplePoint)