Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Rebase fixes
  • Loading branch information
nyalldawson committed Mar 12, 2020
1 parent 3918f01 commit 5149f0b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
6 changes: 0 additions & 6 deletions python/plugins/processing/modeler/ModelerDialog.py
Expand Up @@ -206,12 +206,6 @@ def repaintModel(self, showControls=True):
scene.createItems(self.model(), context)
self.setModelScene(scene)

def componentAboutToChange(self, description, id):
self.beginUndoCommand(description, id)

def componentChanged(self):
self.endUndoCommand()

def create_widget_context(self):
"""
Returns a new widget context for use in the model editor
Expand Down
11 changes: 7 additions & 4 deletions src/gui/processing/models/qgsmodelcomponentgraphicitem.cpp
Expand Up @@ -94,6 +94,9 @@ QgsProcessingModelAlgorithm *QgsModelComponentGraphicItem::model()

QgsModelGraphicsView *QgsModelComponentGraphicItem::view()
{
if ( scene()->views().isEmpty() )
return nullptr;

return qobject_cast< QgsModelGraphicsView * >( scene()->views().first() );
}

Expand All @@ -110,7 +113,7 @@ void QgsModelComponentGraphicItem::setFont( const QFont &font )

void QgsModelComponentGraphicItem::mouseDoubleClickEvent( QGraphicsSceneMouseEvent * )
{
if ( view()->tool() && view()->tool()->allowItemInteraction() )
if ( view() && view()->tool() && view()->tool()->allowItemInteraction() )
editComponent();
}

Expand All @@ -126,19 +129,19 @@ void QgsModelComponentGraphicItem::mouseReleaseEvent( QGraphicsSceneMouseEvent *

void QgsModelComponentGraphicItem::hoverEnterEvent( QGraphicsSceneHoverEvent *event )
{
if ( view()->tool() && view()->tool()->allowItemInteraction() )
if ( view() && view()->tool() && view()->tool()->allowItemInteraction() )
updateToolTip( event->pos() );
}

void QgsModelComponentGraphicItem::hoverMoveEvent( QGraphicsSceneHoverEvent *event )
{
if ( view()->tool() && view()->tool()->allowItemInteraction() )
if ( view() && view()->tool() && view()->tool()->allowItemInteraction() )
updateToolTip( event->pos() );
}

void QgsModelComponentGraphicItem::hoverLeaveEvent( QGraphicsSceneHoverEvent * )
{
if ( view()->tool() && view()->tool()->allowItemInteraction() )
if ( view() && view()->tool() && view()->tool()->allowItemInteraction() )
{
setToolTip( QString() );
if ( mIsHovering )
Expand Down
3 changes: 2 additions & 1 deletion src/gui/processing/models/qgsmodeldesignerdialog.cpp
Expand Up @@ -324,7 +324,8 @@ void QgsModelDesignerDialog::setModelScene( QgsModelGraphicsScene *scene )
mSelectTool->setScene( mScene );

connect( mScene, &QgsModelGraphicsScene::rebuildRequired, this, [ = ] { repaintModel(); } );
connect( mScene, &QgsModelGraphicsScene::componentChanged, this, [ = ] { setDirty(); } );
connect( mScene, &QgsModelGraphicsScene::componentAboutToChange, this, [ = ]( const QString & description, int id ) { beginUndoCommand( description, id ); } );
connect( mScene, &QgsModelGraphicsScene::componentChanged, this, [ = ] { endUndoCommand(); } );

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

0 comments on commit 5149f0b

Please sign in to comment.