Skip to content

Commit

Permalink
Fix model designer jumps around scene after changing components
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Apr 14, 2020
1 parent 190907b commit 5792296
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/gui/processing/models/qgsmodeldesignerdialog.cpp
Expand Up @@ -418,7 +418,9 @@ void QgsModelDesignerDialog::setModelScene( QgsModelGraphicsScene *scene )
mScene->setParent( this );
mScene->setChildAlgorithmResults( mChildResults );
mScene->setModel( mModel.get() );
mScene->setMessageBar( mMessageBar );

const QPointF center = mView->mapToScene( mView->viewport()->rect().center() );
mView->setModelScene( mScene );

mSelectTool->resetCache();
Expand All @@ -434,6 +436,8 @@ void QgsModelDesignerDialog::setModelScene( QgsModelGraphicsScene *scene )
connect( mScene, &QgsModelGraphicsScene::componentAboutToChange, this, [ = ]( const QString & description, int id ) { beginUndoCommand( description, id ); } );
connect( mScene, &QgsModelGraphicsScene::componentChanged, this, [ = ] { endUndoCommand(); } );

mView->centerOn( center );

if ( oldScene )
oldScene->deleteLater();
}
Expand Down

0 comments on commit 5792296

Please sign in to comment.