From 3df6c09934573e82a76fe319133907456ae63900 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Fri, 27 Oct 2017 10:36:55 +0300 Subject: [PATCH] Optimize adjusting scene rect after moving label. --HG-- branch : develop --- .../tools/drawTools/operation/vabstractoperation.cpp | 5 +++++ .../toolpoint/tooldoublepoint/vtooldoublepoint.cpp | 10 ++++++++++ .../toolpoint/toolsinglepoint/vtoolsinglepoint.cpp | 5 +++++ src/libs/vtools/tools/nodeDetails/vnodepoint.cpp | 5 +++++ src/libs/vtools/undocommands/label/movedoublelabel.cpp | 1 - src/libs/vtools/undocommands/label/movelabel.cpp | 1 - .../vtools/undocommands/label/operationmovelabel.cpp | 1 - 7 files changed, 25 insertions(+), 3 deletions(-) diff --git a/src/libs/vtools/tools/drawTools/operation/vabstractoperation.cpp b/src/libs/vtools/tools/drawTools/operation/vabstractoperation.cpp index 16eb41479..247690da5 100644 --- a/src/libs/vtools/tools/drawTools/operation/vabstractoperation.cpp +++ b/src/libs/vtools/tools/drawTools/operation/vabstractoperation.cpp @@ -99,6 +99,11 @@ void VAbstractOperation::ChangeLabelPosition(quint32 id, const QPointF &pos) point->setMx(pos.x()); point->setMy(pos.y()); item->RefreshPointGeometry(*(point.data())); + + if (QGraphicsScene *sc = scene()) + { + VMainGraphicsView::NewSceneRect(sc, qApp->getSceneView(), item); + } } } } diff --git a/src/libs/vtools/tools/drawTools/toolpoint/tooldoublepoint/vtooldoublepoint.cpp b/src/libs/vtools/tools/drawTools/toolpoint/tooldoublepoint/vtooldoublepoint.cpp index a8025c93b..cc5cfef51 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/tooldoublepoint/vtooldoublepoint.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/tooldoublepoint/vtooldoublepoint.cpp @@ -228,6 +228,11 @@ void VToolDoublePoint::ChangeLabelPosition(quint32 id, const QPointF &pos) point->setMx(pos.x()); point->setMy(pos.y()); firstPoint->RefreshPointGeometry(*(point.data())); + + if (QGraphicsScene *sc = scene()) + { + VMainGraphicsView::NewSceneRect(sc, qApp->getSceneView(), firstPoint); + } } else if (id == p2id) { @@ -235,6 +240,11 @@ void VToolDoublePoint::ChangeLabelPosition(quint32 id, const QPointF &pos) point->setMx(pos.x()); point->setMy(pos.y()); secondPoint->RefreshPointGeometry(*(point.data())); + + if (QGraphicsScene *sc = scene()) + { + VMainGraphicsView::NewSceneRect(sc, qApp->getSceneView(), secondPoint); + } } } diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolsinglepoint.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolsinglepoint.cpp index b0b212de5..76dafd22c 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolsinglepoint.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolsinglepoint.cpp @@ -335,6 +335,11 @@ void VToolSinglePoint::ChangeLabelPosition(quint32 id, const QPointF &pos) m_namePoint->setPos(pos); m_namePoint->blockSignals(false); RefreshLine(); + + if (QGraphicsScene *sc = scene()) + { + VMainGraphicsView::NewSceneRect(sc, qApp->getSceneView(), this); + } } } diff --git a/src/libs/vtools/tools/nodeDetails/vnodepoint.cpp b/src/libs/vtools/tools/nodeDetails/vnodepoint.cpp index 864e89adf..7ce3fa03a 100644 --- a/src/libs/vtools/tools/nodeDetails/vnodepoint.cpp +++ b/src/libs/vtools/tools/nodeDetails/vnodepoint.cpp @@ -51,6 +51,7 @@ #include "../vmisc/vabstractapplication.h" #include "../vpatterndb/vcontainer.h" #include "../vwidgets/vmaingraphicsscene.h" +#include "../vwidgets/vmaingraphicsview.h" #include "../vabstracttool.h" #include "../vdatatool.h" #include "vabstractnode.h" @@ -139,6 +140,10 @@ void VNodePoint::ChangeLabelPosition(quint32 id, const QPointF &pos) m_namePoint->setPos(pos); m_namePoint->blockSignals(false); RefreshLine(); + if (QGraphicsScene *sc = scene()) + { + VMainGraphicsView::NewSceneRect(sc, qApp->getSceneView(), this); + } } } diff --git a/src/libs/vtools/undocommands/label/movedoublelabel.cpp b/src/libs/vtools/undocommands/label/movedoublelabel.cpp index 8cc724ecc..4ff3ff916 100644 --- a/src/libs/vtools/undocommands/label/movedoublelabel.cpp +++ b/src/libs/vtools/undocommands/label/movedoublelabel.cpp @@ -148,7 +148,6 @@ void MoveDoubleLabel::Do(const QPointF &pos) { tool->ChangeLabelPosition(nodeId, pos); } - VMainGraphicsView::NewSceneRect(m_scene, qApp->getSceneView()); } else { diff --git a/src/libs/vtools/undocommands/label/movelabel.cpp b/src/libs/vtools/undocommands/label/movelabel.cpp index 46ae8e487..a70484ddf 100644 --- a/src/libs/vtools/undocommands/label/movelabel.cpp +++ b/src/libs/vtools/undocommands/label/movelabel.cpp @@ -102,7 +102,6 @@ void MoveLabel::Do(const QPointF &pos) { tool->ChangeLabelPosition(nodeId, pos); } - VMainGraphicsView::NewSceneRect(m_scene, qApp->getSceneView()); } else { diff --git a/src/libs/vtools/undocommands/label/operationmovelabel.cpp b/src/libs/vtools/undocommands/label/operationmovelabel.cpp index cd3cea064..b2f295551 100644 --- a/src/libs/vtools/undocommands/label/operationmovelabel.cpp +++ b/src/libs/vtools/undocommands/label/operationmovelabel.cpp @@ -106,7 +106,6 @@ void OperationMoveLabel::Do(const QPointF &pos) { tool->ChangeLabelPosition(nodeId, pos); } - VMainGraphicsView::NewSceneRect(m_scene, qApp->getSceneView()); } else {