<html><body><div><div><span>I am trying to load a style from a QML file into a vector layer.</span></div><br><div><span>When I use a memory layer, loading the style works fine with the following code:</span></div><br><div><span>layer = iface.activeLayer()</span></div><div><span>layer.loadNamedStyle(path_to_style)</span></div><br><div><span>If the layer is a postgreSQL layer with a default style, the above code will return:</span></div><br><div><span>('Loaded from provider', True)</span></div><br><div><span>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:</span></div><br><div><span>layer = iface.activeLayer()</span></div><div><span>layer.loadNamedStyle(path_to_style, True)</span></div><br><div><span>Not sure if this is the correct behavior, but it does not match with the documentation:</span></div><br><div><a target="_blank" rel="noopener noreferrer" href="https://api.qgis.org/api/classQgsMapLayer.html#a8b271b8bf3074e84808cff26f722b26f">https://api.qgis.org/api/classQgsMapLayer.html#a8b271b8bf3074e84808cff26f722b26f</a></div><br><div><span>Thanks,</span></div><br><div><span>Alexandre Neto</span></div></div></body></html>