diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolspline.cpp b/src/libs/vtools/tools/drawTools/toolcurve/vtoolspline.cpp index e7e0f0170..6af2977e2 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolspline.cpp +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolspline.cpp @@ -426,6 +426,27 @@ void VToolSpline::mouseMoveEvent(QGraphicsSceneMouseEvent *event) MoveSpline *moveSpl = new MoveSpline(doc, spline.data(), spl, id, this->scene()); connect(moveSpl, &MoveSpline::NeedLiteParsing, doc, &VAbstractPattern::LiteParseTree); qApp->getUndoStack()->push(moveSpl); + + // Each time we move something we call recalculation scene rect. In some cases this can cause moving + // objects positions. And this cause infinite redrawing. That's why we wait the finish of saving the last move. + static bool changeFinished = true; + if (changeFinished) + { + changeFinished = false; + + const QList viewList = scene()->views(); + if (not viewList.isEmpty()) + { + if (QGraphicsView *view = viewList.at(0)) + { + VMainGraphicsScene *currentScene = qobject_cast(scene()); + SCASSERT(currentScene); + const QPointF cursorPosition = currentScene->getScenePos(); + view->ensureVisible(QRectF(cursorPosition.x()-5, cursorPosition.y()-5, 10, 10)); + } + } + changeFinished = true; + } } //--------------------------------------------------------------------------------------------------------------------- @@ -513,28 +534,6 @@ void VToolSpline::RefreshGeometry() SetVisualization(); - // Each time we move something we call recalculation scene rect. In some cases this can cause moving - // objects positions. And this cause infinite redrawing. That's why we wait the finish of saving the last move. - static bool changeFinished = true; - if (changeFinished) - { - changeFinished = false; - - const QList viewList = scene()->views(); - if (not viewList.isEmpty()) - { - if (QGraphicsView *view = viewList.at(0)) - { - VMainGraphicsScene *currentScene = qobject_cast(scene()); - SCASSERT(currentScene); - const QPointF cursorPosition = currentScene->getScenePos(); - view->ensureVisible(QRectF(cursorPosition.x()-50, cursorPosition.y()-50, 100, 100)); - } - } - - changeFinished = true; - } - foreach (VControlPointSpline *point, controlPoints) { point->setFlag(QGraphicsItem::ItemSendsGeometryChanges, true); diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolsplinepath.cpp b/src/libs/vtools/tools/drawTools/toolcurve/vtoolsplinepath.cpp index dc67d767f..235fe3472 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolsplinepath.cpp +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolsplinepath.cpp @@ -503,6 +503,27 @@ void VToolSplinePath::mouseMoveEvent(QGraphicsSceneMouseEvent *event) MoveSplinePath *moveSplPath = new MoveSplinePath(doc, oldSplPath, newSplPath, id, this->scene()); connect(moveSplPath, &VUndoCommand::NeedLiteParsing, doc, &VAbstractPattern::LiteParseTree); qApp->getUndoStack()->push(moveSplPath); + + // Each time we move something we call recalculation scene rect. In some cases this can cause moving + // objects positions. And this cause infinite redrawing. That's why we wait the finish of saving the last move. + static bool changeFinished = true; + if (changeFinished) + { + changeFinished = false; + + const QList viewList = scene()->views(); + if (not viewList.isEmpty()) + { + if (QGraphicsView *view = viewList.at(0)) + { + VMainGraphicsScene *currentScene = qobject_cast(scene()); + SCASSERT(currentScene); + const QPointF cursorPosition = currentScene->getScenePos(); + view->ensureVisible(QRectF(cursorPosition.x()-5, cursorPosition.y()-5, 10, 10)); + } + } + changeFinished = true; + } } //--------------------------------------------------------------------------------------------------------------------- @@ -590,28 +611,6 @@ void VToolSplinePath::RefreshGeometry() SetVisualization(); - // Each time we move something we call recalculation scene rect. In some cases this can cause moving - // objects positions. And this cause infinite redrawing. That's why we wait the finish of saving the last move. - static bool changeFinished = true; - if (changeFinished) - { - changeFinished = false; - - const QList viewList = scene()->views(); - if (not viewList.isEmpty()) - { - if (QGraphicsView *view = viewList.at(0)) - { - VMainGraphicsScene *currentScene = qobject_cast(scene()); - SCASSERT(currentScene); - const QPointF cursorPosition = currentScene->getScenePos(); - view->ensureVisible(QRectF(cursorPosition.x()-50, cursorPosition.y()-50, 100, 100)); - } - } - - changeFinished = true; - } - foreach (VControlPointSpline *point, controlPoints) { point->setFlag(QGraphicsItem::ItemSendsGeometryChanges, true); diff --git a/src/libs/vwidgets/vmaingraphicsview.cpp b/src/libs/vwidgets/vmaingraphicsview.cpp index 6fb6e3e52..b889dc853 100644 --- a/src/libs/vwidgets/vmaingraphicsview.cpp +++ b/src/libs/vwidgets/vmaingraphicsview.cpp @@ -369,10 +369,5 @@ void VMainGraphicsView::NewSceneRect(QGraphicsScene *sc, QGraphicsView *view) const QRectF itemsRect = currentScene->VisibleItemsBoundingRect(); //Unite two rects - const QRectF newRect = itemsRect.united(viewRect); - - if (newRect != itemsRect) - {//Update if only need - sc->setSceneRect(newRect); - } + sc->setSceneRect(itemsRect.united(viewRect)); }