[Qgis-developer] symbolForFeature() does not works?

Alexander Bruy alexander.bruy at gmail.com
Thu Jul 3 08:53:54 PDT 2014

Hi all,

seems symbolForFeature() method does not works as expected for most
 * QgsSingleSymbolRendererV2 — returns feature symbol
 * QgsCategorizedSymbolRendererV2 — returns None and in debug output
    I have message saying "there are no hashed symbols!!!"
 * QgsGraduatedSymbolRendererV2 — just crashes QGIS
 * QgsRuleBasedRendererV2 — returns None

All tests made with point shapefile. Here is code snipped I used (load vector
layer and activate it first):

layer = iface.mapCanvas().currentLayer()
feat = layer.getFeatures().next()
renderer = layer.rendererV2()
symbol = renderer.symbolForFeature(feat)

For me this is major issue that makes difficult to develop plugins that works
with layer symbology (e.g. symbology import/export/conversion)

Anyone confirms? Should I open a ticket?

Alexander Bruy

More information about the Qgis-developer mailing list