Hi Alex On Thu, Jul 3, 2014 at 10:53 PM, Alexander Bruy <[email protected]> wrote: > Hi all, > > seems symbolForFeature() method does not works as expected for most > renderers: > * 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?
Like with renderFeature() call, the symbolForFeature() method must be called in between startRender()/stopRender() calls, otherwise the behaviour is undefined. It would be nice though not to crash and emit a warning instead... Regards Martin _______________________________________________ Qgis-developer mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/qgis-developer
