Skip to content
Permalink
Browse files

Add legend node function

  • Loading branch information
pblottiere committed Apr 3, 2019
1 parent 3925246 commit 81f029d19c59373d42f66b140d9cf343425d545c
@@ -228,5 +228,18 @@ namespace QgsWms

return tree.release();
}

QgsLayerTreeModelLegendNode *legendNode( const QgsLayerTreeModel &model, const QString &rule )
{
for ( QgsLayerTreeLayer *layer : model->rootGroup()->findLayers() )
{
for ( QgsLayerTreeModelLegendNode *node : model->layerLegendNodes( layer ) )
{
if ( node->data( Qt::DisplayRole ).toString().compare( rule ) == 0 )
return node;
}
}
return nullptr;
}
} // namespace QgsWms

@@ -37,4 +37,6 @@ namespace QgsWms
QgsLayerTreeModel *legendModel( const QgsWmsRenderContext &context, QgsLayerTree &tree );

QgsLayerTree *layerTree( const QgsWmsRenderContext &context );

QgsLayerTreeModelLegendNode *legendNode( const QgsLayerTreeModel &model, const QString &rule );
} // namespace QgsWms

0 comments on commit 81f029d

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