22using namespace Qt::StringLiterals;
26QString QgsRenameLayerAlgorithm::name()
const
28 return u
"renamelayer"_s;
36QString QgsRenameLayerAlgorithm::displayName()
const
38 return QObject::tr(
"Rename layer" );
41QStringList QgsRenameLayerAlgorithm::tags()
const
43 return QObject::tr(
"change,layer,name,title" ).split(
',' );
46QString QgsRenameLayerAlgorithm::group()
const
48 return QObject::tr(
"Modeler tools" );
51QString QgsRenameLayerAlgorithm::groupId()
const
53 return u
"modelertools"_s;
56QString QgsRenameLayerAlgorithm::shortHelpString()
const
58 return QObject::tr(
"This algorithm renames a layer." );
61QString QgsRenameLayerAlgorithm::shortDescription()
const
63 return QObject::tr(
"Renames a layer." );
66QgsRenameLayerAlgorithm *QgsRenameLayerAlgorithm::createInstance()
const
68 return new QgsRenameLayerAlgorithm();
71void QgsRenameLayerAlgorithm::initAlgorithm(
const QVariantMap & )
80 QgsMapLayer *layer = parameterAsLayer( parameters, u
"INPUT"_s, context );
81 const QString name = parameterAsString( parameters, u
"NAME"_s, context );
89 const bool parameterWasLayerName = parameters.value( u
"INPUT"_s ).toString() == layer->
name();
93 if ( parameterWasLayerName )
94 results.insert( u
"OUTPUT"_s, name );
96 results.insert( u
"OUTPUT"_s, parameters.value( u
"INPUT"_s ) );
QFlags< ProcessingAlgorithmFlag > ProcessingAlgorithmFlags
Flags indicating how and when an algorithm operates and should be exposed to users.
@ HideFromToolbox
Algorithm should be hidden from the toolbox.
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.