I have a Layer named A with a Style which isnt saved in a .qml-File.
I want to do something with the layer e.g. compute some columns with the field calculator in a QGIS Model, also Layer A would be deleted within this process, because i just need the new one. The output is a new Layer named B.
Layer B gets a automatically a new, mostly ugly, Style. Now I want to copy the Style from Layer A to Layer B with PyQGIS.
I know I can save the layer Style of A to a .qml-File and load it for Layer B. But i would love a solution like:
style = layer_A.getStyle()
layer_B.setStyle(style)
Is there a possibility to do this?
Best Answer
I guess there must be some easier method to do it. But so far I could only figure out doing so using QgsMapLayer.styleManager() as descibed at QgsMapLayerStyleManager()