22 QString QgsRenameTableFieldAlgorithm::name()
const
24 return QStringLiteral(
"renametablefield" );
27 QString QgsRenameTableFieldAlgorithm::displayName()
const
29 return QObject::tr(
"Rename field" );
32 QString QgsRenameTableFieldAlgorithm::shortHelpString()
const
34 return QObject::tr(
"This algorithm renames an existing field from a vector layer." );
37 QString QgsRenameTableFieldAlgorithm::shortDescription()
const
39 return QObject::tr(
"Renames an existing field from a vector layer." );
42 QStringList QgsRenameTableFieldAlgorithm::tags()
const
44 return QObject::tr(
"rename,attribute,fields,table,change" ).split(
',' );
47 QString QgsRenameTableFieldAlgorithm::group()
const
49 return QObject::tr(
"Vector table" );
52 QString QgsRenameTableFieldAlgorithm::groupId()
const
54 return QStringLiteral(
"vectortable" );
57 QString QgsRenameTableFieldAlgorithm::outputName()
const
59 return QObject::tr(
"Renamed" );
62 QList<int> QgsRenameTableFieldAlgorithm::inputLayerTypes()
const
72 QgsRenameTableFieldAlgorithm *QgsRenameTableFieldAlgorithm::createInstance()
const
74 return new QgsRenameTableFieldAlgorithm();
77 void QgsRenameTableFieldAlgorithm::initParameters(
const QVariantMap & )
79 addParameter(
new QgsProcessingParameterField( QStringLiteral(
"FIELD" ), QObject::tr(
"Field to rename" ), QVariant(), QStringLiteral(
"INPUT" ) ) );
83 QgsFields QgsRenameTableFieldAlgorithm::outputFields(
const QgsFields &inputFields )
const
86 const int index = outFields.
lookupField( mOriginalName );
88 throw QgsProcessingException( QObject::tr(
"Field %1 could not be found in input table" ).arg( mOriginalName ) );
93 outFields.
rename( index, mNewName );
99 mOriginalName = parameterAsString( parameters, QStringLiteral(
"FIELD" ), context );
100 mNewName = parameterAsString( parameters, QStringLiteral(
"NEW_NAME" ), context );
109 bool QgsRenameTableFieldAlgorithm::supportInPlaceEdit(
const QgsMapLayer *layer )
const