From 99ebbc3ed9f150b1ccd2c9cc54ed105bf47ddb2f Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Thu, 12 Feb 2015 18:10:47 +0200 Subject: [PATCH] Simple curve ignore press event and allow move curve by mouse. --HG-- branch : feature --- src/app/tools/drawTools/vtoolsplinepath.cpp | 6 ++++++ src/app/tools/drawTools/vtoolsplinepath.h | 1 + src/app/visualization/vsimplecurve.cpp | 6 ++++++ src/app/visualization/vsimplecurve.h | 1 + 4 files changed, 14 insertions(+) diff --git a/src/app/tools/drawTools/vtoolsplinepath.cpp b/src/app/tools/drawTools/vtoolsplinepath.cpp index d40c258bf..6ca030ff5 100644 --- a/src/app/tools/drawTools/vtoolsplinepath.cpp +++ b/src/app/tools/drawTools/vtoolsplinepath.cpp @@ -204,6 +204,12 @@ void VToolSplinePath::ControlPointChangePosition(const qint32 &indexSpline, cons qApp->getUndoStack()->push(moveSplPath); } +//--------------------------------------------------------------------------------------------------------------------- +void VToolSplinePath::EnableToolMove(bool move) +{ + this->setFlag(QGraphicsItem::ItemIsMovable, move); +} + //--------------------------------------------------------------------------------------------------------------------- /** * @brief UpdateControlPoints update position points control points in file. diff --git a/src/app/tools/drawTools/vtoolsplinepath.h b/src/app/tools/drawTools/vtoolsplinepath.h index 52fb849db..1566149c0 100644 --- a/src/app/tools/drawTools/vtoolsplinepath.h +++ b/src/app/tools/drawTools/vtoolsplinepath.h @@ -73,6 +73,7 @@ public slots: void ControlPointChangePosition(const qint32 &indexSpline, const SplinePointPosition &position, const QPointF &pos); + virtual void EnableToolMove(bool move); protected: virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); virtual void RefreshDataInFile(); diff --git a/src/app/visualization/vsimplecurve.cpp b/src/app/visualization/vsimplecurve.cpp index 33031f3eb..095f6c2db 100644 --- a/src/app/visualization/vsimplecurve.cpp +++ b/src/app/visualization/vsimplecurve.cpp @@ -144,6 +144,12 @@ void VSimpleCurve::SetCurrentColor(const QColor &value) setPen(QPen(CorrectColor(currentColor), pen().widthF())); } +//--------------------------------------------------------------------------------------------------------------------- +void VSimpleCurve::mousePressEvent(QGraphicsSceneMouseEvent *event) +{ + event->ignore(); +} + //--------------------------------------------------------------------------------------------------------------------- QColor VSimpleCurve::CorrectColor(const QColor &color) const { diff --git a/src/app/visualization/vsimplecurve.h b/src/app/visualization/vsimplecurve.h index a013727c2..96cefdca2 100644 --- a/src/app/visualization/vsimplecurve.h +++ b/src/app/visualization/vsimplecurve.h @@ -60,6 +60,7 @@ signals: void Choosed(quint32 id); void HoverPath(quint32 id, SimpleCurvePoint curvePosition, PathDirection direction); protected: + virtual void mousePressEvent(QGraphicsSceneMouseEvent * event); virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ); virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event ); virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event );