@@ -3512,16 +3512,21 @@ void QgisApp::layerProperties()
35123512 showLayerProperties ( activeLayer () );
35133513}
35143514
3515- void QgisApp::deleteSelected ( QgsMapLayer *layer )
3515+ void QgisApp::deleteSelected ( QgsMapLayer *layer, QWidget* parent )
35163516{
35173517 if ( !layer )
35183518 {
35193519 layer = mMapLegend ->currentLayer ();
35203520 }
35213521
3522+ if ( !parent )
3523+ {
3524+ parent = this ;
3525+ }
3526+
35223527 if ( !layer )
35233528 {
3524- QMessageBox::information ( this ,
3529+ QMessageBox::information ( parent ,
35253530 tr ( " No Layer Selected" ),
35263531 tr ( " To delete features, you must select a vector layer in the legend" ) );
35273532 return ;
@@ -3530,37 +3535,37 @@ void QgisApp::deleteSelected( QgsMapLayer *layer )
35303535 QgsVectorLayer* vlayer = qobject_cast<QgsVectorLayer *>( layer );
35313536 if ( !vlayer )
35323537 {
3533- QMessageBox::information ( this ,
3538+ QMessageBox::information ( parent ,
35343539 tr ( " No Vector Layer Selected" ),
35353540 tr ( " Deleting features only works on vector layers" ) );
35363541 return ;
35373542 }
35383543
35393544 if ( !( vlayer->dataProvider ()->capabilities () & QgsVectorDataProvider::DeleteFeatures ) )
35403545 {
3541- QMessageBox::information ( this , tr ( " Provider does not support deletion" ),
3546+ QMessageBox::information ( parent , tr ( " Provider does not support deletion" ),
35423547 tr ( " Data provider does not support deleting features" ) );
35433548 return ;
35443549 }
35453550
35463551 if ( !vlayer->isEditable () )
35473552 {
3548- QMessageBox::information ( this , tr ( " Layer not editable" ),
3553+ QMessageBox::information ( parent , tr ( " Layer not editable" ),
35493554 tr ( " The current layer is not editable. Choose 'Start editing' in the digitizing toolbar." ) );
35503555 return ;
35513556 }
35523557
35533558 // display a warning
35543559 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 )
35563561 {
35573562 return ;
35583563 }
35593564
35603565 vlayer->beginEditCommand ( tr ( " Features deleted" ) );
35613566 if ( !vlayer->deleteSelectedFeatures () )
35623567 {
3563- QMessageBox::information ( this , tr ( " Problem deleting features" ),
3568+ QMessageBox::information ( parent , tr ( " Problem deleting features" ),
35643569 tr ( " A problem occured during deletion of features" ) );
35653570 }
35663571
0 commit comments