How to show only selected features from a a layer in the QgsComposerLegend?

المشرف العام

Administrator
طاقم الإدارة
I have developed a custom qgis plugin. I have a button to export the map canvas in the form of image along with the legend. I came up with the following code for the legend:

legend = QgsComposerLegend(c) legend.model().setLayerSet(mapRenderer.layerSet()) c.addItem(legend)The problem is that it adds all the features in the map legend whereas I only want to include the selected features in the map legend. I also tried:

legend.setLegendFilterByMapEnabled(True)But this does not seem to work. Any ideas on how to solve this issue?



أكثر...
 
أعلى