I'm using QGIS-2.4.0 api to develop app in C++. When I add a vector layer to the app, the vector map's color would be random. I used QgsFeatureRendererV2 to get the geometry type of the layer, my provider name is ogr. My question is: how to set a solid color to the layer?

1 Answer 1



void QgsSymbolV2::setColor(const QColor & color)

with python:

myColour = QtGui.QColor('#ffee00')
mySymbol1 = QgsSymbolV2.defaultSymbol(myVectorLayer.geometryType())

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.