Is there any way to load a *.qml file to layer and set a style to it in Python (PyQGIS)?

Can I 'get into' this file in console?

I want to review it.


1 Answer 1


I have my qml styles in a fix path (c:/pyqgis_data/Styles/). So, to load arrows_red_orange.qml (exclusively for point layers), next lines at the Python Console of QGIS work:

>>>layer = iface.activeLayer()
>>>if layer.geometryType() == QGis.Point:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.