Skip to content
Permalink
Browse files
fix #4600: also remove invisible layers from layer order list
  • Loading branch information
jef-n committed Dec 3, 2011
1 parent bde0427 commit e2dac54ef8b833a9a484466c296b9b205ce20c8a
Showing with 13 additions and 1 deletion.
  1. +3 −0 src/app/legend/qgslayerorder.cpp
  2. +9 −1 src/app/legend/qgslegend.cpp
  3. +1 −0 src/app/legend/qgslegend.h
@@ -44,6 +44,9 @@ QgsLayerOrder::QgsLayerOrder( QgsLegend *legend, QWidget * parent, const char *n
connect( mLegend, SIGNAL( zOrderChanged() ),
this, SLOT( refreshLayerList() ) );

connect( mLegend, SIGNAL( invisibleLayerRemoved() ),
this, SLOT( refreshLayerList() ) );

connect( mLegend->canvas(), SIGNAL( layersChanged() ),
this, SLOT( refreshLayerList() ) );

@@ -244,6 +244,8 @@ void QgsLegend::removeLayer( QString layerId )
{
QgsDebugMsg( "Entering." );

bool invLayerRemoved = false;

for ( QTreeWidgetItem* theItem = firstItem(); theItem; theItem = nextItem( theItem ) )
{
QgsLegendItem *li = dynamic_cast<QgsLegendItem *>( theItem );
@@ -254,15 +256,21 @@ void QgsLegend::removeLayer( QString layerId )

if ( ll && ll->layer() && ll->layer()->id() == layerId )
{
if( !ll->isVisible() )
{
invLayerRemoved = true;
}
removeItem( ll );
delete ll;
break;
}
}
}

updateMapCanvasLayerSet();
adjustIconSize();

if( invLayerRemoved )
emit invisibleLayerRemoved();
}

void QgsLegend::mousePressEvent( QMouseEvent * e )
@@ -515,6 +515,7 @@ class QgsLegend : public QTreeWidget
void itemMoved( QModelIndex oldIndex, QModelIndex newIndex );

void zOrderChanged();
void invisibleLayerRemoved();

void updateDrawingOrderChecked( bool );
void updateDrawingOrderUnchecked( bool );

0 comments on commit e2dac54

Please sign in to comment.