[QGIS Commit] r12033 - trunk/qgis/src/app
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Sun Nov 8 14:50:24 EST 2009
Author: jef
Date: 2009-11-08 14:50:24 -0500 (Sun, 08 Nov 2009)
New Revision: 12033
Modified:
trunk/qgis/src/app/qgsmaptoolidentify.cpp
trunk/qgis/src/app/qgsmaptoolidentify.h
Log:
cleaner handling of identify results
Modified: trunk/qgis/src/app/qgsmaptoolidentify.cpp
===================================================================
--- trunk/qgis/src/app/qgsmaptoolidentify.cpp 2009-11-08 19:47:20 UTC (rev 12032)
+++ trunk/qgis/src/app/qgsmaptoolidentify.cpp 2009-11-08 19:50:24 UTC (rev 12033)
@@ -45,8 +45,6 @@
// set cursor
QPixmap myIdentifyQPixmap = QPixmap(( const char ** ) identify_cursor );
mCursor = QCursor( myIdentifyQPixmap, 1, 1 );
-
- mResults = new QgsIdentifyResults( canvas, mCanvas->window() );
}
QgsMapToolIdentify::~QgsMapToolIdentify()
@@ -57,6 +55,14 @@
}
}
+QgsIdentifyResults *QgsMapToolIdentify::results()
+{
+ if ( !mResults )
+ mResults = new QgsIdentifyResults( mCanvas, mCanvas->window() );
+
+ return mResults;
+}
+
void QgsMapToolIdentify::canvasMoveEvent( QMouseEvent * e )
{
}
@@ -72,11 +78,7 @@
return;
}
- if ( !mResults )
- {
- mResults = new QgsIdentifyResults( mCanvas, mCanvas->window() );
- }
- mResults->clear();
+ results()->clear();
QSettings settings;
int identifyMode = settings.value( "/Map/identifyMode", 0 ).toInt();
@@ -139,8 +141,8 @@
if ( res )
{
- mResults->show();
- mResults->raise();
+ results()->show();
+ results()->raise();
}
else
{
@@ -148,11 +150,11 @@
bool myDockFlag = mySettings.value( "/qgis/dockIdentifyResults", false ).toBool();
if ( !myDockFlag )
{
- mResults->hide();
+ results()->hide();
}
else
{
- mResults->clear();
+ results()->clear();
}
QMessageBox::information( 0, tr( "Identify results" ), tr( "No features at this position found." ) );
}
@@ -160,17 +162,13 @@
void QgsMapToolIdentify::activate()
{
- if ( !mResults )
- {
- mResults = new QgsIdentifyResults( mCanvas, mCanvas->window() );
- }
- mResults->activate();
+ results()->activate();
QgsMapTool::activate();
}
void QgsMapToolIdentify::deactivate()
{
- mResults->deactivate();
+ results()->deactivate();
QgsMapTool::deactivate();
}
@@ -327,7 +325,7 @@
derivedAttributes.insert( tr( "feature id" ), fid < 0 ? tr( "new feature" ) : QString::number( fid ) );
- mResults->addFeature( layer, fid, displayField, displayValue, attributes, derivedAttributes );
+ results()->addFeature( layer, fid, displayField, displayValue, attributes, derivedAttributes );
}
QgsDebugMsg( "Feature count on identify: " + QString::number( featureCount ) );
@@ -388,18 +386,13 @@
if ( res )
{
derivedAttributes.insert( tr( "(clicked coordinate)" ), idPoint.toString() );
- mResults->addFeature( layer, -1, type, "", attributes, derivedAttributes );
+ results()->addFeature( layer, -1, type, "", attributes, derivedAttributes );
}
return res;
}
-void QgsMapToolIdentify::resultsDialogGone()
-{
- mResults = 0;
-}
-
void QgsMapToolIdentify::convertMeasurement( QgsDistanceArea &calc, double &measure, QGis::UnitType &u, bool isArea )
{
// Helper for converting between meters and feet
Modified: trunk/qgis/src/app/qgsmaptoolidentify.h
===================================================================
--- trunk/qgis/src/app/qgsmaptoolidentify.h 2009-11-08 19:47:20 UTC (rev 12032)
+++ trunk/qgis/src/app/qgsmaptoolidentify.h 2009-11-08 19:50:24 UTC (rev 12033)
@@ -82,9 +82,7 @@
const QMap< QString, QString > &attributes,
const QMap< QString, QString > &derivedAttributes );
- private slots:
- // Let us know when the QgsIdentifyResults dialog box has been closed
- void resultsDialogGone();
+ QgsIdentifyResults *results();
};
#endif
More information about the QGIS-commit
mailing list