Skip to content

Commit

Permalink
Rename setAttributeAlias and removeAttributeAlias
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Oct 1, 2016
1 parent 9c11814 commit 37e06ae
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 16 deletions.
4 changes: 3 additions & 1 deletion doc/api_break.dox
Expand Up @@ -1415,7 +1415,9 @@ displayExpression instead. For the map tip use mapTipTemplate() instead.</li>
<li>Deleted attributeEditorElementFromDomElement
<li>editFormConfig() returns a copy instead of direct access (Use setEditFormConfig to update)
<li>Removed valueRelation(), replaced with QgsEditFormConfig::editorWidgetConfig
<li>Removed fieldNameIndex(), use QgsFields::lookupField() or QgsFields::indexFromName() instead
<li>Removed fieldNameIndex(), use fields().lookupField() or fields().indexFromName() instead
<li>Renamed addAttributeAlias() to setAttributeAlias()
<li>Renamed remAttributeAlias() to removeAttributeAlias()
</ul>

\subsection qgis_api_break_3_0_QgsVectorLayerEditBuffer QgsVectorLayerEditBuffer
Expand Down
18 changes: 13 additions & 5 deletions python/core/qgsvectorlayer.sip
Expand Up @@ -1073,17 +1073,25 @@ class QgsVectorLayer : QgsMapLayer
*/
bool addAttribute( const QgsField &field );

/** Sets an alias (a display name) for attributes to display in dialogs */
void addAttributeAlias( int attIndex, const QString& aliasString );
/**
* Sets an alias (a display name) for attributes to display in dialogs
*
* @note Added in QGIS 3.0
*/
void setAttributeAlias( int index, const QString& aliasString );

/** Removes an alias (a display name) for attributes to display in dialogs */
void remAttributeAlias( int attIndex );
/**
* Removes an alias (a display name) for attributes to display in dialogs
*
* @note Added in QGIS 3.0
*/
void removeAttributeAlias( int index );

/** Renames an attribute field (but does not commit it).
* @param attIndex attribute index
* @param newName new name of field
* @note added in QGIS 2.16
*/
*/
bool renameAttribute( int attIndex, const QString& newName );

/**
Expand Down
4 changes: 2 additions & 2 deletions src/app/qgsfieldsproperties.cpp
Expand Up @@ -765,11 +765,11 @@ void QgsFieldsProperties::attributesListCellChanged( int row, int column )
{
if ( !aliasItem->text().trimmed().isEmpty() )
{
mLayer->addAttributeAlias( idx, aliasItem->text() );
mLayer->setAttributeAlias( idx, aliasItem->text() );
}
else
{
mLayer->remAttributeAlias( idx );
mLayer->removeAttributeAlias( idx );
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/core/qgsvectorlayer.cpp
Expand Up @@ -2107,7 +2107,7 @@ bool QgsVectorLayer::addAttribute( const QgsField &field )
return mEditBuffer->addAttribute( field );
}

void QgsVectorLayer::remAttributeAlias( int attIndex )
void QgsVectorLayer::removeAttributeAlias( int attIndex )
{
if ( attIndex < 0 || attIndex >= fields().count() )
return;
Expand All @@ -2131,7 +2131,7 @@ bool QgsVectorLayer::renameAttribute( int attIndex, const QString& newName )
return mEditBuffer->renameAttribute( attIndex, newName );
}

void QgsVectorLayer::addAttributeAlias( int attIndex, const QString& aliasString )
void QgsVectorLayer::setAttributeAlias( int attIndex, const QString& aliasString )
{
if ( attIndex < 0 || attIndex >= fields().count() )
return;
Expand Down
18 changes: 13 additions & 5 deletions src/core/qgsvectorlayer.h
Expand Up @@ -1197,17 +1197,25 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer, public QgsExpressionConte
*/
bool addAttribute( const QgsField &field );

/** Sets an alias (a display name) for attributes to display in dialogs */
void addAttributeAlias( int attIndex, const QString& aliasString );
/**
* Sets an alias (a display name) for attributes to display in dialogs
*
* @note Added in QGIS 3.0
*/
void setAttributeAlias( int index, const QString& aliasString );

/** Removes an alias (a display name) for attributes to display in dialogs */
void remAttributeAlias( int attIndex );
/**
* Removes an alias (a display name) for attributes to display in dialogs
*
* @note Added in QGIS 3.0
*/
void removeAttributeAlias( int index );

/** Renames an attribute field (but does not commit it).
* @param attIndex attribute index
* @param newName new name of field
* @note added in QGIS 2.16
*/
*/
bool renameAttribute( int attIndex, const QString& newName );

/**
Expand Down
3 changes: 2 additions & 1 deletion src/providers/ogr/qgsogrfeatureiterator.cpp
Expand Up @@ -84,7 +84,8 @@ QgsOgrFeatureIterator::QgsOgrFeatureIterator( QgsOgrFeatureSource* source, bool
//ensure that all fields required for filter expressions are prepared
QSet<int> attributeIndexes = request.filterExpression()->referencedAttributeIndexes( mSource->mFields );
attributeIndexes += attrs.toSet();
mRequest.setSubsetOfAttributes( attributeIndexes.toList() );
attrs = attributeIndexes.toList();
mRequest.setSubsetOfAttributes( attrs );
}
if ( request.filterType() == QgsFeatureRequest::FilterExpression && request.filterExpression()->needsGeometry() )
{
Expand Down

0 comments on commit 37e06ae

Please sign in to comment.