Skip to content
Permalink
Browse files

Rename QgsVectorLayer::pkAttributeList to primaryKeyAttributes() for …

…consistency
  • Loading branch information
nyalldawson committed Jan 14, 2018
1 parent 21c8956 commit ded9b0978d5987e29716f66ca89da7db894d1e06
@@ -2433,7 +2433,7 @@ displayExpression instead. For the map tip use mapTipTemplate() instead.
- splitFeatured() now returns QgsGeometry::OperationResult enum, integer representation of returned values may have changed
- pendingFields() was dropped. Use fields() instead.
- pendingAllAttributesList() was dropped. Use allAttributes() instead.
- pendingPkAttributesList() was dropped. Use pkAttributeList() instead.
- pendingPkAttributesList() and pkAttributeList() were dropped. Use primaryKeyAttributes() instead.
- pendingFeatureCount() was dropped. Use featureCount() instead.


@@ -1397,10 +1397,9 @@ This also includes fields which have not yet been saved to the provider.
QgsAttributeList attributeList() const;
%Docstring
Returns list of attribute indexes. i.e. a list from 0 ... fieldCount()
Alias for attributeList()
%End

QgsAttributeList pkAttributeList() const;
QgsAttributeList primaryKeyAttributes() const;
%Docstring
Returns the list of attributes which make up the layer's primary keys.
%End
@@ -2554,7 +2554,7 @@ bool QgsVectorLayer::deleteFeatures( const QgsFeatureIds &fids )
return res;
}

QgsAttributeList QgsVectorLayer::pkAttributeList() const
QgsAttributeList QgsVectorLayer::primaryKeyAttributes() const
{
QgsAttributeList pkAttributesList;

@@ -4082,7 +4082,7 @@ QString QgsVectorLayer::htmlMetadata() const
myMetadata += QStringLiteral( "<h1>" ) + tr( "Fields" ) + QStringLiteral( "</h1>\n<hr>\n<table class=\"list-view\">\n" );

// primary key
QgsAttributeList pkAttrList = pkAttributeList();
QgsAttributeList pkAttrList = primaryKeyAttributes();
if ( !pkAttrList.isEmpty() )
{
myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" ) + tr( "Primary key attributes" ) + QStringLiteral( "</td><td>" );
@@ -1304,14 +1304,13 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer, public QgsExpressionConte

/**
* Returns list of attribute indexes. i.e. a list from 0 ... fieldCount()
* Alias for attributeList()
*/
inline QgsAttributeList attributeList() const { return mFields.allAttributesList(); }

/**
* Returns the list of attributes which make up the layer's primary keys.
*/
QgsAttributeList pkAttributeList() const;
QgsAttributeList primaryKeyAttributes() const;

/**
* Returns feature count including changes which have not yet been committed
@@ -34,7 +34,7 @@ bool QgsVectorLayerTools::copyMoveFeatures( QgsVectorLayer *layer, QgsFeatureReq

QgsFeatureIterator fi = layer->getFeatures( request );
QgsFeature f;
QgsAttributeList pkAttrList = layer->pkAttributeList();
QgsAttributeList pkAttrList = layer->primaryKeyAttributes();

int browsedFeatureCount = 0;
int couldNotWriteCount = 0;
@@ -758,7 +758,7 @@ def testKey(lyr, key, kfnames):
self.assertEqual(oflds.size(), flds.size())
for i in range(oflds.size()):
self.assertEqual(oflds[i].name(), flds[i].name())
pks = olyr.pkAttributeList()
pks = olyr.primaryKeyAttributes()
self.assertEqual(len(pks), len(kfnames))
for i in range(0, len(kfnames)):
self.assertEqual(oflds[pks[i]].name(), kfnames[i])

0 comments on commit ded9b09

Please sign in to comment.
You can’t perform that action at this time.