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:
Roman Telezhynskyi 2016-07-07 15:38:55 +03:00
parent bd7f328a8a
commit eec1240da0
3 changed files with 4 additions and 4 deletions

View File

@ -378,7 +378,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);
MoveDetail *moveDet = new MoveDetail(doc, newPos.x(), newPos.y(), id, scene());
connect(moveDet, &MoveDetail::NeedLiteParsing, doc, &VAbstractPattern::LiteParseTree);
qApp->getUndoStack()->push(moveDet);

View File

@ -35,8 +35,8 @@
//---------------------------------------------------------------------------------------------------------------------
MoveDetail::MoveDetail(VAbstractPattern *doc, const double &x, const double &y, const quint32 &id,
QUndoCommand *parent)
: VUndoCommand(QDomElement(), doc, parent), oldX(0.0), oldY(0.0), newX(x), newY(y), scene(qApp->getCurrentScene())
QGraphicsScene *scene, QUndoCommand *parent)
: VUndoCommand(QDomElement(), doc, parent), oldX(0.0), oldY(0.0), newX(x), newY(y), scene(scene)
{
setText(QObject::tr("move detail"));
nodeId = id;

View File

@ -37,7 +37,7 @@ class MoveDetail : public VUndoCommand
{
Q_OBJECT
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);
virtual ~MoveDetail() Q_DECL_OVERRIDE;
virtual void undo() Q_DECL_OVERRIDE;