Skip to content
Permalink
Browse files

Rebase fixes

  • Loading branch information
nyalldawson committed Mar 10, 2020
1 parent 3918f01 commit 5149f0b6c76ebace13e3ab80c950a95bbfcaf43e
@@ -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
@@ -94,6 +94,9 @@ QgsProcessingModelAlgorithm *QgsModelComponentGraphicItem::model()

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

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

@@ -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();
}

@@ -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 )
@@ -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();

0 comments on commit 5149f0b

Please sign in to comment.
You can’t perform that action at this time.