Skip to content
Permalink
Browse files

layer removal action depends on selected layers and not the current l…

…ayer

git-svn-id: http://svn.osgeo.org/qgis/trunk@14447 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef
jef committed Oct 29, 2010
1 parent 030f658 commit 5291238ded9b407ef8ff14b058bba0b85e907cc7
Showing with 10 additions and 2 deletions.
  1. +7 −2 src/app/qgisapp.cpp
  2. +3 −0 src/app/qgisapp.h
@@ -2058,6 +2058,8 @@ void QgisApp::setupConnections()
// connect legend signals
connect( mMapLegend, SIGNAL( currentLayerChanged( QgsMapLayer * ) ),
this, SLOT( activateDeactivateLayerRelatedActions( QgsMapLayer * ) ) );
connect( mMapLegend, SIGNAL( itemSelectionChanged() ),
this, SLOT( legendLayerSelectionChanged() ) );
connect( mMapLegend, SIGNAL( zOrderChanged() ),
this, SLOT( markDirty() ) );

@@ -5837,10 +5839,13 @@ void QgisApp::selectionChanged( QgsMapLayer *layer )
activateDeactivateLayerRelatedActions( layer );
}

void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer* layer )
void QgisApp::legendLayerSelectionChanged( void )
{
mActionRemoveLayer->setEnabled( mMapLegend && mMapLegend->selectedItems().size() > 0 );
mActionRemoveLayer->setEnabled( mMapLegend && mMapLegend->selectedLayers().size() > 0 );
}

void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer* layer )
{
if( !layer )
{
mActionSelect->setEnabled( false );
@@ -436,6 +436,9 @@ class QgisApp : public QMainWindow
//! update default action of toolbutton
void toolButtonActionTriggered( QAction * );

//! layer selection changed
void legendLayerSelectionChanged( void );

protected:

//! Handle state changes (WindowTitleChange)

0 comments on commit 5291238

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