Skip to content

Commit

Permalink
Don't show prompt on empty group
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanW2 committed Jan 21, 2017
1 parent 72551fb commit 2bedaf8
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/app/qgisapp.cpp
Expand Up @@ -8502,6 +8502,15 @@ void QgisApp::removeLayer()
}

bool promptConfirmation = QSettings().value( QStringLiteral( "qgis/askToDeleteLayers" ), true ).toBool();

// Don't show prompt to remove a empty group.
if ( selectedNodes.count() == 1
&& selectedNodes.at( 0 )->nodeType() == QgsLayerTreeNode::NodeGroup
&& selectedNodes.at( 0 )->children().count() == 0 )
{
promptConfirmation = false;
}

bool shiftHeld = QApplication::queryKeyboardModifiers().testFlag( Qt::ShiftModifier );
//display a warning
if ( !shiftHeld && promptConfirmation && QMessageBox::warning( this, tr( "Remove layers and groups" ), tr( "Remove %n legend entries?", "number of legend items to remove", selectedNodes.count() ), QMessageBox::Ok | QMessageBox::Cancel ) == QMessageBox::Cancel )
Expand Down

0 comments on commit 2bedaf8

Please sign in to comment.