I'm trying to modify the "Decimal places" (defaut : 3) to "1" from the formatting layer properties.
Here is my code :
background_color = QgsTextBackgroundSettings()
background_color.setEnabled(True)
prop = QgsProperty()
prop.setField("Couleur")
pc = QgsPropertyCollection('ShapeFillColor')
pc.setProperty(58, prop)
layer_settings = QgsPalLayerSettings()
layer_settings.setDataDefinedProperties(pc)
text_format = QgsTextFormat()
text_format.setFont(QFont("MS Shell Dlg 2"))
text_format.setSize(12.5)
text_format.setColor(QColor("black"))
text_format.setFont(QFont("MS Shell Dlg 2",11,QFont.Bold))
text_format.setBackground(background_color)
layer_settings.setFormat(text_format)
layer_settings.fieldName = "NO2"
layer_settings.enabled = True
I think I have to use a function of the class QgsTextFormat
but I can’t find which one in the documentary.