[QGIS-Developer] pyqgis labelling settings
Hugh Kelley
hghklly at gmail.com
Fri Oct 21 09:17:44 PDT 2022
Hi,
I'm hoping to make some scripts for labelling layers.
I've found the basic labelling settings in
layer = iface.activeLayer()layer.labeling().settings().format().size()
for example, and it seems that I could be able to update that with an
object like
newsize = QgsTextFormat()
newsize.setSize(20)
but I haven't yet found the correct way to update the layer's value.
it seems like it needs to be passed an entire new `QgsPalLayerSettings`
object but I haven't found a way to build a complete object.
I've seen `readFromLayer()` but I'm guessing that was a version 2 method
that's no longer available in version 3.
any pointers or a simple piece of code for updating a layer labelling
property would be hugely appreciated.
it also occurs to me to ask whether there is anything like:
print(layer.renderer().symbol().symbolLayers()[0].properties())
that returns a dict of the layer symbology properties for a label.
Another helpful thing would be code that imports a label definition from an
exported xml file.
thanks,
hugh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20221021/c03b1fe3/attachment.htm>
More information about the QGIS-Developer
mailing list