Moving labels and curves did not call resizing scene.
--HG-- branch : develop
This commit is contained in:
parent
7aca6d8179
commit
b05da647fe
|
@ -247,7 +247,7 @@ void VToolSpline::ControlPointChangePosition(const qint32 &indexSpline, const Sp
|
|||
const QSharedPointer<VSpline> spline = VAbstractTool::data.GeometricObject<VSpline>(id);
|
||||
const VSpline spl = CorrectedSpline(*spline, position, pos);
|
||||
|
||||
MoveSpline *moveSpl = new MoveSpline(doc, spline.data(), spl, id, this->scene());
|
||||
MoveSpline *moveSpl = new MoveSpline(doc, spline.data(), spl, id);
|
||||
connect(moveSpl, &MoveSpline::NeedLiteParsing, doc, &VAbstractPattern::LiteParseTree);
|
||||
qApp->getUndoStack()->push(moveSpl);
|
||||
}
|
||||
|
@ -407,7 +407,7 @@ void VToolSpline::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
|||
|
||||
VSpline spl = VSpline(spline->GetP1(), p2, p3, spline->GetP4());
|
||||
|
||||
MoveSpline *moveSpl = new MoveSpline(doc, spline.data(), spl, id, this->scene());
|
||||
MoveSpline *moveSpl = new MoveSpline(doc, spline.data(), spl, id);
|
||||
connect(moveSpl, &MoveSpline::NeedLiteParsing, doc, &VAbstractPattern::LiteParseTree);
|
||||
qApp->getUndoStack()->push(moveSpl);
|
||||
|
||||
|
|
|
@ -230,7 +230,7 @@ void VToolSplinePath::ControlPointChangePosition(const qint32 &indexSpline, cons
|
|||
const VSpline spl = CorrectedSpline(newSplPath.GetSpline(indexSpline), position, pos);
|
||||
UpdateControlPoints(spl, newSplPath, indexSpline);
|
||||
|
||||
MoveSplinePath *moveSplPath = new MoveSplinePath(doc, oldSplPath, newSplPath, id, this->scene());
|
||||
MoveSplinePath *moveSplPath = new MoveSplinePath(doc, oldSplPath, newSplPath, id);
|
||||
connect(moveSplPath, &VUndoCommand::NeedLiteParsing, doc, &VAbstractPattern::LiteParseTree);
|
||||
qApp->getUndoStack()->push(moveSplPath);
|
||||
}
|
||||
|
@ -521,7 +521,7 @@ void VToolSplinePath::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
|||
|
||||
UpdateControlPoints(spl, newSplPath, splIndex);
|
||||
|
||||
MoveSplinePath *moveSplPath = new MoveSplinePath(doc, oldSplPath, newSplPath, id, this->scene());
|
||||
MoveSplinePath *moveSplPath = new MoveSplinePath(doc, oldSplPath, newSplPath, id);
|
||||
connect(moveSplPath, &VUndoCommand::NeedLiteParsing, doc, &VAbstractPattern::LiteParseTree);
|
||||
qApp->getUndoStack()->push(moveSplPath);
|
||||
|
||||
|
|
|
@ -376,7 +376,7 @@ QVariant VToolDetail::itemChange(QGraphicsItem::GraphicsItemChange change, const
|
|||
// value - this is new position.
|
||||
const QPointF newPos = value.toPointF();
|
||||
|
||||
MoveDetail *moveDet = new MoveDetail(doc, newPos.x(), newPos.y(), id, scene());
|
||||
MoveDetail *moveDet = new MoveDetail(doc, newPos.x(), newPos.y(), id);
|
||||
connect(moveDet, &MoveDetail::NeedLiteParsing, doc, &VAbstractPattern::LiteParseTree);
|
||||
qApp->getUndoStack()->push(moveDet);
|
||||
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
*************************************************************************/
|
||||
|
||||
#include "moveabstractlabel.h"
|
||||
#include "../vwidgets/vmaingraphicsview.h"
|
||||
#include "../vmisc/vabstractapplication.h"
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
MoveAbstractLabel::MoveAbstractLabel(VAbstractPattern *doc, quint32 pointId, double x, double y,
|
||||
|
@ -36,7 +38,8 @@ MoveAbstractLabel::MoveAbstractLabel(VAbstractPattern *doc, quint32 pointId, dou
|
|||
m_oldMy(0.0),
|
||||
m_newMx(x),
|
||||
m_newMy(y),
|
||||
m_isRedo(false)
|
||||
m_isRedo(false),
|
||||
m_scene(qApp->getCurrentScene())
|
||||
{
|
||||
nodeId = pointId;
|
||||
qCDebug(vUndo, "Point id %u", nodeId);
|
||||
|
@ -56,6 +59,7 @@ void MoveAbstractLabel::undo()
|
|||
qCDebug(vUndo, "Undo.");
|
||||
|
||||
Do(m_oldMx, m_oldMy);
|
||||
VMainGraphicsView::NewSceneRect(m_scene, qApp->getSceneView());
|
||||
m_isRedo = true;
|
||||
emit ChangePosition(nodeId, m_oldMx, m_oldMy);
|
||||
}
|
||||
|
@ -66,6 +70,7 @@ void MoveAbstractLabel::redo()
|
|||
qCDebug(vUndo, "Redo.");
|
||||
|
||||
Do(m_newMx, m_newMy);
|
||||
VMainGraphicsView::NewSceneRect(m_scene, qApp->getSceneView());
|
||||
if (m_isRedo)
|
||||
{
|
||||
emit ChangePosition(nodeId, m_newMx, m_newMy);
|
||||
|
|
|
@ -31,6 +31,9 @@
|
|||
|
||||
#include "../vundocommand.h"
|
||||
|
||||
class QGraphicsScene;
|
||||
class QGraphicsView;
|
||||
|
||||
class MoveAbstractLabel : public VUndoCommand
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@ -53,6 +56,8 @@ protected:
|
|||
double m_newMx;
|
||||
double m_newMy;
|
||||
bool m_isRedo;
|
||||
//Need for resizing scene rect
|
||||
QGraphicsScene *m_scene;
|
||||
|
||||
virtual void Do(double mx, double my)=0;
|
||||
private:
|
||||
|
|
|
@ -28,15 +28,15 @@
|
|||
|
||||
#include "movedetail.h"
|
||||
#include "../tools/vabstracttool.h"
|
||||
#include "../../vwidgets/vmaingraphicsview.h"
|
||||
#include "../vwidgets/vmaingraphicsview.h"
|
||||
|
||||
#include <QGraphicsScene>
|
||||
#include <QDomElement>
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
MoveDetail::MoveDetail(VAbstractPattern *doc, const double &x, const double &y, const quint32 &id,
|
||||
QGraphicsScene *scene, QUndoCommand *parent)
|
||||
: VUndoCommand(QDomElement(), doc, parent), oldX(0.0), oldY(0.0), newX(x), newY(y), scene(scene)
|
||||
QUndoCommand *parent)
|
||||
: VUndoCommand(QDomElement(), doc, parent), oldX(0.0), oldY(0.0), newX(x), newY(y), scene(qApp->getCurrentScene())
|
||||
{
|
||||
setText(QObject::tr("move detail"));
|
||||
nodeId = id;
|
||||
|
|
|
@ -37,7 +37,7 @@ class MoveDetail : public VUndoCommand
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
MoveDetail(VAbstractPattern *doc, const double &x, const double &y, const quint32 &id, QGraphicsScene *scene,
|
||||
MoveDetail(VAbstractPattern *doc, const double &x, const double &y, const quint32 &id,
|
||||
QUndoCommand *parent = 0);
|
||||
virtual ~MoveDetail() Q_DECL_OVERRIDE;
|
||||
virtual void undo() Q_DECL_OVERRIDE;
|
||||
|
|
|
@ -28,15 +28,18 @@
|
|||
|
||||
#include "movespline.h"
|
||||
#include "../tools/vabstracttool.h"
|
||||
#include "../../vwidgets/vmaingraphicsview.h"
|
||||
#include "../vwidgets/vmaingraphicsview.h"
|
||||
|
||||
#include <QDomElement>
|
||||
#include <QGraphicsView>
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
MoveSpline::MoveSpline(VAbstractPattern *doc, const VSpline *oldSpl, const VSpline &newSpl, const quint32 &id,
|
||||
QGraphicsScene *scene, QUndoCommand *parent)
|
||||
: VUndoCommand(QDomElement(), doc, parent), oldSpline(*oldSpl), newSpline(newSpl), scene(scene)
|
||||
QUndoCommand *parent)
|
||||
: VUndoCommand(QDomElement(), doc, parent),
|
||||
oldSpline(*oldSpl),
|
||||
newSpline(newSpl),
|
||||
scene(qApp->getCurrentScene())
|
||||
{
|
||||
setText(tr("move spline"));
|
||||
nodeId = id;
|
||||
|
@ -54,6 +57,7 @@ void MoveSpline::undo()
|
|||
qCDebug(vUndo, "Undo.");
|
||||
|
||||
Do(oldSpline);
|
||||
VMainGraphicsView::NewSceneRect(scene, qApp->getSceneView());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -62,6 +66,7 @@ void MoveSpline::redo()
|
|||
qCDebug(vUndo, "Redo.");
|
||||
|
||||
Do(newSpline);
|
||||
VMainGraphicsView::NewSceneRect(scene, qApp->getSceneView());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -39,7 +39,7 @@ class MoveSpline : public VUndoCommand
|
|||
Q_OBJECT
|
||||
public:
|
||||
MoveSpline(VAbstractPattern *doc, const VSpline *oldSpl, const VSpline &spl, const quint32 &id,
|
||||
QGraphicsScene *scene, QUndoCommand *parent = 0);
|
||||
QUndoCommand *parent = nullptr);
|
||||
virtual ~MoveSpline() Q_DECL_OVERRIDE;
|
||||
virtual void undo() Q_DECL_OVERRIDE;
|
||||
virtual void redo() Q_DECL_OVERRIDE;
|
||||
|
|
|
@ -32,8 +32,11 @@
|
|||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
MoveSplinePath::MoveSplinePath(VAbstractPattern *doc, const VSplinePath &oldSplPath, const VSplinePath &newSplPath,
|
||||
const quint32 &id, QGraphicsScene *scene, QUndoCommand *parent)
|
||||
: VUndoCommand(QDomElement(), doc, parent), oldSplinePath(oldSplPath), newSplinePath(newSplPath), scene(scene)
|
||||
const quint32 &id, QUndoCommand *parent)
|
||||
: VUndoCommand(QDomElement(), doc, parent),
|
||||
oldSplinePath(oldSplPath),
|
||||
newSplinePath(newSplPath),
|
||||
scene(qApp->getCurrentScene())
|
||||
{
|
||||
setText(tr("move spline path"));
|
||||
nodeId = id;
|
||||
|
@ -51,6 +54,7 @@ void MoveSplinePath::undo()
|
|||
qCDebug(vUndo, "Undo.");
|
||||
|
||||
Do(oldSplinePath);
|
||||
VMainGraphicsView::NewSceneRect(scene, qApp->getSceneView());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -59,6 +63,7 @@ void MoveSplinePath::redo()
|
|||
qCDebug(vUndo, "Redo.");
|
||||
|
||||
Do(newSplinePath);
|
||||
VMainGraphicsView::NewSceneRect(scene, qApp->getSceneView());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -39,7 +39,7 @@ class MoveSplinePath : public VUndoCommand
|
|||
Q_OBJECT
|
||||
public:
|
||||
MoveSplinePath(VAbstractPattern *doc, const VSplinePath &oldSplPath, const VSplinePath &newSplPath,
|
||||
const quint32 &id, QGraphicsScene *scene, QUndoCommand *parent = 0);
|
||||
const quint32 &id, QUndoCommand *parent = nullptr);
|
||||
virtual ~MoveSplinePath() Q_DECL_OVERRIDE;
|
||||
virtual void undo() Q_DECL_OVERRIDE;
|
||||
virtual void redo() Q_DECL_OVERRIDE;
|
||||
|
|
Loading…
Reference in New Issue
Block a user