Skip to content
Permalink
Browse files

add select all features methods for vector layers

  • Loading branch information
3nids committed May 22, 2013
1 parent b7f1987 commit e741ec947da160f3dc5df5579ad6b7e6d9790b06
Showing with 23 additions and 0 deletions.
  1. +3 −0 python/core/qgsvectorlayer.sip
  2. +17 −0 src/core/qgsvectorlayer.cpp
  3. +3 −0 src/core/qgsvectorlayer.h
@@ -239,6 +239,9 @@ class QgsVectorLayer : QgsMapLayer

/** Select not selected features and deselect selected ones */
void invertSelection();

/** Select all the features */
void selectAll();

/** Invert selection of features found within the search rectangle (in layer's coordinates) */
void invertSelectionInRectangle( QgsRectangle & rect );
@@ -812,6 +812,23 @@ void QgsVectorLayer::invertSelection()
setSelectedFeatures( ids );
}

void QgsVectorLayer::selectAll()
{
QgsFeatureIterator fit = getFeatures( QgsFeatureRequest()
.setFlags( QgsFeatureRequest::NoGeometry )
.setSubsetOfAttributes( QgsAttributeList() ) );

QgsFeatureIds ids;

QgsFeature fet;
while ( fit.nextFeature( fet ) )
{
ids << fet.id();
}

setSelectedFeatures( ids );
}

void QgsVectorLayer::invertSelectionInRectangle( QgsRectangle & rect )
{
// normalize the rectangle
@@ -619,6 +619,9 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer
/** Select not selected features and deselect selected ones */
void invertSelection();

/** Select all the features */
void selectAll();

/**
* Invert selection of features found within the search rectangle (in layer's coordinates)
*

0 comments on commit e741ec9

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