Skip to content
Permalink
Browse files

Remove no longer required hack to get composer maps to render

canvas layers
  • Loading branch information
nyalldawson committed Mar 13, 2017
1 parent 452abb2 commit f4877ce8a89c65d388b039389c13ca5ac68053c7
Showing with 6 additions and 31 deletions.
  1. +0 −17 src/app/composer/qgscomposer.cpp
  2. +0 −10 src/app/composer/qgscomposer.h
  3. +0 −2 src/app/qgisapp.cpp
  4. +6 −2 src/core/composer/qgscomposermap.cpp
@@ -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 )
@@ -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;
@@ -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;
@@ -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() ) );
}
@@ -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 );

0 comments on commit f4877ce

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