[Qgis-developer] Coloring shapes of vector layer

Goo Creations goocreations at gmail.com
Mon Apr 11 06:58:13 EDT 2011


Hi

I've got a vector file (shp) with a bunch of points in it. I want to load
the points to the canvas with a specific color (not the random color QGIS
provides). I've tried a couple of tutorials, but the code provided doesn't
change the color.

*mask = QgsVectorLayer(maskPath, "my_mask", "ogr")*
*sy = QgsSymbol( mask.geometryType() )*
*sy.setFillColor(Qt.red)*
*    *
*renderer = QgsSingleSymbolRenderer( mask.geometryType() )*
*renderer.addSymbol( sy )*
*renderer.updateSymbolAttributes()*
*    *
*mask.setRenderer( renderer )*
*mask.triggerRepaint()*
*self.iface.legendInterface().refreshLayerSymbology(mask)*

Did I forget anything, or should I do something diffrently?

Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/qgis-developer/attachments/20110411/1e274b8f/attachment.html


More information about the Qgis-developer mailing list