[Qgis-developer] PyQGIS: QgsGraduatedSymbolRenderer class and
saveNamedStyle method
Martin Dobias
wonder.sk at gmail.com
Wed Aug 12 04:19:42 EDT 2009
Hi German,
2009/8/12 Germán Carrillo <carrillo.german at gmail.com>:
> Hi all. I'm trying to emulate the symbology dialog for a Python application
> but I have a trouble.
>
> When I'm working with QgsGraduatedSymbolRenderer and I try to save the style
> to a qml file using the saveNamedStyle() method I get the following message:
>
> Could not save symbology because:
>
> renderer failed to save
>
> And in the command line:
> NotImplementedError: QgsGraduatedSymbolRenderer.writeXML() is abstract and
> must be overridden
>
> With the other renderer classes (QgsContinuousColorRenderer,
> QgsSingleSymbolRenderer, QgsUniqueValueRenderer) the saveNamedStyle()
> method works well and the qml file is saved without any problem.
I suspect this might be due missing 'const' classifier in
QgsGraduatedSymbolRenderer wrapper.
In python/core/qgsgraduatedsymbolrenderer.sip, line 68:
virtual bool writeXML( QDomNode & layer_node, QDomDocument & document,
QgsVectorLayer& vl ) const;
Try to alter "QgsVectorLayer&" to "const QgsVectorLayer&" and
recompile the bindings.
If it helps, please give me feedback and I'll fix it in SVN.
Martin
More information about the Qgis-developer
mailing list