QgsFeatureRendererV2.symbolForFeature() in 2.14 - how many arguments?
I am struggling with QgsFeatureRendererV2.symbolForFeature(). QgsFeatureRendererV2.symbolForFeature(QgsFeature) does not throw an error, but the API docs say that is deprecated. The non-deprecated syntax is listed as QgsFeatureRendererV2.symbolForFeature(QgsFeature, QgsRenderContext). However, in my case, that throws "TypeError: QgsFeatureRendererV2.symbolForFeature(QgsFeature): too many arguments".
Am I doing something wrong? My use of this is here:
Re: QgsFeatureRendererV2.symbolForFeature() in 2.14 - how many arguments?
On 12 March 2016 at 21:12, Tom Chadwin <[hidden email]> wrote:
> Apologies. Just found this in the docs for the non-deprecated syntax:
> "available in Python bindings as symbolForFeature2". Grrr.
> symbolForFeature2() works with the extra argument.
> I still can't get my code to do what I want it to, but that's a different
> (and as-yet unknown) issue.
> Many apologies for the noise.
Was just about to point you that way! It's an unfortunate side effect
of the python bindings. I couldn't find anyway to keep the same name
as the c++ method without breaking existing python code which uses the
In 3.0 I'll remove the deprecated method and rename the non-deprecated
one back to symbolForFeature.
> Oh, and both deprecated and current syntaxes say "To be overridden" in the
> docs, but I don't know what that means.
That's only relevant if you're subclassing QgsFeatureRendererV2 (ie,
writing your own renderer). If this was the case you'd need to make
sure your subclass implements it's own overridden version of this