I'm trying to programmatically set and enable labelling on a layer using Python
in QGis 2.9.0.
label = QgsPalLayerSettings()
label.readFromLayer(myLayer)
label.enabled = True
label.fieldName = 'myField'
# Just to change something clearly visible.
label.textColor = QColor(255,0,0,255)
label.writeToLayer(myLayer)
This doesn't enable labelling, but if I enter the Layer Properties on myLayer,
everything looks okay and when pressing Apply, the labels become visible.
Is there something I need to set to avoid having to manually click Apply to get
the labels visible?
Calling iface.mapCanvas().refresh() afterwards doesn't work.
Regards, Casper
_______________________________________________
Qgis-user mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/qgis-user