File tree 3 files changed +23
-0
lines changed
3 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -239,6 +239,9 @@ class QgsVectorLayer : QgsMapLayer
239
239
240
240
/** Select not selected features and deselect selected ones */
241
241
void invertSelection();
242
+
243
+ /** Select all the features */
244
+ void selectAll();
242
245
243
246
/** Invert selection of features found within the search rectangle (in layer's coordinates) */
244
247
void invertSelectionInRectangle( QgsRectangle & rect );
Original file line number Diff line number Diff line change @@ -812,6 +812,23 @@ void QgsVectorLayer::invertSelection()
812
812
setSelectedFeatures ( ids );
813
813
}
814
814
815
+ void QgsVectorLayer::selectAll ()
816
+ {
817
+ QgsFeatureIterator fit = getFeatures ( QgsFeatureRequest ()
818
+ .setFlags ( QgsFeatureRequest::NoGeometry )
819
+ .setSubsetOfAttributes ( QgsAttributeList () ) );
820
+
821
+ QgsFeatureIds ids;
822
+
823
+ QgsFeature fet;
824
+ while ( fit.nextFeature ( fet ) )
825
+ {
826
+ ids << fet.id ();
827
+ }
828
+
829
+ setSelectedFeatures ( ids );
830
+ }
831
+
815
832
void QgsVectorLayer::invertSelectionInRectangle ( QgsRectangle & rect )
816
833
{
817
834
// normalize the rectangle
Original file line number Diff line number Diff line change @@ -619,6 +619,9 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer
619
619
/* * Select not selected features and deselect selected ones */
620
620
void invertSelection ();
621
621
622
+ /* * Select all the features */
623
+ void selectAll ();
624
+
622
625
/* *
623
626
* Invert selection of features found within the search rectangle (in layer's coordinates)
624
627
*
You can’t perform that action at this time.
0 commit comments