Skip to content
Permalink
Browse files

Disable Add Preset menu if current style is already a preset

Prevents duplicate entries which have unexpected behaviour
  • Loading branch information
nyalldawson committed Aug 20, 2015
1 parent d2282a7 commit 415aa83bf0d6697da60843e221bd72912859e87f
Showing with 3 additions and 1 deletion.
  1. +2 −1 src/app/qgsvisibilitypresets.cpp
  2. +1 −0 src/app/qgsvisibilitypresets.h
@@ -44,7 +44,7 @@ QgsVisibilityPresets::QgsVisibilityPresets()
mMenu->addAction( QgisApp::instance()->actionHideSelectedLayers() );
mMenu->addSeparator();

mMenu->addAction( tr( "Add Preset..." ), this, SLOT( addPreset() ) );
mActionAddPreset = mMenu->addAction( tr( "Add Preset..." ), this, SLOT( addPreset() ) );
mMenuSeparator = mMenu->addSeparator();

mActionRemoveCurrentPreset = mMenu->addAction( tr( "Remove Current Preset" ), this, SLOT( removeCurrentPreset() ) );
@@ -263,5 +263,6 @@ void QgsVisibilityPresets::menuAboutToShow()
}
mMenu->insertActions( mMenuSeparator, mMenuPresetActions );

mActionAddPreset->setEnabled( !hasCurrent );
mActionRemoveCurrentPreset->setEnabled( hasCurrent );
}
@@ -87,6 +87,7 @@ class APP_EXPORT QgsVisibilityPresets : public QObject

QMenu* mMenu;
QAction* mMenuSeparator;
QAction* mActionAddPreset;
QAction* mActionRemoveCurrentPreset;
QList<QAction*> mMenuPresetActions;
};

0 comments on commit 415aa83

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