[QGIS-Developer] How to set defaults to QgsProcessingParameterMultipleLayers

Nyall Dawson nyall.dawson at gmail.com
Sun Jan 29 16:33:30 PST 2023


On Sat, 28 Jan 2023 at 05:35, C Hamilton via QGIS-Developer
<qgis-developer at lists.osgeo.org> wrote:
>
> I just received a request to update the Density Analysis plugin density hash algorithms so they work with multiple layers and produce one density map based off of multiple input layers. In the algorithm I have replaced QgsProcessingParameterFeatureSource with QgsProcessingParameterMultipleLayers.
>
> Is there a way to automatically populate as default value of selected layers in QgsProcessingParameterMultipleLayers with the selected layers or selected groups of layers in the "Layer Panel"?  This would be incredibly useful.

You'd (unfortunately -- it's not a trivial change) need to do this via
a custom Processing widget wrapper, so that your parameter gets its
own widget class where you can implement this logic.

Nyall


>
> I am doing this as a QgsProcessingAlgorithm. The layerType to  QgsProcessingParameterMultipleLayers is QgsProcessing.TypeVectorPoint.
>
> Thanks for your help.
>
> Calvin
> _______________________________________________
> QGIS-Developer mailing list
> QGIS-Developer at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer


More information about the QGIS-Developer mailing list