Skip to content

Commit 8715172

Browse files
author
mhugent
committed
Applied patch to fix bug #1747. Thanks to gcarrillo!
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@10978 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent f498aad commit 8715172

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

src/app/qgisapp.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -1662,6 +1662,9 @@ void QgisApp::setupConnections()
16621662
connect( mMapLegend, SIGNAL( currentLayerChanged( QgsMapLayer* ) ),
16631663
mMapTools.mNodeTool, SLOT( currentLayerChanged( QgsMapLayer* ) ) );
16641664

1665+
// connect map layer registry signal to identify
1666+
connect( QgsMapLayerRegistry::instance(), SIGNAL( layerWillBeRemoved( QString ) ),
1667+
mMapTools.mIdentify, SLOT( removeLayer( QString ) ) );
16651668

16661669
//signal when mouse moved over window (coords display in status bar)
16671670
connect( mMapCanvas, SIGNAL( xyCoordinates( QgsPoint & ) ), this, SLOT( showMouseCoordinate( QgsPoint & ) ) );

src/app/qgsmaptoolidentify.cpp

+21
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ QgsMapToolIdentify::QgsMapToolIdentify( QgsMapCanvas* canvas )
4646
// set cursor
4747
QPixmap myIdentifyQPixmap = QPixmap(( const char ** ) identify_cursor );
4848
mCursor = QCursor( myIdentifyQPixmap, 1, 1 );
49+
50+
mLayer = 0; // Initialize mLayer, useful in removeLayer SLOT
4951
}
5052

5153
QgsMapToolIdentify::~QgsMapToolIdentify()
@@ -511,3 +513,22 @@ void QgsMapToolIdentify::editFeature( QgsFeature &f )
511513
delete ad;
512514
mCanvas->refresh();
513515
}
516+
517+
void QgsMapToolIdentify::removeLayer( QString layerID )
518+
{
519+
if ( mLayer )
520+
{
521+
if ( mLayer->type() == QgsMapLayer::VectorLayer )
522+
{
523+
if ( mLayer->getLayerID() == layerID )
524+
{
525+
if ( mResults )
526+
{
527+
mResults->clear();
528+
delete mRubberBand;
529+
mRubberBand = 0;
530+
}
531+
}
532+
}
533+
}
534+
}

src/app/qgsmaptoolidentify.h

+2
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ class QgsMapToolIdentify : public QgsMapTool
112112
// Let us know when the QgsIdentifyResults dialog box has been closed
113113
void resultsDialogGone();
114114

115+
// Check if the mLayer is removing from canvas to clear the results dialog
116+
void removeLayer( QString );
115117

116118
};
117119

0 commit comments

Comments
 (0)