[QGIS Commit] r10978 - trunk/qgis/src/app
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Thu Jun 25 10:50:32 EDT 2009
Author: mhugent
Date: 2009-06-25 10:50:31 -0400 (Thu, 25 Jun 2009)
New Revision: 10978
Modified:
trunk/qgis/src/app/qgisapp.cpp
trunk/qgis/src/app/qgsmaptoolidentify.cpp
trunk/qgis/src/app/qgsmaptoolidentify.h
Log:
Applied patch to fix bug #1747. Thanks to gcarrillo!
Modified: trunk/qgis/src/app/qgisapp.cpp
===================================================================
--- trunk/qgis/src/app/qgisapp.cpp 2009-06-25 09:33:10 UTC (rev 10977)
+++ trunk/qgis/src/app/qgisapp.cpp 2009-06-25 14:50:31 UTC (rev 10978)
@@ -1662,6 +1662,9 @@
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 & ) ) );
Modified: trunk/qgis/src/app/qgsmaptoolidentify.cpp
===================================================================
--- trunk/qgis/src/app/qgsmaptoolidentify.cpp 2009-06-25 09:33:10 UTC (rev 10977)
+++ trunk/qgis/src/app/qgsmaptoolidentify.cpp 2009-06-25 14:50:31 UTC (rev 10978)
@@ -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,22 @@
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;
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
Modified: trunk/qgis/src/app/qgsmaptoolidentify.h
===================================================================
--- trunk/qgis/src/app/qgsmaptoolidentify.h 2009-06-25 09:33:10 UTC (rev 10977)
+++ trunk/qgis/src/app/qgsmaptoolidentify.h 2009-06-25 14:50:31 UTC (rev 10978)
@@ -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 clear the results dialog
+ void removeLayer( QString );
};
More information about the QGIS-commit
mailing list