Skip to content
Permalink
Browse files
Better handling of composer map forced refreshes
  • Loading branch information
nyalldawson committed Mar 21, 2017
1 parent 7f1a074 commit 9cba265876f43dda68609e8095a12f71613694db
@@ -85,7 +85,7 @@ QgsComposerAttributeTableV2::QgsComposerAttributeTableV2( QgsComposition *compos
connect( mComposition->project(), SIGNAL( layerWillBeRemoved( QString ) ), this, SLOT( removeLayer( const QString & ) ) );

//refresh table attributes when composition is refreshed
connect( mComposition, SIGNAL( refreshItemsTriggered() ), this, SLOT( refreshAttributes() ) );
connect( mComposition, &QgsComposition::refreshItemsTriggered, this, &QgsComposerTableV2::refreshAttributes );

//connect to atlas feature changes to update table rows
connect( &mComposition->atlasComposition(), SIGNAL( featureChanged( QgsFeature * ) ), this, SLOT( refreshAttributes() ) );
@@ -1121,6 +1121,7 @@ void QgsComposerMap::connectUpdateSlot()
connect( project, &QgsProject::layersRemoved, this, &QgsComposerMap::renderModeUpdateCachedImage );
connect( project, &QgsProject::legendLayersAdded, this, &QgsComposerMap::renderModeUpdateCachedImage );
}
connect( mComposition, &QgsComposition::refreshItemsTriggered, this, &QgsComposerMap::updateCachedImage );
}

bool QgsComposerMap::writeXml( QDomElement &elem, QDomDocument &doc ) const
@@ -110,7 +110,7 @@ void QgsComposition::init()
connect( &mAtlasComposition, &QgsAtlasComposition::coverageLayerChanged, this, [this] { refreshDataDefinedProperty(); } );
connect( &mAtlasComposition, &QgsAtlasComposition::featureChanged, this, [this] { refreshDataDefinedProperty(); } );
//also, refreshing composition triggers a recalculation of data defined properties
connect( this, SIGNAL( refreshItemsTriggered() ), this, SLOT( refreshDataDefinedProperty() ) );
connect( this, &QgsComposition::refreshItemsTriggered, this, [ = ] { refreshDataDefinedProperty(); } );
//toggling atlas or changing coverage layer requires data defined expressions to be reprepared
connect( &mAtlasComposition, &QgsAtlasComposition::toggled, this, [this] { prepareAllDataDefinedExpressions(); } );
connect( &mAtlasComposition, &QgsAtlasComposition::coverageLayerChanged, this, [this] { prepareAllDataDefinedExpressions(); } );
@@ -188,15 +188,6 @@ void QgsComposition::updateBounds()
void QgsComposition::refreshItems()
{
emit refreshItemsTriggered();
//force a redraw on all maps
QList<QgsComposerMap *> maps;
composerItems( maps );
QList<QgsComposerMap *>::iterator mapIt = maps.begin();
for ( ; mapIt != maps.end(); ++mapIt )
{
( *mapIt )->cache();
( *mapIt )->update();
}
}

void QgsComposition::setSelectedItem( QgsComposerItem *item )

0 comments on commit 9cba265

Please sign in to comment.