1

I am having problems creating a multilayer line symbol with this code :

symbol = QgsLineSymbolV2.createSimple({})
symbol.deleteSymbolLayer(0)

symbolLine = QgsSimpleLineSymbolLayerV2()
symbol.appendSymbolLayer(symbolLine)

symbolArrow = QgsMarkerSymbolV2.createSimple({})
symbolArrow.deleteSymbolLayer(0)

symbolArrowLayer = QgsSimpleMarkerSymbolLayerV2()
symbolArrow.appendSymbolLayer(symbolArrowLayer)

symbolLineArrow = QgsMarkerLineSymbolLayerV2()
symbolLineArrow.setSubSymbol(symbolArrow) # Causes crash !!!

symbol.appendSymbolLayer(symbolLineArrow)

Is there something wrong in this code ? Has anybody already had this issue ?

1 Answer 1

3

Looks like you hit a bug in QGIS. I've fixed it now, and the fix will be included in the next point releases.

In the meantime, you can work around it by making symbolArrow a global variable, so that it will not be garbage collected by python.

0

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.