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 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" ) ) );