Skip to content

Commit 5291238

Browse files
author
jef
committed
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
1 parent 030f658 commit 5291238

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/app/qgisapp.cpp

+7-2
Original file line numberDiff line numberDiff line change
@@ -2058,6 +2058,8 @@ void QgisApp::setupConnections()
20582058
// connect legend signals
20592059
connect( mMapLegend, SIGNAL( currentLayerChanged( QgsMapLayer * ) ),
20602060
this, SLOT( activateDeactivateLayerRelatedActions( QgsMapLayer * ) ) );
2061+
connect( mMapLegend, SIGNAL( itemSelectionChanged() ),
2062+
this, SLOT( legendLayerSelectionChanged() ) );
20612063
connect( mMapLegend, SIGNAL( zOrderChanged() ),
20622064
this, SLOT( markDirty() ) );
20632065

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

5840-
void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer* layer )
5842+
void QgisApp::legendLayerSelectionChanged( void )
58415843
{
5842-
mActionRemoveLayer->setEnabled( mMapLegend && mMapLegend->selectedItems().size() > 0 );
5844+
mActionRemoveLayer->setEnabled( mMapLegend && mMapLegend->selectedLayers().size() > 0 );
5845+
}
58435846

5847+
void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer* layer )
5848+
{
58445849
if( !layer )
58455850
{
58465851
mActionSelect->setEnabled( false );

src/app/qgisapp.h

+3
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,9 @@ class QgisApp : public QMainWindow
436436
//! update default action of toolbutton
437437
void toolButtonActionTriggered( QAction * );
438438

439+
//! layer selection changed
440+
void legendLayerSelectionChanged( void );
441+
439442
protected:
440443

441444
//! Handle state changes (WindowTitleChange)

0 commit comments

Comments
 (0)