I'm trying to apply some labeling properties to a layer using Python. Everything went fine, except the way I tried to apply the Bold and Italic settings. Here is a part of the code:
layer.setCustomProperty("labeling/fieldName", field.name())
layer.setCustomProperty("labeling", "pal")
layer.setCustomProperty("labeling/enabled", "True")
layer.setCustomProperty("labeling/fontFamily", "Arial Narrow")
if self.dlg.pt6.isChecked():
layer.setCustomProperty("labeling/fontSize", "6")
if self.dlg.pt8.isChecked():
layer.setCustomProperty("labeling/fontSize", "8")
if self.dlg.pt10.isChecked():
layer.setCustomProperty("labeling/fontSize", "10")
if self.dlg.chkbold.isChecked():
layer.setCustomProperty("labeling/weight", "Bold")
layer.setCustomProperty("labeling/fontWeight", "75")
layer.setCustomProperty("labeling/Weight", "Bold")
if self.dlg.chkitalic.isChecked():
layer.setCustomProperty("labeling/fontItalic", "True")

75instead of"75"andTrueinstead of"True"? Also, I believe"labeling/weight"isn't supported (only"labeling/fontWeight"). – ArMoraer Apr 29 '16 at 08:11