[Qgis-developer] using renderers

Carson Farmer cfarmer at uvic.ca
Thu Jul 3 20:28:18 EDT 2008


Hello list,

This is likely a simple question, but I can't seem to be able to find a 
simple answer:
I have the following code for creating a continuous color renderer
>         render = QgsContinuousColorRenderer(QGis.Polygon)
>         render.setClassificationField(0)
>         symbol1 = QgsSymbol(QGis.Polygon, "", "", "")
>         symbol2 = QgsSymbol(QGis.Polygon, "", "", "")
>         symbol1.setFillColor(QColor(Qt.red))
>         render.setMinimumSymbol(symbol1)
>         symbol2.setFillColor(QColor(Qt.green))
>         render.setMaximumSymbol(symbol2)
and then later on I have my vector layer 'vlayer' and use:

> vlayer.setRenderer(render)
to set the renderer for this layer. Now when I add the layer to the map 
canvas, the renderer settings are set, but they are not displayed until 
I click on 'apply' after right clicking and going to the layers 
properties. So my question is what do I have to add to the above code to 
make this display properly?

Cheers,

Carson



More information about the Qgis-developer mailing list