22QString QgsRenameTableFieldAlgorithm::name()
const
24 return QStringLiteral(
"renametablefield" );
27QString QgsRenameTableFieldAlgorithm::displayName()
const
29 return QObject::tr(
"Rename field" );
32QString QgsRenameTableFieldAlgorithm::shortHelpString()
const
34 return QObject::tr(
"This algorithm renames an existing field from a vector layer." );
37QString QgsRenameTableFieldAlgorithm::shortDescription()
const
39 return QObject::tr(
"Renames an existing field from a vector layer." );
42QStringList QgsRenameTableFieldAlgorithm::tags()
const
44 return QObject::tr(
"rename,attribute,fields,table,change" ).split(
',' );
47QString QgsRenameTableFieldAlgorithm::group()
const
49 return QObject::tr(
"Vector table" );
52QString QgsRenameTableFieldAlgorithm::groupId()
const
54 return QStringLiteral(
"vectortable" );
57QString QgsRenameTableFieldAlgorithm::outputName()
const
59 return QObject::tr(
"Renamed" );
62QList<int> QgsRenameTableFieldAlgorithm::inputLayerTypes()
const
72QgsRenameTableFieldAlgorithm *QgsRenameTableFieldAlgorithm::createInstance()
const
74 return new QgsRenameTableFieldAlgorithm();
77void QgsRenameTableFieldAlgorithm::initParameters(
const QVariantMap & )
79 addParameter(
new QgsProcessingParameterField( QStringLiteral(
"FIELD" ), QObject::tr(
"Field to rename" ), QVariant(), QStringLiteral(
"INPUT" ) ) );
83QgsFields 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 );
109bool QgsRenameTableFieldAlgorithm::supportInPlaceEdit(
const QgsMapLayer *layer )
const
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Container of fields for a vector layer.
int lookupField(const QString &fieldName) const
Looks up field's index from the field name.
bool rename(int fieldIdx, const QString &name)
Renames a name of field.
Base class for all map layer types.
Contains information about the context in which a processing algorithm is executed.
Custom exception class for processing related exceptions.
Flag
Flags controlling how QgsProcessingFeatureSource fetches features.
@ FlagSkipGeometryValidityChecks
Invalid geometry checks should always be skipped. This flag can be useful for algorithms which always...
Base class for providing feedback from a processing algorithm.
A vector layer or feature source field parameter for processing algorithms.
A string parameter for processing algorithms.
@ TypeVector
Tables (i.e. vector layers with or without geometry). When used for a sink this indicates the sink ha...
QList< QgsFeature > QgsFeatureList