3

Hi this may be more of a python question rather than qgis processing script question. I've managed to successfully get the output that I want from my processing script, but I wish to take one step further and style it automatically with a saved qml file.

The code below doesn't work because the return ends my script. How should I go about doing this?

return {self.OUTPUT: dest_id}
iface.activeLayer().loadNamedStyle('Buffer.qml')
iface.activeLayer().triggerRepaint()
0

Have you tried using an absolute path?

return {self.OUTPUT: dest_id}
iface.activeLayer().loadNamedStyle(u"absolute_path_to_ma_qml/'Buffer.qml')
# example: iface.activeLayer().loadNamedStyle(u"D:\\qml_files\\Buffer.qml")
iface.activeLayer().triggerRepaint()

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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