22QgsProcessingModelOutput::QgsProcessingModelOutput(
const QString &name,
const QString &description )
23 : QgsProcessingModelComponent( description )
27QgsProcessingModelOutput *QgsProcessingModelOutput::clone()
const
29 return new QgsProcessingModelOutput( *
this );
32QVariant QgsProcessingModelOutput::toVariant()
const
35 map.insert( QStringLiteral(
"name" ), mName );
37 if ( mDefaultValue.userType() == QMetaType::type(
"QgsProcessingOutputLayerDefinition" ) )
40 defaultMap.insert( QStringLiteral(
"class" ), QStringLiteral(
"QgsProcessingOutputLayerDefinition" ) );
41 map.insert( QStringLiteral(
"default_value" ), defaultMap );
45 map.insert( QStringLiteral(
"default_value" ), mDefaultValue );
48 map.insert( QStringLiteral(
"child_id" ), mChildId );
49 map.insert( QStringLiteral(
"output_name" ), mOutputName );
50 map.insert( QStringLiteral(
"mandatory" ), mMandatory );
51 saveCommonProperties( map );
55bool QgsProcessingModelOutput::loadVariant(
const QVariantMap &map )
57 mName = map.value( QStringLiteral(
"name" ) ).toString();
59 const QVariant defaultValue = map.value( QStringLiteral(
"default_value" ) );
60 if ( defaultValue.type() == QVariant::Map )
62 QVariantMap defaultMap = defaultValue.toMap();
63 if ( defaultMap[
"class"] == QLatin1String(
"QgsProcessingOutputLayerDefinition" ) )
67 mDefaultValue = QVariant( value );
71 mDefaultValue = QVariant();
76 mDefaultValue = map.value( QStringLiteral(
"default_value" ) );
79 mChildId = map.value( QStringLiteral(
"child_id" ) ).toString();
80 mOutputName = map.value( QStringLiteral(
"output_name" ) ).toString();
81 mMandatory = map.value( QStringLiteral(
"mandatory" ),
false ).toBool();
82 restoreCommonProperties( map );
Encapsulates settings relating to a feature sink or output raster layer for a processing algorithm.
bool loadVariant(const QVariantMap &map)
Loads this output layer definition from a QVariantMap, wrapped in a QVariant.