Hey Andrew,

This is how I did it with Roam to get all the legend items for the layer:

items = layer.rendererV2().legendSymbologyItems(ICON_SIZE)

That will give you a list of:Text - Icon pairs

if you are using the rule base renderer you get can the symbol for the rule
and paint that into a pixmap, however note that one feature can have many
symbols so you will have to use the method that returns a list for all the
symbols.

Depending on what you are doing  legendSymbologyItems might give you what
you need without extra work.

- Nathan

On Fri, 8 May 2015 at 07:00 Andrew McClure <[email protected]> wrote:

> Any takers for this one? I'd like to render the active symbol for a layer
> as a QPixmap in a dialog.
>
> I have got this far:
>
>        s =  layer().rendererV2()
>        key = s.rootRule().findRuleByKey(s.rootRule().ruleKey())
>
> This tells me the active rule key to be rendered but how to get the image
> data?
>
> Perhaps I am barking up the wrong tree here?
>
> Thanks
> _______________________________________________
> Qgis-developer mailing list
> [email protected]
> http://lists.osgeo.org/mailman/listinfo/qgis-developer
>
_______________________________________________
Qgis-developer mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to