Skip to content

Commit 37e06ae

Browse files
committed
Rename setAttributeAlias and removeAttributeAlias
1 parent 9c11814 commit 37e06ae

File tree

6 files changed

+35
-16
lines changed

6 files changed

+35
-16
lines changed

doc/api_break.dox

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1415,7 +1415,9 @@ displayExpression instead. For the map tip use mapTipTemplate() instead.</li>
14151415
<li>Deleted attributeEditorElementFromDomElement
14161416
<li>editFormConfig() returns a copy instead of direct access (Use setEditFormConfig to update)
14171417
<li>Removed valueRelation(), replaced with QgsEditFormConfig::editorWidgetConfig
1418-
<li>Removed fieldNameIndex(), use QgsFields::lookupField() or QgsFields::indexFromName() instead
1418+
<li>Removed fieldNameIndex(), use fields().lookupField() or fields().indexFromName() instead
1419+
<li>Renamed addAttributeAlias() to setAttributeAlias()
1420+
<li>Renamed remAttributeAlias() to removeAttributeAlias()
14191421
</ul>
14201422

14211423
\subsection qgis_api_break_3_0_QgsVectorLayerEditBuffer QgsVectorLayerEditBuffer

python/core/qgsvectorlayer.sip

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1073,17 +1073,25 @@ class QgsVectorLayer : QgsMapLayer
10731073
*/
10741074
bool addAttribute( const QgsField &field );
10751075

1076-
/** Sets an alias (a display name) for attributes to display in dialogs */
1077-
void addAttributeAlias( int attIndex, const QString& aliasString );
1076+
/**
1077+
* Sets an alias (a display name) for attributes to display in dialogs
1078+
*
1079+
* @note Added in QGIS 3.0
1080+
*/
1081+
void setAttributeAlias( int index, const QString& aliasString );
10781082

1079-
/** Removes an alias (a display name) for attributes to display in dialogs */
1080-
void remAttributeAlias( int attIndex );
1083+
/**
1084+
* Removes an alias (a display name) for attributes to display in dialogs
1085+
*
1086+
* @note Added in QGIS 3.0
1087+
*/
1088+
void removeAttributeAlias( int index );
10811089

10821090
/** Renames an attribute field (but does not commit it).
10831091
* @param attIndex attribute index
10841092
* @param newName new name of field
10851093
* @note added in QGIS 2.16
1086-
*/
1094+
*/
10871095
bool renameAttribute( int attIndex, const QString& newName );
10881096

10891097
/**

src/app/qgsfieldsproperties.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -765,11 +765,11 @@ void QgsFieldsProperties::attributesListCellChanged( int row, int column )
765765
{
766766
if ( !aliasItem->text().trimmed().isEmpty() )
767767
{
768-
mLayer->addAttributeAlias( idx, aliasItem->text() );
768+
mLayer->setAttributeAlias( idx, aliasItem->text() );
769769
}
770770
else
771771
{
772-
mLayer->remAttributeAlias( idx );
772+
mLayer->removeAttributeAlias( idx );
773773
}
774774
}
775775
}

src/core/qgsvectorlayer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2107,7 +2107,7 @@ bool QgsVectorLayer::addAttribute( const QgsField &field )
21072107
return mEditBuffer->addAttribute( field );
21082108
}
21092109

2110-
void QgsVectorLayer::remAttributeAlias( int attIndex )
2110+
void QgsVectorLayer::removeAttributeAlias( int attIndex )
21112111
{
21122112
if ( attIndex < 0 || attIndex >= fields().count() )
21132113
return;
@@ -2131,7 +2131,7 @@ bool QgsVectorLayer::renameAttribute( int attIndex, const QString& newName )
21312131
return mEditBuffer->renameAttribute( attIndex, newName );
21322132
}
21332133

2134-
void QgsVectorLayer::addAttributeAlias( int attIndex, const QString& aliasString )
2134+
void QgsVectorLayer::setAttributeAlias( int attIndex, const QString& aliasString )
21352135
{
21362136
if ( attIndex < 0 || attIndex >= fields().count() )
21372137
return;

src/core/qgsvectorlayer.h

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1197,17 +1197,25 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer, public QgsExpressionConte
11971197
*/
11981198
bool addAttribute( const QgsField &field );
11991199

1200-
/** Sets an alias (a display name) for attributes to display in dialogs */
1201-
void addAttributeAlias( int attIndex, const QString& aliasString );
1200+
/**
1201+
* Sets an alias (a display name) for attributes to display in dialogs
1202+
*
1203+
* @note Added in QGIS 3.0
1204+
*/
1205+
void setAttributeAlias( int index, const QString& aliasString );
12021206

1203-
/** Removes an alias (a display name) for attributes to display in dialogs */
1204-
void remAttributeAlias( int attIndex );
1207+
/**
1208+
* Removes an alias (a display name) for attributes to display in dialogs
1209+
*
1210+
* @note Added in QGIS 3.0
1211+
*/
1212+
void removeAttributeAlias( int index );
12051213

12061214
/** Renames an attribute field (but does not commit it).
12071215
* @param attIndex attribute index
12081216
* @param newName new name of field
12091217
* @note added in QGIS 2.16
1210-
*/
1218+
*/
12111219
bool renameAttribute( int attIndex, const QString& newName );
12121220

12131221
/**

src/providers/ogr/qgsogrfeatureiterator.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ QgsOgrFeatureIterator::QgsOgrFeatureIterator( QgsOgrFeatureSource* source, bool
8484
//ensure that all fields required for filter expressions are prepared
8585
QSet<int> attributeIndexes = request.filterExpression()->referencedAttributeIndexes( mSource->mFields );
8686
attributeIndexes += attrs.toSet();
87-
mRequest.setSubsetOfAttributes( attributeIndexes.toList() );
87+
attrs = attributeIndexes.toList();
88+
mRequest.setSubsetOfAttributes( attrs );
8889
}
8990
if ( request.filterType() == QgsFeatureRequest::FilterExpression && request.filterExpression()->needsGeometry() )
9091
{

0 commit comments

Comments
 (0)