Skip to content

Commit 485803d

Browse files
committed
Use progress progress task for identify tool progress
1 parent c7845dd commit 485803d

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/app/qgsmaptoolidentifyaction.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
#include "qgsunittypes.h"
3939
#include "qgsstatusbar.h"
4040
#include "qgsactionscoperegistry.h"
41+
#include "qgsproxyprogresstask.h"
4142

4243
#include "qgssettings.h"
4344
#include <QMouseEvent>
@@ -111,7 +112,14 @@ void QgsMapToolIdentifyAction::showAttributeTable( QgsMapLayer *layer, const QLi
111112
void QgsMapToolIdentifyAction::identifyFromGeometry()
112113
{
113114
resultsDialog()->clear();
114-
connect( this, &QgsMapToolIdentifyAction::identifyProgress, QgisApp::instance(), &QgisApp::showProgress );
115+
116+
QgsProxyProgressTask *task = new QgsProxyProgressTask( tr( "Identifying features" ) );
117+
QgsApplication::taskManager()->addTask( task );
118+
119+
connect( this, &QgsMapToolIdentifyAction::identifyProgress, task, [ = ]( int i, int n )
120+
{
121+
task->setProxyProgress( static_cast<double>( i ) * 100.0 / n );
122+
} );
115123
connect( this, &QgsMapToolIdentifyAction::identifyMessage, QgisApp::instance(), &QgisApp::showStatusMessage );
116124

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

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

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

137145
if ( results.isEmpty() )

0 commit comments

Comments
 (0)