QGIS API Documentation 4.3.0-Master (729d6602d19)
Loading...
Searching...
No Matches
qgsprocessingmodelchildparametersource.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsprocessingmodelchildparametersource.h
3 ----------------------------------------
4 begin : June 2017
5 copyright : (C) 2017 by Nyall Dawson
6 email : nyall dot dawson at gmail dot com
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18#ifndef QGSPROCESSINGMODELCHILDPARAMETERSOURCE_H
19#define QGSPROCESSINGMODELCHILDPARAMETERSOURCE_H
20
21#include "qgis.h"
22#include "qgis_core.h"
23#include "qgsprocessing.h"
24
26class QgsProcessingModelAlgorithm;
27
29
34class CORE_EXPORT QgsProcessingModelChildParameterSource
35{
36 public:
41 QgsProcessingModelChildParameterSource() = default;
42
43 bool operator==( const QgsProcessingModelChildParameterSource &other ) const;
44 bool operator!=( const QgsProcessingModelChildParameterSource &other ) const { return !operator==( other ); }
45
52 static QgsProcessingModelChildParameterSource fromStaticValue( const QVariant &value );
53
60 static QgsProcessingModelChildParameterSource fromModelParameter( const QString &parameterName );
61
68 static QgsProcessingModelChildParameterSource fromChildOutput( const QString &childId, const QString &outputName );
69
80 static QgsProcessingModelChildParameterSource fromExpression( const QString &expression );
81
94 Q_DECL_DEPRECATED static QgsProcessingModelChildParameterSource fromExpressionText( const QString &text ) SIP_DEPRECATED;
95
100
106 void setSource( Qgis::ProcessingModelChildParameterSource source );
107
112 QVariant staticValue() const { return mStaticValue; }
113
118 void setStaticValue( const QVariant &value )
119 {
120 mStaticValue = value;
122 }
123
128 QString parameterName() const { return mParameterName; }
129
134 void setParameterName( const QString &name )
135 {
136 mParameterName = name;
138 }
139
145 QString outputChildId() const { return mChildId; }
146
152 void setOutputChildId( const QString &id )
153 {
154 mChildId = id;
156 }
157
163 QString outputName() const { return mOutputName; }
164
170 void setOutputName( const QString &name )
171 {
172 mOutputName = name;
174 }
175
180 QString expression() const { return mExpression; }
181
189 void setExpression( const QString &expression )
190 {
191 mExpression = expression;
193 }
194
201 Q_DECL_DEPRECATED QString expressionText() const SIP_DEPRECATED { return mExpressionText; }
202
212 Q_DECL_DEPRECATED void setExpressionText( const QString &text ) SIP_DEPRECATED
213 {
214 mExpressionText = text;
216 }
217
222 QVariant toVariant() const;
223
228 bool loadVariant( const QVariantMap &map );
229
235 QString asPythonCode( QgsProcessing::PythonOutputType outputType, const QgsProcessingParameterDefinition *definition, const QMap< QString, QString > &friendlyChildNames ) const;
236
242 QString asPythonComment( const QgsProcessingParameterDefinition *definition ) const;
243
248 QString friendlyIdentifier( QgsProcessingModelAlgorithm *model ) const;
249
250 private:
252 QVariant mStaticValue;
253 QString mParameterName;
254 QString mChildId;
255 QString mOutputName;
256 QString mExpression;
257 QString mExpressionText;
258};
259
260Q_DECLARE_METATYPE( QgsProcessingModelChildParameterSource );
261CORE_EXPORT QDataStream &operator<<( QDataStream &out, const QgsProcessingModelChildParameterSource &source );
262CORE_EXPORT QDataStream &operator>>( QDataStream &in, QgsProcessingModelChildParameterSource &source );
263
264#ifndef SIP_RUN
266typedef QList< QgsProcessingModelChildParameterSource > QgsProcessingModelChildParameterSources;
267#endif
268
270
271#endif // QGSPROCESSINGMODELCHILDPARAMETERSOURCE_H
ProcessingModelChildParameterSource
Processing model child parameter sources.
Definition qgis.h:4066
@ ExpressionText
Parameter value is taken from a text with expressions, evaluated just before the algorithm runs.
Definition qgis.h:4071
@ ChildOutput
Parameter value is taken from an output generated by a child algorithm.
Definition qgis.h:4068
@ ModelParameter
Parameter value is taken from a parent model parameter.
Definition qgis.h:4067
@ StaticValue
Parameter value is a static value.
Definition qgis.h:4069
@ Expression
Parameter value is taken from an expression, evaluated just before the algorithm runs.
Definition qgis.h:4070
Base class for the definition of processing parameters.
PythonOutputType
Available Python output types.
#define SIP_DEPRECATED
Definition qgis_sip.h:113
Q_DECLARE_METATYPE(QgsDatabaseQueryLogEntry)
QDataStream & operator<<(QDataStream &out, const QgsFeature &feature)
Writes the feature to stream out. QGIS version compatibility is not guaranteed.
QDataStream & operator>>(QDataStream &in, QgsFeature &feature)
Reads a feature from stream in into feature. QGIS version compatibility is not guaranteed.
bool operator==(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
bool operator!=(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)