Skip to content

Commit

Permalink
Applied patch to fix bug #1747. Thanks to gcarrillo!
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk@10978 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Jun 25, 2009
1 parent 4851f20 commit 4823183
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/app/qgisapp.cpp
Expand Up @@ -1662,6 +1662,9 @@ void QgisApp::setupConnections()
connect( mMapLegend, SIGNAL( currentLayerChanged( QgsMapLayer* ) ),
mMapTools.mNodeTool, SLOT( currentLayerChanged( 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 & ) ) );
Expand Down
21 changes: 21 additions & 0 deletions src/app/qgsmaptoolidentify.cpp
Expand Up @@ -46,6 +46,8 @@ QgsMapToolIdentify::QgsMapToolIdentify( QgsMapCanvas* canvas )
// set cursor
QPixmap myIdentifyQPixmap = QPixmap(( const char ** ) identify_cursor );
mCursor = QCursor( myIdentifyQPixmap, 1, 1 );

mLayer = 0; // Initialize mLayer, useful in removeLayer SLOT
}

QgsMapToolIdentify::~QgsMapToolIdentify()
Expand Down Expand Up @@ -511,3 +513,22 @@ void QgsMapToolIdentify::editFeature( QgsFeature &f )
delete ad;
mCanvas->refresh();
}

void QgsMapToolIdentify::removeLayer( QString layerID )
{
if ( mLayer )
{
if ( mLayer->type() == QgsMapLayer::VectorLayer )
{
if ( mLayer->getLayerID() == layerID )
{
if ( mResults )
{
mResults->clear();
delete mRubberBand;
mRubberBand = 0;
}
}
}
}
}
2 changes: 2 additions & 0 deletions src/app/qgsmaptoolidentify.h
Expand Up @@ -112,6 +112,8 @@ class QgsMapToolIdentify : public QgsMapTool
// Let us know when the QgsIdentifyResults dialog box has been closed
void resultsDialogGone();

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

};

Expand Down

0 comments on commit 4823183

Please sign in to comment.