23 QString QgsSetProjectVariableAlgorithm::name()
const
25 return QStringLiteral(
"setprojectvariable" );
28 QgsProcessingAlgorithm::Flags QgsSetProjectVariableAlgorithm::flags()
const
35 QString QgsSetProjectVariableAlgorithm::displayName()
const
37 return QObject::tr(
"Set project variable" );
40 QStringList QgsSetProjectVariableAlgorithm::tags()
const
42 return QObject::tr(
"expression" ).split(
',' );
45 QString QgsSetProjectVariableAlgorithm::group()
const
47 return QObject::tr(
"Modeler tools" );
50 QString QgsSetProjectVariableAlgorithm::groupId()
const
52 return QStringLiteral(
"modelertools" );
55 QString QgsSetProjectVariableAlgorithm::shortDescription()
const
57 return QObject::tr(
"Sets an expression variable for the current project" );
60 QString QgsSetProjectVariableAlgorithm::shortHelpString()
const
62 return QObject::tr(
"This algorithm sets an expression variable for the current project." );
65 QgsSetProjectVariableAlgorithm *QgsSetProjectVariableAlgorithm::createInstance()
const
67 return new QgsSetProjectVariableAlgorithm();
73 const QString name = parameterAsString( parameters, QStringLiteral(
"NAME" ), context );
74 const QString value = parameterAsString( parameters, QStringLiteral(
"VALUE" ), context );
80 feedback->
pushInfo( QObject::tr(
"Set variable \'%1\' to \'%2\'" ).arg( name, value ) );
85 void QgsSetProjectVariableAlgorithm::initAlgorithm(
const QVariantMap & )
static void setProjectVariable(QgsProject *project, const QString &name, const QVariant &value)
Sets a project context variable.
@ FlagNotAvailableInStandaloneTool
Algorithm should not be available from the standalone "qgis_process" tool. Used to flag algorithms wh...
@ FlagHideFromToolbox
Algorithm should be hidden from the toolbox.
@ FlagSkipGenericModelLogging
When running as part of a model, the generic algorithm setup and results logging should be skipped.
Contains information about the context in which a processing algorithm is executed.
QgsProject * project() const
Returns the project in which the algorithm is being executed.
Custom exception class for processing related exceptions.
Base class for providing feedback from a processing algorithm.
virtual void pushInfo(const QString &info)
Pushes a general informational message from the algorithm.
A string parameter for processing algorithms.