Index: src/app/qgsmaptoolidentify.cpp =================================================================== --- src/app/qgsmaptoolidentify.cpp (revisión: 10966) +++ src/app/qgsmaptoolidentify.cpp (copia de trabajo) @@ -46,6 +46,8 @@ // set cursor QPixmap myIdentifyQPixmap = QPixmap(( const char ** ) identify_cursor ); mCursor = QCursor( myIdentifyQPixmap, 1, 1 ); + + mLayer = 0; // Initialize mLayer, useful in removeLayer SLOT } QgsMapToolIdentify::~QgsMapToolIdentify() @@ -511,3 +513,18 @@ delete ad; mCanvas->refresh(); } + +void QgsMapToolIdentify::removeLayer( QString layerID ) +{ + if ( mLayer ) + { + if ( mLayer->type() == QgsMapLayer::VectorLayer ) + { + if ( mLayer->getLayerID() == layerID ) + { + if ( mResults ) + mResults->done( 0 ); // close the window + } + } + } +} \ No newline at end of file Index: src/app/qgsmaptoolidentify.h =================================================================== --- src/app/qgsmaptoolidentify.h (revisión: 10966) +++ src/app/qgsmaptoolidentify.h (copia de trabajo) @@ -112,6 +112,8 @@ // Let us know when the QgsIdentifyResults dialog box has been closed void resultsDialogGone(); + // Check if the mLayer is removing from canvas to close the results dialog + void removeLayer( QString ); }; Index: src/app/qgisapp.cpp =================================================================== --- src/app/qgisapp.cpp (revisión: 10966) +++ src/app/qgisapp.cpp (copia de trabajo) @@ -1178,7 +1178,7 @@ mEditMenu->addAction( mActionSplitFeatures ); mEditMenu->addAction( mActionMergeFeatures ); mEditMenu->addAction( mActionNodeTool ); - + if ( layout == QDialogButtonBox::GnomeLayout || layout == QDialogButtonBox::MacLayout ) { mActionEditSeparator3 = mEditMenu->addSeparator(); @@ -1660,6 +1660,9 @@ connect( mMapLegend, SIGNAL( currentLayerChanged( QgsMapLayer* ) ), mUndoWidget, SLOT( layerChanged( QgsMapLayer* ) ) ); + // connect map layer registry signal to identify + connect( QgsMapLayerRegistry::instance(), SIGNAL( layerWillBeRemoved( QString ) ), + mMapTools.mIdentify, SLOT( removeLayer( QString ) ) ); //signal when mouse moved over window (coords display in status bar) connect( mMapCanvas, SIGNAL( xyCoordinates( QgsPoint & ) ), this, SLOT( showMouseCoordinate( QgsPoint & ) ) );