QgsFeatureRendererV2.symbolForFeature() in 2.14 - how many arguments?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

QgsFeatureRendererV2.symbolForFeature() in 2.14 - how many arguments?

Tom Chadwin
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:

https://github.com/tomchadwin/qgis2web/blob/master/utils.py#L205

I'm also not getting the overall results I want from this if I use the deprecated syntax, so I'm getting nowhere at the moment.

Oh, and both deprecated and current syntaxes say "To be overridden" in the docs, but I don't know what that means.
Reply | Threaded
Open this post in threaded view
|

Re: QgsFeatureRendererV2.symbolForFeature() in 2.14 - how many arguments?

Tom Chadwin
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.
Reply | Threaded
Open this post in threaded view
|

Re: QgsFeatureRendererV2.symbolForFeature() in 2.14 - how many arguments?

Nyall Dawson
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
deprecated method.

In 3.0 I'll remove the deprecated method and rename the non-deprecated
one back to symbolForFeature.

Nyall


>
>
>
> --
> View this message in context: http://osgeo-org.1560.x6.nabble.com/QgsFeatureRendererV2-symbolForFeature-in-2-14-how-many-arguments-tp5255961p5255964.html
> Sent from the Quantum GIS - Developer mailing list archive at Nabble.com.
> _______________________________________________
> Qgis-developer mailing list
> [hidden email]
> List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer
_______________________________________________
Qgis-developer mailing list
[hidden email]
List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer
Reply | Threaded
Open this post in threaded view
|

Re: QgsFeatureRendererV2.symbolForFeature() in 2.14 - how many arguments?

Nyall Dawson
In reply to this post by Tom Chadwin
On 12 March 2016 at 21:02, Tom Chadwin <[hidden email]> wrote:

>
> 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
method.

Nyall
_______________________________________________
Qgis-developer mailing list
[hidden email]
List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer
Reply | Threaded
Open this post in threaded view
|

Re: QgsFeatureRendererV2.symbolForFeature() in 2.14 - how many arguments?

Tom Chadwin
In reply to this post by Nyall Dawson
Thanks, Nyall. Way beyond my knowledge, I'm afraid (when someone starts to say overloading or subclassing, my eyes tend to glaze over. Not to worry - at least I've got rid of that error...