22QString QgsRenameLayerAlgorithm::name()
const
24 return QStringLiteral(
"renamelayer" );
27QgsProcessingAlgorithm::Flags QgsRenameLayerAlgorithm::flags()
const
29 return FlagHideFromToolbox;
32QString QgsRenameLayerAlgorithm::displayName()
const
34 return QObject::tr(
"Rename layer" );
37QStringList QgsRenameLayerAlgorithm::tags()
const
39 return QObject::tr(
"change,layer,name,title" ).split(
',' );
42QString QgsRenameLayerAlgorithm::group()
const
44 return QObject::tr(
"Modeler tools" );
47QString QgsRenameLayerAlgorithm::groupId()
const
49 return QStringLiteral(
"modelertools" );
52QString QgsRenameLayerAlgorithm::shortHelpString()
const
54 return QObject::tr(
"This algorithm renames a layer." );
57QgsRenameLayerAlgorithm *QgsRenameLayerAlgorithm::createInstance()
const
59 return new QgsRenameLayerAlgorithm();
62void QgsRenameLayerAlgorithm::initAlgorithm(
const QVariantMap & )
71 QgsMapLayer *layer = parameterAsLayer( parameters, QStringLiteral(
"INPUT" ), context );
72 const QString name = parameterAsString( parameters, QStringLiteral(
"NAME" ), context );
80 const 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.