The program crashes if scene is not connected to view.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2015-12-05 18:27:38 +02:00
parent 830c43a89d
commit a820b20fc2
3 changed files with 18 additions and 6 deletions

View File

@ -140,9 +140,13 @@ QVariant VToolBasePoint::itemChange(QGraphicsItem::GraphicsItemChange change, co
MoveSPoint *moveSP = new MoveSPoint(doc, newPos.x(), newPos.y(), id, this->scene());
connect(moveSP, &MoveSPoint::NeedLiteParsing, doc, &VAbstractPattern::LiteParseTree);
qApp->getUndoStack()->push(moveSP);
if (QGraphicsView *view = scene()->views().at(0))
const QList<QGraphicsView *> viewList = scene()->views();
if (not viewList.isEmpty())
{
view->ensureVisible(this);
if (QGraphicsView *view = viewList.at(0))
{
view->ensureVisible(this);
}
}
changeFinished = true;
}

View File

@ -132,9 +132,13 @@ QVariant VControlPointSpline::itemChange(QGraphicsItem::GraphicsItemChange chang
emit ControlPointChangePosition(indexSpline, position, newPos);
if (scene())
{
if (QGraphicsView *view = scene()->views().at(0))
const QList<QGraphicsView *> viewList = scene()->views();
if (not viewList.isEmpty())
{
view->ensureVisible(this);
if (QGraphicsView *view = viewList.at(0))
{
view->ensureVisible(this);
}
}
}
changeFinished = true;

View File

@ -126,9 +126,13 @@ QVariant VGraphicsSimpleTextItem::itemChange(GraphicsItemChange change, const QV
emit NameChangePosition(newPos);
if (scene())
{
if (QGraphicsView *view = scene()->views().at(0))
const QList<QGraphicsView *> viewList = scene()->views();
if (not viewList.isEmpty())
{
view->ensureVisible(this);
if (QGraphicsView *view = viewList.at(0))
{
view->ensureVisible(this);
}
}
}
changeFinished = true;