Skip to content
Permalink
Browse files

Use progress progress task for identify tool progress

  • Loading branch information
nyalldawson committed Aug 20, 2018
1 parent c7845dd commit 485803d819dabaf953138213eff623f5e1ebc037
Showing with 10 additions and 2 deletions.
  1. +10 −2 src/app/qgsmaptoolidentifyaction.cpp
@@ -38,6 +38,7 @@
#include "qgsunittypes.h"
#include "qgsstatusbar.h"
#include "qgsactionscoperegistry.h"
#include "qgsproxyprogresstask.h"

#include "qgssettings.h"
#include <QMouseEvent>
@@ -111,7 +112,14 @@ void QgsMapToolIdentifyAction::showAttributeTable( QgsMapLayer *layer, const QLi
void QgsMapToolIdentifyAction::identifyFromGeometry()
{
resultsDialog()->clear();
connect( this, &QgsMapToolIdentifyAction::identifyProgress, QgisApp::instance(), &QgisApp::showProgress );

QgsProxyProgressTask *task = new QgsProxyProgressTask( tr( "Identifying features" ) );
QgsApplication::taskManager()->addTask( task );

connect( this, &QgsMapToolIdentifyAction::identifyProgress, task, [ = ]( int i, int n )
{
task->setProxyProgress( static_cast<double>( i ) * 100.0 / n );
} );
connect( this, &QgsMapToolIdentifyAction::identifyMessage, QgisApp::instance(), &QgisApp::showStatusMessage );

QgsGeometry geometry = mSelectionHandler->selectedGeometry();
@@ -131,7 +139,7 @@ void QgsMapToolIdentifyAction::identifyFromGeometry()

QList<IdentifyResult> results = QgsMapToolIdentify::identify( geometry, mode, AllLayers );

disconnect( this, &QgsMapToolIdentifyAction::identifyProgress, QgisApp::instance(), &QgisApp::showProgress );
task->finalize( true );
disconnect( this, &QgsMapToolIdentifyAction::identifyMessage, QgisApp::instance(), &QgisApp::showStatusMessage );

if ( results.isEmpty() )

0 comments on commit 485803d

Please sign in to comment.
You can’t perform that action at this time.