[QGIS-Developer] Editing rule based labeling with the new QGIS3 python API
Dominique Lyszczarz
domlysz at gmail.com
Sat Feb 3 02:24:06 PST 2018
Hi,
I'm able to create a new rule based labeling setup from scratch like this
minimal example :
root = QgsRuleBasedLabeling.Rule(QgsPalLayerSettings())
settings = QgsPalLayerSettings()
rule = QgsRuleBasedLabeling.Rule(settings)
root.appendChild(rule)
rules = QgsRuleBasedLabeling(root)
myLayer.setLabeling(rules)
Unfortunately I can't find how to iterate over existing rules, the
labeling()
<http://python.qgis.org/api/core/Vector/QgsVectorLayer.html?#qgis.core.QgsVectorLayer.labeling>
method available for vector layers return an object of
QgsAbstractVectorLayerLabeling
<http://python.qgis.org/api/core/Abstract/QgsAbstractVectorLayerLabeling.html>
class but it seems there is no way to get the root rule (
QgsRuleBasedLabeling
<http://python.qgis.org/api/core/Rule/QgsRuleBasedLabeling.html>) from this
class. The only possibility I found is to get directly pal settings using
providers ids but I can't access to rules tree. Anyone have a clue ?
Thanks in advance for any help
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20180203/53998d82/attachment.html>
More information about the QGIS-Developer
mailing list