[Qgis-developer] legendSymbologyItems - python binding

Chris Crook ccrook at linz.govt.nz
Tue Sep 6 14:56:09 PDT 2016


Hi

I want to display a custom icon on the legend for a python implementation of QgsFeatureRendererV2 (VectorFieldRenderer)

The implementation that used to work many versions of QGIS ago worked by overriding the  QgsFeatureRendererV2.legendSymbologyItems(size) function.  This function does not appear to be called now?

The legendSymbolItemsV2 function is called, so I can return a QgsLegendSymbolItemV2, and in that I can return the QgsMarkerSymbolLayerV2 derived class that my renderer uses, but the renderPoint function in that is not suitable for plotting a legend item.  It requires the QgsFeatureRendererV2.symbolForFeature call to set up the marker, and in any case is needs to be scaled down to display on the legend.  As far as I can see there is no way to identify that the renderPoint function is being called to generate a legend symbol rather than a map canvas symbol?

What is the correct way to implement a custom icon on the legend now?

Thanks
Chris

This message contains information, which may be in confidence and may be subject to legal privilege. If you are not the intended recipient, you must not peruse, use, disseminate, distribute or copy this message. If you have received this message in error, please notify us immediately (Phone 0800 665 463 or info at linz.govt.nz) and destroy the original message. LINZ accepts no responsibility for changes to this email, or for any attachments, after its transmission from LINZ. Thank You.


More information about the Qgis-developer mailing list