Index: src/app/qgisapp.cpp =================================================================== --- src/app/qgisapp.cpp (revision 14496) +++ src/app/qgisapp.cpp (working copy) @@ -873,33 +873,37 @@ mActionZoomOut->setStatusTip( tr( "Zoom Out" ) ); connect( mActionZoomOut, SIGNAL( triggered() ), this, SLOT( zoomOut() ) ); - mActionSelect = new QAction( getThemeIcon( "mActionSelect.png" ), tr( "Select Features" ) , this ); + QString singleSelectOptTip( tr( ", hold ctrl to add/subtract current selection" ) ); + + mActionSelect = new QAction( getThemeIcon( "mActionSelect.png" ), tr( "Select single feature" ) , this ); shortcuts->registerAction( mActionSelect ); - mActionSelect->setStatusTip( tr( "Select Features" ) ); + mActionSelect->setStatusTip( tr( "Select single features" ) + singleSelectOptTip ); connect( mActionSelect, SIGNAL( triggered() ), this, SLOT( select() ) ); mActionSelect->setEnabled( false ); + QString selectOptionTip( tr( ", hold shift to select by containment" ) + singleSelectOptTip ); + mActionSelectRectangle = new QAction( getThemeIcon( "mActionSelectRectangle.png" ), tr( "Select features by rectangle" ), this ); shortcuts->registerAction( mActionSelectRectangle ); - mActionSelectRectangle->setStatusTip( tr( "Select features by rectangle" ) ); + mActionSelectRectangle->setStatusTip( tr( "Select features by rectangle" ) + selectOptionTip ); connect( mActionSelectRectangle, SIGNAL( triggered() ), this, SLOT( selectByRectangle() ) ); mActionSelectRectangle->setEnabled( false ); mActionSelectPolygon = new QAction( getThemeIcon( "mActionSelectPolygon.png" ), tr( "Select features by polygon" ), this ); shortcuts->registerAction( mActionSelectPolygon ); - mActionSelectPolygon->setStatusTip( tr( "Select features by polygon" ) ); + mActionSelectPolygon->setStatusTip( tr( "Select features by polygon" ) + selectOptionTip ); connect( mActionSelectPolygon, SIGNAL( triggered() ), this, SLOT( selectByPolygon() ) ); mActionSelectPolygon->setEnabled( false ); mActionSelectFreehand = new QAction( getThemeIcon( "mActionSelectFreehand.png" ), tr( "Select features by freehand" ), this ); shortcuts->registerAction( mActionSelectFreehand ); - mActionSelectFreehand->setStatusTip( tr( "Select features by freehand" ) ); + mActionSelectFreehand->setStatusTip( tr( "Select features by freehand" ) + selectOptionTip ); connect( mActionSelectFreehand, SIGNAL( triggered() ), this, SLOT( selectByFreehand() ) ); mActionSelectFreehand->setEnabled( false ); mActionSelectRadius = new QAction( getThemeIcon( "mActionSelectRadius.png" ), tr( "Select features by radius" ), this ); shortcuts->registerAction( mActionSelectRadius ); - mActionSelectRadius->setStatusTip( tr( "Select features by radius" ) ); + mActionSelectRadius->setStatusTip( tr( "Select features by radius" ) + selectOptionTip); connect( mActionSelectRadius, SIGNAL( triggered() ), this, SLOT( selectByRadius() ) ); mActionSelectRadius->setEnabled( false ); Index: src/app/qgsmaptoolselect.cpp =================================================================== --- src/app/qgsmaptoolselect.cpp (revision 14496) +++ src/app/qgsmaptoolselect.cpp (working copy) @@ -46,9 +46,8 @@ QgsMapToolSelectUtils::expandSelectRectangle( selectRect, vlayer, e->pos() ); QgsMapToolSelectUtils::setRubberBand( mCanvas, selectRect, &rubberBand ); QgsGeometry* selectGeom = rubberBand.asGeometry(); - bool addSelection = e->modifiers() & Qt::ControlModifier ? true : false; - bool substractSelection = e->modifiers() & Qt::ShiftModifier ? true : false; - QgsMapToolSelectUtils::setSelectFeatures( mCanvas, selectGeom, false, addSelection, substractSelection, true ); + bool doDifference = e->modifiers() & Qt::ControlModifier ? true : false; + QgsMapToolSelectUtils::setSelectFeatures( mCanvas, selectGeom, false, doDifference, true ); delete selectGeom; rubberBand.reset( true ); } Index: src/app/qgsmaptoolselectutils.cpp =================================================================== --- src/app/qgsmaptoolselectutils.cpp (revision 14496) +++ src/app/qgsmaptoolselectutils.cpp (working copy) @@ -81,8 +81,7 @@ void QgsMapToolSelectUtils::setSelectFeatures( QgsMapCanvas* canvas, QgsGeometry* selectGeometry, bool doContains, - bool addSelection, - bool substractSelection, + bool doDifference, bool singleSelect ) { if( selectGeometry->type() != QGis::Polygon ) @@ -124,8 +123,7 @@ QgsDebugMsg( "Selection layer: " + vlayer->name() ); QgsDebugMsg( "Selection polygon: " + selectGeomTrans.exportToWkt() ); QgsDebugMsg( "doContains: " + QString( doContains ? "T" : "F" ) ); - QgsDebugMsg( "addSelection: " + QString( addSelection ? "T" : "F" ) ); - QgsDebugMsg( "substractSelection: " + QString( substractSelection ? "T" : "F" ) ); + QgsDebugMsg( "doDifference: " + QString( doDifference ? "T" : "F" ) ); vlayer->select( QgsAttributeList(), selectGeomTrans.boundingBox(), true, true ); @@ -161,30 +159,24 @@ newSelectedFeatures.insert( closestFeatureId ); } - QgsDebugMsg( "Number of selected features: " + QString::number( newSelectedFeatures.size() ) ); + QgsDebugMsg( "Number of new selected features: " + QString::number( newSelectedFeatures.size() ) ); QgsFeatureIds layerSelectedFeatures; - if( addSelection ) + if( doDifference ) { layerSelectedFeatures = vlayer->selectedFeaturesIds(); QgsFeatureIds::const_iterator i = newSelectedFeatures.constEnd(); while( i != newSelectedFeatures.constBegin() ) { --i; - layerSelectedFeatures.insert( *i ); - } - } - else if( substractSelection ) - { - layerSelectedFeatures = vlayer->selectedFeaturesIds(); - QgsFeatureIds::const_iterator i = newSelectedFeatures.constEnd(); - while( i != newSelectedFeatures.constBegin() ) - { - --i; - if( layerSelectedFeatures.contains( *i ) ) + if( layerSelectedFeatures.contains( *i ) ) { layerSelectedFeatures.remove( *i ); } + else + { + layerSelectedFeatures.insert( *i ); + } } } else @@ -198,8 +190,7 @@ void QgsMapToolSelectUtils::setSelectFeatures( QgsMapCanvas* canvas, QgsGeometry* selectGeometry, QMouseEvent * e ) { - bool doContains = e->modifiers() & Qt::AltModifier ? true : false; - bool addSelection = e->modifiers() & Qt::ControlModifier ? true : false; - bool substractSelection = e->modifiers() & Qt::ShiftModifier ? true : false; - setSelectFeatures( canvas, selectGeometry, doContains, addSelection, substractSelection ); + bool doContains = e->modifiers() & Qt::ShiftModifier ? true : false; + bool doDifference = e->modifiers() & Qt::ControlModifier ? true : false; + setSelectFeatures( canvas, selectGeometry, doContains, doDifference ); } Index: src/app/qgsmaptoolselectutils.h =================================================================== --- src/app/qgsmaptoolselectutils.h (revision 14496) +++ src/app/qgsmaptoolselectutils.h (working copy) @@ -40,17 +40,14 @@ must be in terms of the canvas coordinate system. @param doContains Features will only be selected if contained within the selection rubber band. - @param addSelection New selected features will be added to the layer's - currently selected features. - @param substractSelection New selected features will be subtracted from - the layer's currently selected features. + @param doDifference Take the symmetric difference of the the current selected + features and the new features found within the provided selectGeometry. @param singleSelect Only selects the closest feature to the selectGeometry. */ void setSelectFeatures( QgsMapCanvas* canvas, QgsGeometry* selectGeometry, bool doContains = true, - bool addSelection = false, - bool substractSelection = false, + bool doDifference = false, bool singleSelect = false ); /**