Skip to content
Permalink
Browse files

Remove older item move code

  • Loading branch information
nyalldawson committed Mar 11, 2020
1 parent 9044acd commit d6df6f7456bc8d20409a43281c7d70352081173f
@@ -42,7 +42,6 @@ QgsModelComponentGraphicItem::QgsModelComponentGraphicItem( QgsProcessingModelCo
, mModel( model )
{
setAcceptHoverEvents( true );
setFlag( QGraphicsItem::ItemIsMovable, true );
setFlag( QGraphicsItem::ItemIsSelectable, true );
setFlag( QGraphicsItem::ItemSendsGeometryChanges, true );
setZValue( QgsModelGraphicsScene::ZValues::ModelComponent );
@@ -113,9 +112,14 @@ void QgsModelComponentGraphicItem::setFont( const QFont &font )

void QgsModelComponentGraphicItem::moveComponentBy( qreal dx, qreal dy )
{
mIsMoving = true;
moveBy( dx, dy );
mIsMoving = false;
mComponent->setPosition( pos() );

emit aboutToChange( tr( "Move %1" ).arg( mComponent->description() ) );
updateStoredComponentPosition( pos() );
emit changed();

emit updateArrowPaths();
}

void QgsModelComponentGraphicItem::mouseDoubleClickEvent( QGraphicsSceneMouseEvent * )
@@ -164,28 +168,6 @@ QVariant QgsModelComponentGraphicItem::itemChange( QGraphicsItem::GraphicsItemCh
{
switch ( change )
{
case QGraphicsItem::ItemPositionHasChanged:
{
emit updateArrowPaths();

if ( !mInitialized || pos() == mComponent->position() )
break;

mComponent->setPosition( pos() );

// also need to update the model's stored component's position
if ( !mIsMoving )
{
// we are just starting a move operation - so create the undo command using the existing state
emit aboutToChange( tr( "Move %1" ).arg( mComponent->description() ) );
}
updateStoredComponentPosition( pos() );

// we don't emit the changed signal to trigger the end of the undo command until the whole move operation finishes
// (i.e. we do that in mouseReleaseEvent)
mIsMoving = true;
break;
}
case QGraphicsItem::ItemSelectedChange:
{
emit repaintArrows();
@@ -121,7 +121,6 @@ class GUI_EXPORT QgsModelComponentGraphicItem : public QGraphicsObject
void moveComponentBy( qreal dx, qreal dy );

void mouseDoubleClickEvent( QGraphicsSceneMouseEvent *event ) override;
void mouseReleaseEvent( QGraphicsSceneMouseEvent *event ) override;
void hoverEnterEvent( QGraphicsSceneHoverEvent *event ) override;
void hoverMoveEvent( QGraphicsSceneHoverEvent *event ) override;
void hoverLeaveEvent( QGraphicsSceneHoverEvent *event ) override;

0 comments on commit d6df6f7

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