I'd like to change the layer rendering style from python code. Basically I want to do the same operations I can do from QGis by:
- Right-click on a layer
- Select one of the displayed
Saved styles, and
I found several examples on the net, but all talks about loading custom styles from files. I don't want (at least for the moment) do that. I need to use already available styles provided from QGis application.
I have a style called 'Construction road' on the property menu, so I tried the following:
aLayer = self.osmNavigator.iface.addVectorLayer(uri.uri(),layerName,self.dbConn.getProviderName()) aLayer.loadNamedStyle("Construction road")
but this doesn't work.
My question are:
- How can I change the rendering style of a QGisVectorLayer from a python plugin, selecting one from already available styles?
- Can I retrieve a list of all available style names?