Optimize adjusting scene rect after moving label.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2017-10-27 10:36:55 +03:00
parent d61f732bde
commit 3df6c09934
7 changed files with 25 additions and 3 deletions

View File

@ -99,6 +99,11 @@ void VAbstractOperation::ChangeLabelPosition(quint32 id, const QPointF &pos)
point->setMx(pos.x()); point->setMx(pos.x());
point->setMy(pos.y()); point->setMy(pos.y());
item->RefreshPointGeometry(*(point.data())); item->RefreshPointGeometry(*(point.data()));
if (QGraphicsScene *sc = scene())
{
VMainGraphicsView::NewSceneRect(sc, qApp->getSceneView(), item);
}
} }
} }
} }

View File

@ -228,6 +228,11 @@ void VToolDoublePoint::ChangeLabelPosition(quint32 id, const QPointF &pos)
point->setMx(pos.x()); point->setMx(pos.x());
point->setMy(pos.y()); point->setMy(pos.y());
firstPoint->RefreshPointGeometry(*(point.data())); firstPoint->RefreshPointGeometry(*(point.data()));
if (QGraphicsScene *sc = scene())
{
VMainGraphicsView::NewSceneRect(sc, qApp->getSceneView(), firstPoint);
}
} }
else if (id == p2id) else if (id == p2id)
{ {
@ -235,6 +240,11 @@ void VToolDoublePoint::ChangeLabelPosition(quint32 id, const QPointF &pos)
point->setMx(pos.x()); point->setMx(pos.x());
point->setMy(pos.y()); point->setMy(pos.y());
secondPoint->RefreshPointGeometry(*(point.data())); secondPoint->RefreshPointGeometry(*(point.data()));
if (QGraphicsScene *sc = scene())
{
VMainGraphicsView::NewSceneRect(sc, qApp->getSceneView(), secondPoint);
}
} }
} }

View File

@ -335,6 +335,11 @@ void VToolSinglePoint::ChangeLabelPosition(quint32 id, const QPointF &pos)
m_namePoint->setPos(pos); m_namePoint->setPos(pos);
m_namePoint->blockSignals(false); m_namePoint->blockSignals(false);
RefreshLine(); RefreshLine();
if (QGraphicsScene *sc = scene())
{
VMainGraphicsView::NewSceneRect(sc, qApp->getSceneView(), this);
}
} }
} }

View File

@ -51,6 +51,7 @@
#include "../vmisc/vabstractapplication.h" #include "../vmisc/vabstractapplication.h"
#include "../vpatterndb/vcontainer.h" #include "../vpatterndb/vcontainer.h"
#include "../vwidgets/vmaingraphicsscene.h" #include "../vwidgets/vmaingraphicsscene.h"
#include "../vwidgets/vmaingraphicsview.h"
#include "../vabstracttool.h" #include "../vabstracttool.h"
#include "../vdatatool.h" #include "../vdatatool.h"
#include "vabstractnode.h" #include "vabstractnode.h"
@ -139,6 +140,10 @@ void VNodePoint::ChangeLabelPosition(quint32 id, const QPointF &pos)
m_namePoint->setPos(pos); m_namePoint->setPos(pos);
m_namePoint->blockSignals(false); m_namePoint->blockSignals(false);
RefreshLine(); RefreshLine();
if (QGraphicsScene *sc = scene())
{
VMainGraphicsView::NewSceneRect(sc, qApp->getSceneView(), this);
}
} }
} }

View File

@ -148,7 +148,6 @@ void MoveDoubleLabel::Do(const QPointF &pos)
{ {
tool->ChangeLabelPosition(nodeId, pos); tool->ChangeLabelPosition(nodeId, pos);
} }
VMainGraphicsView::NewSceneRect(m_scene, qApp->getSceneView());
} }
else else
{ {

View File

@ -102,7 +102,6 @@ void MoveLabel::Do(const QPointF &pos)
{ {
tool->ChangeLabelPosition(nodeId, pos); tool->ChangeLabelPosition(nodeId, pos);
} }
VMainGraphicsView::NewSceneRect(m_scene, qApp->getSceneView());
} }
else else
{ {

View File

@ -106,7 +106,6 @@ void OperationMoveLabel::Do(const QPointF &pos)
{ {
tool->ChangeLabelPosition(nodeId, pos); tool->ChangeLabelPosition(nodeId, pos);
} }
VMainGraphicsView::NewSceneRect(m_scene, qApp->getSceneView());
} }
else else
{ {