[Qgis-developer] interact with QgsUniqueValueRenderer

Martin Dobias wonder.sk at gmail.com
Fri Dec 18 14:59:32 EST 2009

On Fri, Dec 18, 2009 at 9:18 AM, Michele Mammini <mamminim at yahoo.it> wrote:
> Dear All,
> i'd like to know if it is possible to interact throught python code with
> QgsUniqueValueRenderer
> in order to show or hide the classification fields previously loaded.

Hi Michele,

this should be possible. Having a layer, get its renderer:
r = layer.renderer()
Then get list of symbols:
syms = r.symbols()

Check QgsSymbol documentation to see what's possible to do with
symbols - you can query the symbol properties, upper and lower value
of range for symbol or also set the properties, e.g.:
(will set line width to 3 mm)

One small warning: from the next release (v1.4) there will be
additionally a new symbology implementation. For more information
about the topic, see: http://www.qgis.org/wiki/Symbology-NG


More information about the Qgis-developer mailing list