QGIS API Documentation
3.26.3-Buenos Aires (65e4edfdad)
|
Go to the documentation of this file.
23 , mParentLayerParameterName( parentLayerParameterName )
39 if ( !input.isValid() )
42 if ( input.type() != QVariant::List )
45 const QVariantList inputList = input.toList();
46 for (
const QVariant &inputItem : inputList )
48 if ( inputItem.type() != QVariant::Map )
51 const QVariantMap inputItemMap = inputItem.toMap();
53 if ( !inputItemMap.contains(
"name" ) )
55 if ( !inputItemMap.contains(
"type" ) )
57 if ( !inputItemMap.contains(
"input" ) )
59 if ( !inputItemMap.contains(
"aggregate" ) )
77 QString code = QStringLiteral(
"QgsProcessingParameterAggregate('%1', %2" )
79 if ( !mParentLayerParameterName.isEmpty() )
83 code += QLatin1String(
", optional=True" );
94 map.insert( QStringLiteral(
"parent_layer" ), mParentLayerParameterName );
101 mParentLayerParameterName = map.value( QStringLiteral(
"parent_layer" ) ).toString();
108 if ( !mParentLayerParameterName.isEmpty() )
109 depends << mParentLayerParameterName;
115 return mParentLayerParameterName;
120 mParentLayerParameterName =
name;
virtual QVariantMap toVariantMap() const
Saves this parameter to a QVariantMap.
QString parentLayerParameterName() const
Returns the name of the parent layer parameter, or an empty string if this is not set.
QString description() const
Returns the description for the parameter.
QgsProcessingParameterAggregate(const QString &name, const QString &description=QString(), const QString &parentLayerParameterName=QString(), bool optional=false)
Constructor for QgsProcessingParameterAggregate.
Base class for the definition of processing parameters.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
static QString stringToPythonLiteral(const QString &string)
Converts a string to a Python string literal.
QStringList dependsOnOtherParameters() const override
Returns a list of other parameter names on which this parameter is dependent (e.g.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
QString type() const override
Unique parameter type name.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
@ PythonQgsProcessingAlgorithmSubclass
Full Python QgsProcessingAlgorithm subclass.
virtual bool fromVariantMap(const QVariantMap &map)
Restores this parameter to a QVariantMap.
Flags mFlags
Parameter flags.
Contains information about the context in which a processing algorithm is executed.
QString name() const
Returns the name of the parameter.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
static QString typeName()
Returns the type name for the parameter class.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
static QString variantToPythonLiteral(const QVariant &value)
Converts a variant to a Python literal.
@ FlagOptional
Parameter is optional.
PythonOutputType
Available Python output types.
void setParentLayerParameterName(const QString &name)
Sets the name of the parent layer parameter.