mirror of
https://github.com/qgis/QGIS.git
synced 2025-03-01 00:46:20 -05:00
Merge pull request #5661 from DelazJ/patch-3
Ask confirmation before removing a map theme
This commit is contained in:
commit
283220351b
@ -156,11 +156,15 @@ 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 )
|
||||
QgsProject::instance()->mapThemeCollection()->removeMapTheme( actionPreset->text() );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user