[QGIS Commit] r14447 - trunk/qgis/src/app

svn_qgis at osgeo.org svn_qgis at osgeo.org
Fri Oct 29 15:04:12 EDT 2010


Author: jef
Date: 2010-10-29 12:04:12 -0700 (Fri, 29 Oct 2010)
New Revision: 14447

Modified:
   trunk/qgis/src/app/qgisapp.cpp
   trunk/qgis/src/app/qgisapp.h
Log:
layer removal action depends on selected layers and not the current layer

Modified: trunk/qgis/src/app/qgisapp.cpp
===================================================================
--- trunk/qgis/src/app/qgisapp.cpp	2010-10-29 12:38:34 UTC (rev 14446)
+++ trunk/qgis/src/app/qgisapp.cpp	2010-10-29 19:04:12 UTC (rev 14447)
@@ -2058,6 +2058,8 @@
   // 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 @@
   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 );

Modified: trunk/qgis/src/app/qgisapp.h
===================================================================
--- trunk/qgis/src/app/qgisapp.h	2010-10-29 12:38:34 UTC (rev 14446)
+++ trunk/qgis/src/app/qgisapp.h	2010-10-29 19:04:12 UTC (rev 14447)
@@ -436,6 +436,9 @@
     //! update default action of toolbutton
     void toolButtonActionTriggered( QAction * );
 
+    //! layer selection changed
+    void legendLayerSelectionChanged( void );
+
   protected:
 
     //! Handle state changes (WindowTitleChange)



More information about the QGIS-commit mailing list