24using namespace Qt::StringLiterals;
28QString QgsSetProjectVariableAlgorithm::name()
const
30 return u
"setprojectvariable"_s;
40QString QgsSetProjectVariableAlgorithm::displayName()
const
42 return QObject::tr(
"Set project variable" );
45QStringList QgsSetProjectVariableAlgorithm::tags()
const
47 return QObject::tr(
"expression" ).split(
',' );
50QString QgsSetProjectVariableAlgorithm::group()
const
52 return QObject::tr(
"Modeler tools" );
55QString QgsSetProjectVariableAlgorithm::groupId()
const
57 return u
"modelertools"_s;
60QString QgsSetProjectVariableAlgorithm::shortDescription()
const
62 return QObject::tr(
"Sets an expression variable for the current project." );
65QString QgsSetProjectVariableAlgorithm::shortHelpString()
const
67 return QObject::tr(
"This algorithm sets an expression variable for the current project." );
70QgsSetProjectVariableAlgorithm *QgsSetProjectVariableAlgorithm::createInstance()
const
72 return new QgsSetProjectVariableAlgorithm();
78 const QString name = parameterAsString( parameters, u
"NAME"_s, context );
79 const QString value = parameterAsString( parameters, u
"VALUE"_s, context );
85 feedback->
pushInfo( QObject::tr(
"Set variable \'%1\' to \'%2\'" ).arg( name, value ) );
90void QgsSetProjectVariableAlgorithm::initAlgorithm(
const QVariantMap & )
QFlags< ProcessingAlgorithmFlag > ProcessingAlgorithmFlags
Flags indicating how and when an algorithm operates and should be exposed to users.
@ NotAvailableInStandaloneTool
Algorithm should not be available from the standalone "qgis_process" tool. Used to flag algorithms wh...
@ HideFromToolbox
Algorithm should be hidden from the toolbox.
@ SkipGenericModelLogging
When running as part of a model, the generic algorithm setup and results logging should be skipped.
static void setProjectVariable(QgsProject *project, const QString &name, const QVariant &value)
Sets a project context variable.
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.