Almost 5 years since the original post now, but whenWhen I tried the to use code based on the answer by GreyEyedPallas@GreyEyedPallas (in QGIS 2.18), I got a message:
AttributeError: 'NoneType' object has no attribute 'createSymbolLayer'
AttributeError: 'NoneType' object has no attribute 'createSymbolLayer'
To fix this, I needed to use ArrowLine
instead of LineDecoration
as follows:
sl = QgsSymbolLayerV2Registry.instance().symbolLayerMetadata("ArrowLine").createSymbolLayer({ 'width' : '0.26', 'color' : '0,0,0' })
symbollist = layer.rendererV2().symbols()
symbol = symbollist[0]
symbol.appendSymbolLayer(sl)