Merge pull request #6863 from m-kuhn/selectedfeaturedeletecount

Show feature count and layer when asking for delete confirmation
This commit is contained in:
Matthias Kuhn 2018-05-01 12:57:47 +02:00 committed by GitHub
commit f1aaa144ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7326,7 +7326,7 @@ void QgisApp::deleteSelected( QgsMapLayer *layer, QWidget *parent, bool checkFea
}
//validate selection
int numberOfSelectedFeatures = vlayer->selectedFeatureIds().size();
const int numberOfSelectedFeatures = vlayer->selectedFeatureCount();
if ( numberOfSelectedFeatures == 0 )
{
messageBar()->pushMessage( tr( "No Features Selected" ),
@ -7354,7 +7354,7 @@ void QgisApp::deleteSelected( QgsMapLayer *layer, QWidget *parent, bool checkFea
if ( !allFeaturesInView )
{
// for extra safety to make sure we are not removing geometries by accident
int res = QMessageBox::warning( mMapCanvas, tr( "Delete features" ),
int res = QMessageBox::warning( mMapCanvas, tr( "Delete %n feature(s) from layer \"%1\"", nullptr, numberOfSelectedFeatures ).arg( vlayer->name() ),
tr( "Some of the selected features are outside of the current map view. Would you still like to continue?" ),
QMessageBox::Yes | QMessageBox::No );
if ( res != QMessageBox::Yes )
@ -7367,7 +7367,7 @@ void QgisApp::deleteSelected( QgsMapLayer *layer, QWidget *parent, bool checkFea
if ( !vlayer->deleteSelectedFeatures( &deletedCount ) )
{
messageBar()->pushMessage( tr( "Problem deleting features" ),
tr( "A problem occurred during deletion of %1 feature(s)" ).arg( numberOfSelectedFeatures - deletedCount ),
tr( "A problem occurred during deletion from layer \"%1\". %n feature(s) not deleted.", nullptr, numberOfSelectedFeatures - deletedCount ).arg( vlayer->name() ),
Qgis::Warning );
}
else