Skip to content

Commit

Permalink
[composer] Fix multiple refresh of items
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed May 25, 2014
1 parent 6375f64 commit 9329980
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 18 deletions.
4 changes: 1 addition & 3 deletions src/core/composer/qgscomposerlabel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,8 @@ QgsComposerLabel::QgsComposerLabel( QgsComposition *composition ):
setExpressionContext( mComposition->atlasComposition().currentFeature(), mComposition->atlasComposition().coverageLayer() );
}

//connect to atlas toggling on/off and coverage layer and feature changes
//connect to atlas feature changes
//to update the expression context
connect( &mComposition->atlasComposition(), SIGNAL( toggled( bool ) ), this, SLOT( refreshExpressionContext() ) );
connect( &mComposition->atlasComposition(), SIGNAL( coverageLayerChanged( QgsVectorLayer* ) ), this, SLOT( refreshExpressionContext() ) );
connect( &mComposition->atlasComposition(), SIGNAL( featureChanged( QgsFeature* ) ), this, SLOT( refreshExpressionContext() ) );

}
Expand Down
6 changes: 1 addition & 5 deletions src/core/composer/qgscomposerpicture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,8 @@ void QgsComposerPicture::init()
{
//connect some signals

//connect to atlas toggling on/off and coverage layer changes
//to update the picture source expression
connect( &mComposition->atlasComposition(), SIGNAL( toggled( bool ) ), this, SLOT( updatePictureExpression() ) );
connect( &mComposition->atlasComposition(), SIGNAL( coverageLayerChanged( QgsVectorLayer* ) ), this, SLOT( updatePictureExpression() ) );

//connect to atlas feature changing
//to update the picture source expression
connect( &mComposition->atlasComposition(), SIGNAL( featureChanged( QgsFeature* ) ), this, SLOT( refreshPicture() ) );

//connect to composer print resolution changing
Expand Down
8 changes: 2 additions & 6 deletions src/core/composer/qgscomposershape.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,8 @@ QgsComposerShape::QgsComposerShape( QgsComposition* composition ): QgsComposerIt

if ( mComposition )
{
//connect to atlas toggling on/off and coverage layer and feature changes
//connect to atlas feature changes
//to update symbol style (in case of data-defined symbology)
connect( &mComposition->atlasComposition(), SIGNAL( toggled( bool ) ), this, SLOT( repaint() ) );
connect( &mComposition->atlasComposition(), SIGNAL( coverageLayerChanged( QgsVectorLayer* ) ), this, SLOT( repaint() ) );
connect( &mComposition->atlasComposition(), SIGNAL( featureChanged( QgsFeature* ) ), this, SLOT( repaint() ) );
}
}
Expand All @@ -55,10 +53,8 @@ QgsComposerShape::QgsComposerShape( qreal x, qreal y, qreal width, qreal height,

if ( mComposition )
{
//connect to atlas toggling on/off and coverage layer and feature changes
//connect to atlas feature changes
//to update symbol style (in case of data-defined symbology)
connect( &mComposition->atlasComposition(), SIGNAL( toggled( bool ) ), this, SLOT( repaint() ) );
connect( &mComposition->atlasComposition(), SIGNAL( coverageLayerChanged( QgsVectorLayer* ) ), this, SLOT( repaint() ) );
connect( &mComposition->atlasComposition(), SIGNAL( featureChanged( QgsFeature* ) ), this, SLOT( repaint() ) );
}
}
Expand Down
4 changes: 1 addition & 3 deletions src/core/composer/qgspaperitem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -260,10 +260,8 @@ void QgsPaperItem::initialize()
mPageGrid = new QgsPaperGrid( pos().x(), pos().y(), rect().width(), rect().height(), mComposition );
mComposition->addItem( mPageGrid );

//connect to atlas toggling on/off and coverage layer and feature changes
//connect to atlas feature changes
//to update symbol style (in case of data-defined symbology)
connect( &mComposition->atlasComposition(), SIGNAL( toggled( bool ) ), this, SLOT( repaint() ) );
connect( &mComposition->atlasComposition(), SIGNAL( coverageLayerChanged( QgsVectorLayer* ) ), this, SLOT( repaint() ) );
connect( &mComposition->atlasComposition(), SIGNAL( featureChanged( QgsFeature* ) ), this, SLOT( repaint() ) );
}
}
2 changes: 1 addition & 1 deletion tests/src/core/testqgscomposerpicture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ void TestQgsComposerPicture::pictureClipAnchorOversize()
mComposerPicture->setSceneRect( QRectF( 70, 70, 150, 120 ) );
mComposerPicture->setPictureAnchor( QgsComposerItem::LowerMiddle );

QgsCompositionChecker checker( "expected_composerpicture_clip_anchoroversize", mComposition );
QgsCompositionChecker checker( "composerpicture_clip_anchoroversize", mComposition );
QVERIFY( checker.testComposition( mReport, 0, 0 ) );

mComposition->removeItem( mComposerPicture );
Expand Down

0 comments on commit 9329980

Please sign in to comment.