Hi,

I'm developing a plugin that, amongst other things, generates maps
automatically.

I have two presets :
- one which is relative to the current map visualization, the standard one,
named "main"
- and another one, which is relative to the atlas generation, embedding the
styles of masks, named "atlas"

Each preset checks a different combination of layers.

The problem is that I don't really know which class to use : I noticed the
QgsVisibilityPresetCollection class and used the method
applyPresetCheckedLegendNodesToLayer(presetName, layerId), but it doesn't
affect the layer panel, nor the layer styles.

Here, I want to apply the "main" preset to a layer named Cities

layerName = 'Cities'
layer = QgsMapLayerRegistry.instance().mapLayersByName(layerName)[0]
QgsProject.instance().visibilityPresetCollection().applyPresetCheckedLegendNodesToLayer('main',
layer.id())


(Doesn't work)

Could you tell me how to achieve the preset selection ?

Any help would be appreciated,

Mathieu
_______________________________________________
QGIS-Developer mailing list
[email protected]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to