22 QString QgsRenameLayerAlgorithm::name()
const
24 return QStringLiteral(
"renamelayer" );
27 QgsProcessingAlgorithm::Flags QgsRenameLayerAlgorithm::flags()
const
29 return FlagHideFromToolbox;
32 QString QgsRenameLayerAlgorithm::displayName()
const
34 return QObject::tr(
"Rename layer" );
37 QStringList QgsRenameLayerAlgorithm::tags()
const
39 return QObject::tr(
"change,layer,name,title" ).split(
',' );
42 QString QgsRenameLayerAlgorithm::group()
const
44 return QObject::tr(
"Modeler tools" );
47 QString QgsRenameLayerAlgorithm::groupId()
const
49 return QStringLiteral(
"modelertools" );
52 QString QgsRenameLayerAlgorithm::shortHelpString()
const
54 return QObject::tr(
"This algorithm renames a layer." );
57 QgsRenameLayerAlgorithm *QgsRenameLayerAlgorithm::createInstance()
const
59 return new QgsRenameLayerAlgorithm();
62 void QgsRenameLayerAlgorithm::initAlgorithm(
const QVariantMap & )
71 QgsMapLayer *layer = parameterAsLayer( parameters, QStringLiteral(
"INPUT" ), context );
72 QString name = parameterAsString( parameters, QStringLiteral(
"NAME" ), context );
80 bool parameterWasLayerName = parameters.value( QStringLiteral(
"INPUT" ) ).toString() == layer->
name();
84 if ( parameterWasLayerName )
85 results.insert( QStringLiteral(
"OUTPUT" ), name );
87 results.insert( QStringLiteral(
"OUTPUT" ), parameters.value( QStringLiteral(
"INPUT" ) ) );
Base class for all map layer types.
void setName(const QString &name)
Set the display name of the layer.
Contains information about the context in which a processing algorithm is executed.
Custom exception class for processing related exceptions.
Base class for providing feedback from a processing algorithm.
A map layer output for processing algorithms, where layers may be either vector or raster.
A map layer parameter for processing algorithms.
A string parameter for processing algorithms.