@@ -3512,16 +3512,21 @@ void QgisApp::layerProperties()
3512
3512
showLayerProperties ( activeLayer () );
3513
3513
}
3514
3514
3515
- void QgisApp::deleteSelected ( QgsMapLayer *layer )
3515
+ void QgisApp::deleteSelected ( QgsMapLayer *layer, QWidget* parent )
3516
3516
{
3517
3517
if ( !layer )
3518
3518
{
3519
3519
layer = mMapLegend ->currentLayer ();
3520
3520
}
3521
3521
3522
+ if ( !parent )
3523
+ {
3524
+ parent = this ;
3525
+ }
3526
+
3522
3527
if ( !layer )
3523
3528
{
3524
- QMessageBox::information ( this ,
3529
+ QMessageBox::information ( parent ,
3525
3530
tr ( " No Layer Selected" ),
3526
3531
tr ( " To delete features, you must select a vector layer in the legend" ) );
3527
3532
return ;
@@ -3530,37 +3535,37 @@ void QgisApp::deleteSelected( QgsMapLayer *layer )
3530
3535
QgsVectorLayer* vlayer = qobject_cast<QgsVectorLayer *>( layer );
3531
3536
if ( !vlayer )
3532
3537
{
3533
- QMessageBox::information ( this ,
3538
+ QMessageBox::information ( parent ,
3534
3539
tr ( " No Vector Layer Selected" ),
3535
3540
tr ( " Deleting features only works on vector layers" ) );
3536
3541
return ;
3537
3542
}
3538
3543
3539
3544
if ( !( vlayer->dataProvider ()->capabilities () & QgsVectorDataProvider::DeleteFeatures ) )
3540
3545
{
3541
- QMessageBox::information ( this , tr ( " Provider does not support deletion" ),
3546
+ QMessageBox::information ( parent , tr ( " Provider does not support deletion" ),
3542
3547
tr ( " Data provider does not support deleting features" ) );
3543
3548
return ;
3544
3549
}
3545
3550
3546
3551
if ( !vlayer->isEditable () )
3547
3552
{
3548
- QMessageBox::information ( this , tr ( " Layer not editable" ),
3553
+ QMessageBox::information ( parent , tr ( " Layer not editable" ),
3549
3554
tr ( " The current layer is not editable. Choose 'Start editing' in the digitizing toolbar." ) );
3550
3555
return ;
3551
3556
}
3552
3557
3553
3558
// display a warning
3554
3559
int numberOfDeletedFeatures = vlayer->selectedFeaturesIds ().size ();
3555
- if ( QMessageBox::warning ( this , tr ( " Delete features" ), tr ( " Delete %n feature(s)?" , " number of features to delete" , numberOfDeletedFeatures ), QMessageBox::Ok, QMessageBox::Cancel ) == QMessageBox::Cancel )
3560
+ if ( QMessageBox::warning ( parent , tr ( " Delete features" ), tr ( " Delete %n feature(s)?" , " number of features to delete" , numberOfDeletedFeatures ), QMessageBox::Ok, QMessageBox::Cancel ) == QMessageBox::Cancel )
3556
3561
{
3557
3562
return ;
3558
3563
}
3559
3564
3560
3565
vlayer->beginEditCommand ( tr ( " Features deleted" ) );
3561
3566
if ( !vlayer->deleteSelectedFeatures () )
3562
3567
{
3563
- QMessageBox::information ( this , tr ( " Problem deleting features" ),
3568
+ QMessageBox::information ( parent , tr ( " Problem deleting features" ),
3564
3569
tr ( " A problem occured during deletion of features" ) );
3565
3570
}
3566
3571
0 commit comments