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

git-svn-id: http://svn.osgeo.org/qgis/trunk@14447 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
jef 2010-10-29 19:04:12 +00:00
parent 030f658ccd
commit 5291238ded
2 changed files with 10 additions and 2 deletions

View File

@ -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::legendLayerSelectionChanged( void )
{
mActionRemoveLayer->setEnabled( mMapLegend && mMapLegend->selectedLayers().size() > 0 );
}
void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer* layer )
{
mActionRemoveLayer->setEnabled( mMapLegend && mMapLegend->selectedItems().size() > 0 );
if( !layer )
{
mActionSelect->setEnabled( false );

View File

@ -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)