I am trying to load a style from a QML file into a vector layer.
When I use a memory layer, loading the style works fine with the following code:
layer = iface.activeLayer()
layer.loadNamedStyle(path_to_style)
If the layer is a postgreSQL layer with a default style, the above code will
return:
('Loaded from provider', True)
and the style from the QML won't be loaded. The way to force it was add a True
parameter in the end of the method call:
layer = iface.activeLayer()
layer.loadNamedStyle(path_to_style, True)
Not sure if this is the correct behavior, but it does not match with the
documentation:
https://api.qgis.org/api/classQgsMapLayer.html#a8b271b8bf3074e84808cff26f722b26f
<https://api.qgis.org/api/classQgsMapLayer.html#a8b271b8bf3074e84808cff26f722b26f>
Thanks,
Alexandre Neto
_______________________________________________
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer