diff --git a/images/themes/default/mActionHideSelectedLayers.png b/images/themes/default/mActionHideSelectedLayers.png
new file mode 100644
index 000000000000..d21b3e10122f
Binary files /dev/null and b/images/themes/default/mActionHideSelectedLayers.png differ
diff --git a/images/themes/default/mActionShowSelectedLayers.png b/images/themes/default/mActionShowSelectedLayers.png
new file mode 100644
index 000000000000..f7907633aa64
Binary files /dev/null and b/images/themes/default/mActionShowSelectedLayers.png differ
diff --git a/python/gui/qgisinterface.sip b/python/gui/qgisinterface.sip
index 6a5a0c6327fd..d79328545ac6 100644
--- a/python/gui/qgisinterface.sip
+++ b/python/gui/qgisinterface.sip
@@ -496,6 +496,8 @@ class QgisInterface : QObject
virtual QAction *actionRemoveAllFromOverview() = 0;
virtual QAction *actionHideAllLayers() = 0;
virtual QAction *actionShowAllLayers() = 0;
+ virtual QAction *actionHideSelectedLayers() = 0;
+ virtual QAction *actionShowSelectedLayers() = 0;
// Plugin menu actions
virtual QAction *actionManagePlugins() = 0;
diff --git a/src/app/qgisapp.cpp b/src/app/qgisapp.cpp
index c8c2acb1c65d..db34f265df92 100644
--- a/src/app/qgisapp.cpp
+++ b/src/app/qgisapp.cpp
@@ -1176,6 +1176,8 @@ void QgisApp::createActions()
connect( mActionRemoveAllFromOverview, SIGNAL( triggered() ), this, SLOT( removeAllFromOverview() ) );
connect( mActionShowAllLayers, SIGNAL( triggered() ), this, SLOT( showAllLayers() ) );
connect( mActionHideAllLayers, SIGNAL( triggered() ), this, SLOT( hideAllLayers() ) );
+ connect( mActionShowSelectedLayers, SIGNAL( triggered() ), this, SLOT( showSelectedLayers() ) );
+ connect( mActionHideSelectedLayers, SIGNAL( triggered() ), this, SLOT( hideSelectedLayers() ) );
// Plugin Menu Items
@@ -1876,6 +1878,8 @@ void QgisApp::setTheme( QString theThemeName )
mActionAddAllToOverview->setIcon( QgsApplication::getThemeIcon( "/mActionAddAllToOverview.svg" ) );
mActionHideAllLayers->setIcon( QgsApplication::getThemeIcon( "/mActionHideAllLayers.png" ) );
mActionShowAllLayers->setIcon( QgsApplication::getThemeIcon( "/mActionShowAllLayers.png" ) );
+ mActionHideSelectedLayers->setIcon( QgsApplication::getThemeIcon( "/mActionHideSelectedLayers.png" ) );
+ mActionShowSelectedLayers->setIcon( QgsApplication::getThemeIcon( "/mActionShowSelectedLayers.png" ) );
mActionRemoveAllFromOverview->setIcon( QgsApplication::getThemeIcon( "/mActionRemoveAllFromOverview.svg" ) );
mActionToggleFullScreen->setIcon( QgsApplication::getThemeIcon( "/mActionToggleFullScreen.png" ) );
mActionProjectProperties->setIcon( QgsApplication::getThemeIcon( "/mActionProjectProperties.png" ) );
@@ -4430,6 +4434,35 @@ void QgisApp::showAllLayers()
nodeLayer->setVisible( Qt::Checked );
}
+//reimplements method from base (gui) class
+void QgisApp::hideSelectedLayers()
+{
+ QgsDebugMsg( "hiding selected layers!" );
+
+ foreach ( QgsLayerTreeNode* node, mLayerTreeView->selectedNodes() )
+ {
+ if ( QgsLayerTree::isGroup( node ) )
+ QgsLayerTree::toGroup( node )->setVisible( Qt::Unchecked );
+ else if ( QgsLayerTree::isLayer( node ) )
+ QgsLayerTree::toLayer( node )->setVisible( Qt::Unchecked );
+ }
+}
+
+
+// reimplements method from base (gui) class
+void QgisApp::showSelectedLayers()
+{
+ QgsDebugMsg( "show selected layers!" );
+
+ foreach ( QgsLayerTreeNode* node, mLayerTreeView->selectedNodes() )
+ {
+ if ( QgsLayerTree::isGroup( node ) )
+ QgsLayerTree::toGroup( node )->setVisible( Qt::Checked );
+ else if ( QgsLayerTree::isLayer( node ) )
+ QgsLayerTree::toLayer( node )->setVisible( Qt::Checked );
+ }
+}
+
void QgisApp::zoomIn()
{
diff --git a/src/app/qgisapp.h b/src/app/qgisapp.h
index a53279f1faf6..a62d10b09aa4 100644
--- a/src/app/qgisapp.h
+++ b/src/app/qgisapp.h
@@ -360,6 +360,8 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
QAction *actionRemoveAllFromOverview() { return mActionRemoveAllFromOverview; }
QAction *actionHideAllLayers() { return mActionHideAllLayers; }
QAction *actionShowAllLayers() { return mActionShowAllLayers; }
+ QAction *actionHideSelectedLayers() { return mActionHideSelectedLayers; }
+ QAction *actionShowSelectedLayers() { return mActionShowSelectedLayers; }
QAction *actionManagePlugins() { return mActionManagePlugins; }
QAction *actionPluginListSeparator() { return mActionPluginSeparator1; }
@@ -924,12 +926,10 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
void hideAllLayers();
//reimplements method from base (gui) class
void showAllLayers();
- // TODO: remove exportMapServer declaration once the mapserver export plugin is complete
- // and tested
- /*
- //! Export current view as a mapserver map file
- void exportMapServer();
- */
+ //reimplements method from base (gui) class
+ void hideSelectedLayers();
+ //reimplements method from base (gui) class
+ void showSelectedLayers();
//! Return pointer to the active layer
QgsMapLayer *activeLayer();
//! set the active layer
diff --git a/src/app/qgisappinterface.cpp b/src/app/qgisappinterface.cpp
index b6a7ddd1ca6f..62c0cef2736f 100644
--- a/src/app/qgisappinterface.cpp
+++ b/src/app/qgisappinterface.cpp
@@ -556,6 +556,8 @@ QAction *QgisAppInterface::actionAddAllToOverview() { return qgis->actionAddAllT
QAction *QgisAppInterface::actionRemoveAllFromOverview() { return qgis->actionRemoveAllFromOverview(); }
QAction *QgisAppInterface::actionHideAllLayers() { return qgis->actionHideAllLayers(); }
QAction *QgisAppInterface::actionShowAllLayers() { return qgis->actionShowAllLayers(); }
+QAction *QgisAppInterface::actionHideSelectedLayers() { return qgis->actionHideSelectedLayers(); }
+QAction *QgisAppInterface::actionShowSelectedLayers() { return qgis->actionShowSelectedLayers(); }
//! Plugin menu actions
QAction *QgisAppInterface::actionManagePlugins() { return qgis->actionManagePlugins(); }
diff --git a/src/app/qgisappinterface.h b/src/app/qgisappinterface.h
index d1f599bf7cea..c40c2d28495b 100644
--- a/src/app/qgisappinterface.h
+++ b/src/app/qgisappinterface.h
@@ -417,6 +417,8 @@ class APP_EXPORT QgisAppInterface : public QgisInterface
virtual QAction *actionRemoveAllFromOverview();
virtual QAction *actionHideAllLayers();
virtual QAction *actionShowAllLayers();
+ virtual QAction *actionHideSelectedLayers();
+ virtual QAction *actionShowSelectedLayers();
//! Plugin menu actions
virtual QAction *actionManagePlugins();
diff --git a/src/app/qgsvisibilitypresets.cpp b/src/app/qgsvisibilitypresets.cpp
index 210c0ef1729e..b7f3c64f0148 100644
--- a/src/app/qgsvisibilitypresets.cpp
+++ b/src/app/qgsvisibilitypresets.cpp
@@ -38,6 +38,8 @@ QgsVisibilityPresets::QgsVisibilityPresets()
mMenu->addAction( QgisApp::instance()->actionShowAllLayers() );
mMenu->addAction( QgisApp::instance()->actionHideAllLayers() );
+ mMenu->addAction( QgisApp::instance()->actionShowSelectedLayers() );
+ mMenu->addAction( QgisApp::instance()->actionHideSelectedLayers() );
mMenu->addSeparator();
mMenu->addAction( tr( "Add Preset..." ), this, SLOT( addPreset() ) );
diff --git a/src/gui/qgisinterface.h b/src/gui/qgisinterface.h
index 69950cc07e59..b493b02468fa 100644
--- a/src/gui/qgisinterface.h
+++ b/src/gui/qgisinterface.h
@@ -551,6 +551,8 @@ class GUI_EXPORT QgisInterface : public QObject
virtual QAction *actionRemoveAllFromOverview() = 0;
virtual QAction *actionHideAllLayers() = 0;
virtual QAction *actionShowAllLayers() = 0;
+ virtual QAction *actionHideSelectedLayers() = 0;
+ virtual QAction *actionShowSelectedLayers() = 0;
// Plugin menu actions
virtual QAction *actionManagePlugins() = 0;
diff --git a/src/ui/qgisapp.ui b/src/ui/qgisapp.ui
index 3d25c9f30eb5..1fd726c8f3ff 100644
--- a/src/ui/qgisapp.ui
+++ b/src/ui/qgisapp.ui
@@ -17,7 +17,7 @@
0
0
1050
- 20
+ 18