Fixed resizing scene when move detail.
When first time create detail MoveDetail class gets wrong scene pointer and this cause refreshing wrong scene. --HG-- branch : develop
This commit is contained in:
parent
bd7f328a8a
commit
eec1240da0
|
@ -378,7 +378,7 @@ QVariant VToolDetail::itemChange(QGraphicsItem::GraphicsItemChange change, const
|
||||||
// value - this is new position.
|
// value - this is new position.
|
||||||
const QPointF newPos = value.toPointF();
|
const QPointF newPos = value.toPointF();
|
||||||
|
|
||||||
MoveDetail *moveDet = new MoveDetail(doc, newPos.x(), newPos.y(), id);
|
MoveDetail *moveDet = new MoveDetail(doc, newPos.x(), newPos.y(), id, scene());
|
||||||
connect(moveDet, &MoveDetail::NeedLiteParsing, doc, &VAbstractPattern::LiteParseTree);
|
connect(moveDet, &MoveDetail::NeedLiteParsing, doc, &VAbstractPattern::LiteParseTree);
|
||||||
qApp->getUndoStack()->push(moveDet);
|
qApp->getUndoStack()->push(moveDet);
|
||||||
|
|
||||||
|
|
|
@ -35,8 +35,8 @@
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
MoveDetail::MoveDetail(VAbstractPattern *doc, const double &x, const double &y, const quint32 &id,
|
MoveDetail::MoveDetail(VAbstractPattern *doc, const double &x, const double &y, const quint32 &id,
|
||||||
QUndoCommand *parent)
|
QGraphicsScene *scene, QUndoCommand *parent)
|
||||||
: VUndoCommand(QDomElement(), doc, parent), oldX(0.0), oldY(0.0), newX(x), newY(y), scene(qApp->getCurrentScene())
|
: VUndoCommand(QDomElement(), doc, parent), oldX(0.0), oldY(0.0), newX(x), newY(y), scene(scene)
|
||||||
{
|
{
|
||||||
setText(QObject::tr("move detail"));
|
setText(QObject::tr("move detail"));
|
||||||
nodeId = id;
|
nodeId = id;
|
||||||
|
|
|
@ -37,7 +37,7 @@ class MoveDetail : public VUndoCommand
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
MoveDetail(VAbstractPattern *doc, const double &x, const double &y, const quint32 &id,
|
MoveDetail(VAbstractPattern *doc, const double &x, const double &y, const quint32 &id, QGraphicsScene *scene,
|
||||||
QUndoCommand *parent = 0);
|
QUndoCommand *parent = 0);
|
||||||
virtual ~MoveDetail() Q_DECL_OVERRIDE;
|
virtual ~MoveDetail() Q_DECL_OVERRIDE;
|
||||||
virtual void undo() Q_DECL_OVERRIDE;
|
virtual void undo() Q_DECL_OVERRIDE;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user