Skip to content
Permalink
Browse files

allow setting visiblity of selected layers (fixes #10835)

  • Loading branch information
jef-n committed Oct 15, 2014
1 parent d1e23a6 commit c90d810ce3efe4f5cb738a426f910ef2cb5bf5e1
Binary file not shown.
Binary file not shown.
@@ -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;
@@ -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()
{
@@ -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
@@ -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(); }
@@ -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();
@@ -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() ) );
@@ -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;
@@ -17,7 +17,7 @@
<x>0</x>
<y>0</y>
<width>1050</width>
<height>20</height>
<height>18</height>
</rect>
</property>
<widget class="QMenu" name="mProjectMenu">
@@ -178,6 +178,8 @@
<addaction name="separator"/>
<addaction name="mActionShowAllLayers"/>
<addaction name="mActionHideAllLayers"/>
<addaction name="mActionShowSelectedLayers"/>
<addaction name="mActionHideSelectedLayers"/>
</widget>
<widget class="QMenu" name="mPluginMenu">
<property name="title">
@@ -2242,6 +2244,24 @@ Acts on currently active editable layer</string>
<string>Set Scale Visibility of Layer(s)</string>
</property>
</action>
<action name="mActionShowSelectedLayers">
<property name="icon">
<iconset resource="../../images/images.qrc">
<normaloff>:/images/themes/default/mActionShowAllLayers.png</normaloff>:/images/themes/default/mActionShowSelectedLayers.png</iconset>
</property>
<property name="text">
<string>Show Selected Layers</string>
</property>
</action>
<action name="mActionHideSelectedLayers">
<property name="icon">
<iconset resource="../../images/images.qrc">
<normaloff>:/images/themes/default/mActionHideAllLayers.png</normaloff>:/images/themes/default/mActionHideSelectedLayers.png</iconset>
</property>
<property name="text">
<string>Hide Selected Layers</string>
</property>
</action>
</widget>
<resources>
<include location="../../images/images.qrc"/>

0 comments on commit c90d810

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