Skip to content

Commit 635abe2

Browse files
author
wonder
committed
Added QgsVectorLayer::deselect()
git-svn-id: http://svn.osgeo.org/qgis/trunk@9729 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 3d97dc4 commit 635abe2

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

python/core/qgsvectorlayer.sip

+3
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,9 @@ public slots:
367367
/** Select feature by its ID, optionally emit signal selectionChanged() */
368368
void select(int featureId, bool emitSignal = TRUE);
369369

370+
/** Deselect feature by its ID, optionally emit signal selectionChanged() */
371+
void deselect( int featureId, bool emitSignal = TRUE );
372+
370373
/** Clear selection */
371374
void removeSelection(bool emitSignal = TRUE);
372375

src/core/qgsvectorlayer.cpp

+10
Original file line numberDiff line numberDiff line change
@@ -820,6 +820,16 @@ void QgsVectorLayer::select( int number, bool emitSignal )
820820
}
821821
}
822822

823+
void QgsVectorLayer::deselect( int number, bool emitSignal )
824+
{
825+
mSelectedFeatureIds.remove( number );
826+
827+
if ( emitSignal )
828+
{
829+
emit selectionChanged();
830+
}
831+
}
832+
823833
void QgsVectorLayer::select( QgsRectangle & rect, bool lock )
824834
{
825835
// normalize the rectangle

src/core/qgsvectorlayer.h

+3
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,9 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer
424424
public slots:
425425
/** Select feature by its ID, optionally emit signal selectionChanged() */
426426
void select( int featureId, bool emitSignal = TRUE );
427+
428+
/** Deselect feature by its ID, optionally emit signal selectionChanged() */
429+
void deselect( int featureId, bool emitSignal = TRUE );
427430

428431
/** Clear selection */
429432
void removeSelection( bool emitSignal = TRUE );

0 commit comments

Comments
 (0)