Skip to content
Browse files
Fix empty legends in WMS GetPrint
  • Loading branch information
mhugent committed Nov 4, 2016
1 parent e1d272d commit ecef7d751f7f3bc149e1c97c513890fad3e83e99
Showing 1 changed file with 9 additions and 3 deletions.
@@ -201,15 +201,21 @@ QgsComposition* QgsWMSConfigParser::createPrintComposition( const QString& compo

//The layer set has entries if the composer map has a locked layer set or
//if the composer map layer set has been constrained in the WMS request.
//If this is not the case, there is no need to modify the layers in the legend here
QStringList layerSet = map->layerSet();
if ( layerSet.size() < 1 )

// get model and layer tree root of the legend
QgsLegendModelV2* model = currentLegend->modelV2();
QgsLayerTreeGroup* root = model->rootGroup();

// get layerIds find in the layer tree root
QStringList layerIds = root->findLayerIds();
// get map layerIds
QStringList layerSet = map->layerSet();

// get map scale
double scale = map->scale();

0 comments on commit ecef7d7

Please sign in to comment.