mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-18 00:03:05 -04:00
allow setting visiblity of selected layers (fixes #10835)
This commit is contained in:
parent
d1e23a608a
commit
c90d810ce3
BIN
images/themes/default/mActionHideSelectedLayers.png
Normal file
BIN
images/themes/default/mActionHideSelectedLayers.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 805 B |
BIN
images/themes/default/mActionShowSelectedLayers.png
Normal file
BIN
images/themes/default/mActionShowSelectedLayers.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1003 B |
@ -496,6 +496,8 @@ class QgisInterface : QObject
|
|||||||
virtual QAction *actionRemoveAllFromOverview() = 0;
|
virtual QAction *actionRemoveAllFromOverview() = 0;
|
||||||
virtual QAction *actionHideAllLayers() = 0;
|
virtual QAction *actionHideAllLayers() = 0;
|
||||||
virtual QAction *actionShowAllLayers() = 0;
|
virtual QAction *actionShowAllLayers() = 0;
|
||||||
|
virtual QAction *actionHideSelectedLayers() = 0;
|
||||||
|
virtual QAction *actionShowSelectedLayers() = 0;
|
||||||
|
|
||||||
// Plugin menu actions
|
// Plugin menu actions
|
||||||
virtual QAction *actionManagePlugins() = 0;
|
virtual QAction *actionManagePlugins() = 0;
|
||||||
|
@ -1176,6 +1176,8 @@ void QgisApp::createActions()
|
|||||||
connect( mActionRemoveAllFromOverview, SIGNAL( triggered() ), this, SLOT( removeAllFromOverview() ) );
|
connect( mActionRemoveAllFromOverview, SIGNAL( triggered() ), this, SLOT( removeAllFromOverview() ) );
|
||||||
connect( mActionShowAllLayers, SIGNAL( triggered() ), this, SLOT( showAllLayers() ) );
|
connect( mActionShowAllLayers, SIGNAL( triggered() ), this, SLOT( showAllLayers() ) );
|
||||||
connect( mActionHideAllLayers, SIGNAL( triggered() ), this, SLOT( hideAllLayers() ) );
|
connect( mActionHideAllLayers, SIGNAL( triggered() ), this, SLOT( hideAllLayers() ) );
|
||||||
|
connect( mActionShowSelectedLayers, SIGNAL( triggered() ), this, SLOT( showSelectedLayers() ) );
|
||||||
|
connect( mActionHideSelectedLayers, SIGNAL( triggered() ), this, SLOT( hideSelectedLayers() ) );
|
||||||
|
|
||||||
// Plugin Menu Items
|
// Plugin Menu Items
|
||||||
|
|
||||||
@ -1876,6 +1878,8 @@ void QgisApp::setTheme( QString theThemeName )
|
|||||||
mActionAddAllToOverview->setIcon( QgsApplication::getThemeIcon( "/mActionAddAllToOverview.svg" ) );
|
mActionAddAllToOverview->setIcon( QgsApplication::getThemeIcon( "/mActionAddAllToOverview.svg" ) );
|
||||||
mActionHideAllLayers->setIcon( QgsApplication::getThemeIcon( "/mActionHideAllLayers.png" ) );
|
mActionHideAllLayers->setIcon( QgsApplication::getThemeIcon( "/mActionHideAllLayers.png" ) );
|
||||||
mActionShowAllLayers->setIcon( QgsApplication::getThemeIcon( "/mActionShowAllLayers.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" ) );
|
mActionRemoveAllFromOverview->setIcon( QgsApplication::getThemeIcon( "/mActionRemoveAllFromOverview.svg" ) );
|
||||||
mActionToggleFullScreen->setIcon( QgsApplication::getThemeIcon( "/mActionToggleFullScreen.png" ) );
|
mActionToggleFullScreen->setIcon( QgsApplication::getThemeIcon( "/mActionToggleFullScreen.png" ) );
|
||||||
mActionProjectProperties->setIcon( QgsApplication::getThemeIcon( "/mActionProjectProperties.png" ) );
|
mActionProjectProperties->setIcon( QgsApplication::getThemeIcon( "/mActionProjectProperties.png" ) );
|
||||||
@ -4430,6 +4434,35 @@ void QgisApp::showAllLayers()
|
|||||||
nodeLayer->setVisible( Qt::Checked );
|
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()
|
void QgisApp::zoomIn()
|
||||||
{
|
{
|
||||||
|
@ -360,6 +360,8 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
|
|||||||
QAction *actionRemoveAllFromOverview() { return mActionRemoveAllFromOverview; }
|
QAction *actionRemoveAllFromOverview() { return mActionRemoveAllFromOverview; }
|
||||||
QAction *actionHideAllLayers() { return mActionHideAllLayers; }
|
QAction *actionHideAllLayers() { return mActionHideAllLayers; }
|
||||||
QAction *actionShowAllLayers() { return mActionShowAllLayers; }
|
QAction *actionShowAllLayers() { return mActionShowAllLayers; }
|
||||||
|
QAction *actionHideSelectedLayers() { return mActionHideSelectedLayers; }
|
||||||
|
QAction *actionShowSelectedLayers() { return mActionShowSelectedLayers; }
|
||||||
|
|
||||||
QAction *actionManagePlugins() { return mActionManagePlugins; }
|
QAction *actionManagePlugins() { return mActionManagePlugins; }
|
||||||
QAction *actionPluginListSeparator() { return mActionPluginSeparator1; }
|
QAction *actionPluginListSeparator() { return mActionPluginSeparator1; }
|
||||||
@ -924,12 +926,10 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
|
|||||||
void hideAllLayers();
|
void hideAllLayers();
|
||||||
//reimplements method from base (gui) class
|
//reimplements method from base (gui) class
|
||||||
void showAllLayers();
|
void showAllLayers();
|
||||||
// TODO: remove exportMapServer declaration once the mapserver export plugin is complete
|
//reimplements method from base (gui) class
|
||||||
// and tested
|
void hideSelectedLayers();
|
||||||
/*
|
//reimplements method from base (gui) class
|
||||||
//! Export current view as a mapserver map file
|
void showSelectedLayers();
|
||||||
void exportMapServer();
|
|
||||||
*/
|
|
||||||
//! Return pointer to the active layer
|
//! Return pointer to the active layer
|
||||||
QgsMapLayer *activeLayer();
|
QgsMapLayer *activeLayer();
|
||||||
//! set the active layer
|
//! set the active layer
|
||||||
|
@ -556,6 +556,8 @@ QAction *QgisAppInterface::actionAddAllToOverview() { return qgis->actionAddAllT
|
|||||||
QAction *QgisAppInterface::actionRemoveAllFromOverview() { return qgis->actionRemoveAllFromOverview(); }
|
QAction *QgisAppInterface::actionRemoveAllFromOverview() { return qgis->actionRemoveAllFromOverview(); }
|
||||||
QAction *QgisAppInterface::actionHideAllLayers() { return qgis->actionHideAllLayers(); }
|
QAction *QgisAppInterface::actionHideAllLayers() { return qgis->actionHideAllLayers(); }
|
||||||
QAction *QgisAppInterface::actionShowAllLayers() { return qgis->actionShowAllLayers(); }
|
QAction *QgisAppInterface::actionShowAllLayers() { return qgis->actionShowAllLayers(); }
|
||||||
|
QAction *QgisAppInterface::actionHideSelectedLayers() { return qgis->actionHideSelectedLayers(); }
|
||||||
|
QAction *QgisAppInterface::actionShowSelectedLayers() { return qgis->actionShowSelectedLayers(); }
|
||||||
|
|
||||||
//! Plugin menu actions
|
//! Plugin menu actions
|
||||||
QAction *QgisAppInterface::actionManagePlugins() { return qgis->actionManagePlugins(); }
|
QAction *QgisAppInterface::actionManagePlugins() { return qgis->actionManagePlugins(); }
|
||||||
|
@ -417,6 +417,8 @@ class APP_EXPORT QgisAppInterface : public QgisInterface
|
|||||||
virtual QAction *actionRemoveAllFromOverview();
|
virtual QAction *actionRemoveAllFromOverview();
|
||||||
virtual QAction *actionHideAllLayers();
|
virtual QAction *actionHideAllLayers();
|
||||||
virtual QAction *actionShowAllLayers();
|
virtual QAction *actionShowAllLayers();
|
||||||
|
virtual QAction *actionHideSelectedLayers();
|
||||||
|
virtual QAction *actionShowSelectedLayers();
|
||||||
|
|
||||||
//! Plugin menu actions
|
//! Plugin menu actions
|
||||||
virtual QAction *actionManagePlugins();
|
virtual QAction *actionManagePlugins();
|
||||||
|
@ -38,6 +38,8 @@ QgsVisibilityPresets::QgsVisibilityPresets()
|
|||||||
|
|
||||||
mMenu->addAction( QgisApp::instance()->actionShowAllLayers() );
|
mMenu->addAction( QgisApp::instance()->actionShowAllLayers() );
|
||||||
mMenu->addAction( QgisApp::instance()->actionHideAllLayers() );
|
mMenu->addAction( QgisApp::instance()->actionHideAllLayers() );
|
||||||
|
mMenu->addAction( QgisApp::instance()->actionShowSelectedLayers() );
|
||||||
|
mMenu->addAction( QgisApp::instance()->actionHideSelectedLayers() );
|
||||||
mMenu->addSeparator();
|
mMenu->addSeparator();
|
||||||
|
|
||||||
mMenu->addAction( tr( "Add Preset..." ), this, SLOT( addPreset() ) );
|
mMenu->addAction( tr( "Add Preset..." ), this, SLOT( addPreset() ) );
|
||||||
|
@ -551,6 +551,8 @@ class GUI_EXPORT QgisInterface : public QObject
|
|||||||
virtual QAction *actionRemoveAllFromOverview() = 0;
|
virtual QAction *actionRemoveAllFromOverview() = 0;
|
||||||
virtual QAction *actionHideAllLayers() = 0;
|
virtual QAction *actionHideAllLayers() = 0;
|
||||||
virtual QAction *actionShowAllLayers() = 0;
|
virtual QAction *actionShowAllLayers() = 0;
|
||||||
|
virtual QAction *actionHideSelectedLayers() = 0;
|
||||||
|
virtual QAction *actionShowSelectedLayers() = 0;
|
||||||
|
|
||||||
// Plugin menu actions
|
// Plugin menu actions
|
||||||
virtual QAction *actionManagePlugins() = 0;
|
virtual QAction *actionManagePlugins() = 0;
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>1050</width>
|
<width>1050</width>
|
||||||
<height>20</height>
|
<height>18</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QMenu" name="mProjectMenu">
|
<widget class="QMenu" name="mProjectMenu">
|
||||||
@ -178,6 +178,8 @@
|
|||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
<addaction name="mActionShowAllLayers"/>
|
<addaction name="mActionShowAllLayers"/>
|
||||||
<addaction name="mActionHideAllLayers"/>
|
<addaction name="mActionHideAllLayers"/>
|
||||||
|
<addaction name="mActionShowSelectedLayers"/>
|
||||||
|
<addaction name="mActionHideSelectedLayers"/>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QMenu" name="mPluginMenu">
|
<widget class="QMenu" name="mPluginMenu">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
@ -2242,6 +2244,24 @@ Acts on currently active editable layer</string>
|
|||||||
<string>Set Scale Visibility of Layer(s)</string>
|
<string>Set Scale Visibility of Layer(s)</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</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>
|
</widget>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="../../images/images.qrc"/>
|
<include location="../../images/images.qrc"/>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user