diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolbasepoint.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolbasepoint.cpp index 6446f41ce..8900e3b83 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolbasepoint.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolbasepoint.cpp @@ -153,6 +153,13 @@ QVariant VToolBasePoint::itemChange(QGraphicsItem::GraphicsItemChange change, co MoveSPoint *moveSP = new MoveSPoint(doc, newPos.x(), newPos.y(), id, this->scene()); connect(moveSP, &MoveSPoint::NeedLiteParsing, doc, &VAbstractPattern::LiteParseTree); qApp->getUndoStack()->push(moveSP); + if (scene()) + { + if (QGraphicsView *view = scene()->views().at(0)) + { + view->ensureVisible(this); + } + } changeFinished = true; } } diff --git a/src/libs/vwidgets/vcontrolpointspline.cpp b/src/libs/vwidgets/vcontrolpointspline.cpp index d4ac1c088..7ab55a10b 100644 --- a/src/libs/vwidgets/vcontrolpointspline.cpp +++ b/src/libs/vwidgets/vcontrolpointspline.cpp @@ -29,6 +29,7 @@ #include "vcontrolpointspline.h" #include +#include #include #include @@ -129,6 +130,13 @@ QVariant VControlPointSpline::itemChange(QGraphicsItem::GraphicsItemChange chang // value - new position. QPointF newPos = value.toPointF(); emit ControlPointChangePosition(indexSpline, position, newPos); + if (scene()) + { + if (QGraphicsView *view = scene()->views().at(0)) + { + view->ensureVisible(this); + } + } changeFinished = false; } } diff --git a/src/libs/vwidgets/vgraphicssimpletextitem.cpp b/src/libs/vwidgets/vgraphicssimpletextitem.cpp index 963197bc4..028cd3acf 100644 --- a/src/libs/vwidgets/vgraphicssimpletextitem.cpp +++ b/src/libs/vwidgets/vgraphicssimpletextitem.cpp @@ -34,6 +34,7 @@ #include #include #include +#include //--------------------------------------------------------------------------------------------------------------------- /** @@ -123,6 +124,13 @@ QVariant VGraphicsSimpleTextItem::itemChange(GraphicsItemChange change, const QV changeFinished = false; QPointF newPos = value.toPointF() + this->parentItem()->pos(); emit NameChangePosition(newPos); + if (scene()) + { + if (QGraphicsView *view = scene()->views().at(0)) + { + view->ensureVisible(this); + } + } changeFinished = true; } } diff --git a/src/libs/vwidgets/vmaingraphicsview.h b/src/libs/vwidgets/vmaingraphicsview.h index 755bbd909..4ad9462bd 100644 --- a/src/libs/vwidgets/vmaingraphicsview.h +++ b/src/libs/vwidgets/vmaingraphicsview.h @@ -125,8 +125,8 @@ public slots: void ZoomOriginal(); void ZoomFitBest(); protected: - void mousePressEvent(QMouseEvent *mousePress); - void mouseReleaseEvent(QMouseEvent *event); + virtual void mousePressEvent(QMouseEvent *mousePress) Q_DECL_OVERRIDE; + virtual void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE; private: Q_DISABLE_COPY(VMainGraphicsView) GraphicsViewZoom* zoom;