[QGIS-it-user] errore in QgsProcessingParameterEnum

Salve a tutti

sto cercando di utilizzare la classe QgsProcessingParameterEnum in un mio script.

Ho scritto le seguenti linee, credo siano corrette, ma ottengo l’errore

3D select statistics

self.addParameter(QgsProcessingParameterEnum(
name = self.STATISTICS,
description = self.tr(‘Statistics to calculate’),
options = “”,
allowMultiple=True,
defaultValue=[2],
optional = False))

TypeError: QgsProcessingParameterEnum(): arguments did not match any overloaded call:
overload 1: argument ‘options’ has unexpected type ‘str’
overload 2: not enough arguments

Sapete dirmi dove sbaglio?

Grazie

Ciao Giacomo,

Giacomo Fontanelli-2 wrote

TypeError: QgsProcessingParameterEnum(): arguments did not match any
overloaded call:
overload 1: argument 'options' has unexpected type 'str'

l'errore dipende dal fatto che hai impostato il parametro "options" con una
stringa, mentre per esso deve essere usata una lista di stringhe (vedi [1]).
Quindi, nel tuo caso options=
Comunque tale parametro dovrebbe essere opzionale e quindi potresti
ometterlo.

A presto.

Andrea

[1]
https://qgis.org/pyqgis/3.16/core/QgsProcessingParameterEnum.html#qgis.core.QgsProcessingParameterEnum.options

--
Sent from: http://osgeo-org.1560.x6.nabble.com/QGIS-Italian-User-f5250612.html