1

I'm trying to set the blending mode of a layer like on the picture, Darken on Feature, not on layer, with Python.

Here is the code that i used to modify the "Layer" Blending mode.

layer=iface.activeLayer()
target_field = 'delta_t'
myRangeList = []
symbol = QgsSymbol.defaultSymbol(layer.geometryType())
myRange = QgsRendererRange(0, 10.0, symbol, '0 a 10')
myRangeList.append(myRange)
myRenderer = QgsGraduatedSymbolRenderer(target_field, myRangeList)
myRenderer.setMode(QgsGraduatedSymbolRenderer.Custom)
layer.setRenderer(myRenderer)
layer.setBlendMode(QPainter.CompositionMode_Darken)

How can i modify the "Feature" Blending Mode on "Darken"?

2

If you need modify the "Feature" Blending Mode on "Darken" use this:

layer.setFeatureBlendMode(QPainter.CompositionMode_Darken)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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