Skip to content
Permalink
Browse files

Ask confirmation before removing a map theme

  • Loading branch information
DelazJ committed Nov 18, 2017
1 parent af6b4cc commit ecde835a30fc170e88e5b1b495ea0dcf3bc2f9e1
Showing with 9 additions and 3 deletions.
  1. +9 −3 src/app/qgsmapthemes.cpp
@@ -156,11 +156,17 @@ void QgsMapThemes::applyState( const QString &presetName )

void QgsMapThemes::removeCurrentPreset()
{
Q_FOREACH ( QAction *a, mMenuPresetActions )
for ( QAction *actionPreset : qgis::as_const( mMenuPresetActions ) )
{
if ( a->isChecked() )
if ( actionPreset->isChecked() )
{
QgsProject::instance()->mapThemeCollection()->removeMapTheme( a->text() );
int res = QMessageBox::question( mMenu, tr( "Remove Theme" ),
trUtf8( "Are you sure you want to remove the existing theme “%1”?" ).arg( actionPreset->text() ),
QMessageBox::Yes | QMessageBox::No, QMessageBox::No );
if ( res != QMessageBox::Yes )
return;
//remove the selected preset
QgsProject::instance()->mapThemeCollection()->removeMapTheme( actionPreset->text() );
break;
}
}

0 comments on commit ecde835

Please sign in to comment.
You can’t perform that action at this time.