Skip to content

Commit

Permalink
Remove no longer required hack to get composer maps to render
Browse files Browse the repository at this point in the history
canvas layers
  • Loading branch information
nyalldawson committed Mar 13, 2017
1 parent 452abb2 commit f4877ce
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 31 deletions.
17 changes: 0 additions & 17 deletions src/app/composer/qgscomposer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -934,23 +934,6 @@ bool QgsComposer::loadFromTemplate( const QDomDocument &templateDoc, bool clearE
return result;
}

void QgsComposer::onCanvasLayersChanged( const QList<QgsMapLayer *> &layers )
{
if ( !mComposition )
return;

QList< QgsComposerMap * > maps;
mComposition->composerItems( maps );

Q_FOREACH ( QgsComposerMap *map, maps )
{
if ( map->keepLayerSet() )
continue;

map->setLayers( layers );
}
}

void QgsComposer::updateStatusCursorPos( QPointF cursorPosition )
{
if ( !mComposition )
Expand Down
10 changes: 0 additions & 10 deletions src/app/composer/qgscomposer.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,16 +114,6 @@ class QgsComposer: public QMainWindow, private Ui::QgsComposerBase
*/
bool loadFromTemplate( const QDomDocument &templateDoc, bool clearExisting );

public slots:

/**
* Should be called whenever the app's canvas layers change (or layer order
* changes). Required to update composer maps which are synced to the canvas
* layer set with the new canvas layer set.
* @note added in QGIS 3.0
*/
void onCanvasLayersChanged( const QList< QgsMapLayer * > &layers );

protected:
//! Move event
virtual void moveEvent( QMoveEvent * ) override;
Expand Down
2 changes: 0 additions & 2 deletions src/app/qgisapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6828,7 +6828,6 @@ QgsComposer *QgisApp::createNewComposer( QString title )
connect( newComposerObject, &QgsComposer::composerAdded, this, &QgisApp::composerAdded );
connect( newComposerObject, &QgsComposer::composerWillBeRemoved, this, &QgisApp::composerWillBeRemoved );
connect( newComposerObject, &QgsComposer::atlasPreviewFeatureChanged, this, &QgisApp::refreshMapCanvas );
connect( mLayerTreeCanvasBridge, &QgsLayerTreeMapCanvasBridge::canvasLayersChanged, newComposerObject, &QgsComposer::onCanvasLayersChanged );

markDirty();
return newComposerObject;
Expand Down Expand Up @@ -6932,7 +6931,6 @@ bool QgisApp::loadComposersFromProject( const QDomDocument &doc )
connect( composer, &QgsComposer::composerAdded, this, &QgisApp::composerAdded );
connect( composer, &QgsComposer::composerWillBeRemoved, this, &QgisApp::composerWillBeRemoved );
connect( composer, &QgsComposer::atlasPreviewFeatureChanged, this, &QgisApp::refreshMapCanvas );
connect( mLayerTreeCanvasBridge, &QgsLayerTreeMapCanvasBridge::canvasLayersChanged, composer, &QgsComposer::onCanvasLayersChanged );

QgsDebugMsg( QString( "Loaded composer %1: %2ms" ).arg( title ).arg( t.elapsed() ) );
}
Expand Down
8 changes: 6 additions & 2 deletions src/core/composer/qgscomposermap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -475,12 +475,16 @@ QList<QgsMapLayer *> QgsComposerMap::layersToRender( const QgsExpressionContext
if ( mComposition->project()->mapThemeCollection()->hasMapTheme( presetName ) )
renderLayers = mComposition->project()->mapThemeCollection()->mapThemeVisibleLayers( presetName );
else // fallback to using map canvas layers
renderLayers = layers();
renderLayers = mComposition->project()->mapThemeCollection()->masterVisibleLayers();
}
else
else if ( mKeepLayerSet )
{
renderLayers = layers();
}
else
{
renderLayers = mComposition->project()->mapThemeCollection()->masterVisibleLayers();
}

bool ok = false;
QString ddLayers = mDataDefinedProperties.valueAsString( QgsComposerObject::MapLayers, *evalContext, QString(), &ok );
Expand Down

0 comments on commit f4877ce

Please sign in to comment.