[QGIS-Developer] QgsProcessingParameterMultipleLayers does not seem to use optional parameter

Jean-Charles Quillet jeancharles.quillet at gmail.com
Wed Mar 4 01:02:21 PST 2020


Hello,

I develop a processing algorithm for the toolbox. One of my parameters a
list of vector layers of type line, so in my initAlgorithm function I have
this statement:

        self.addParameter(
            QgsProcessingParameterMultipleLayers(
                self.INPUT_LINES,
                self.tr("Lines"),
                QgsProcessing.TypeVectorLine,
                optional=False
            )
        )

However, even if the optional parameter is set to False, it seems the user
can still set an empty list: so not setting anything actually. So for me,
this optional parameter doesn't work in this case.

Am I missing something here or is it a bug ? In this last case, I can
report it on github. I'm using QGIS on Windows 3.10.2-A Coruña

Thanks,

Jean-Charles
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20200304/19b828a0/attachment.html>


More information about the QGIS-Developer mailing list