Skip to content
Permalink
Browse files

Prevent tasks from spamming progress reports

Doing so grinds the QGIS to a halt, yet often progress
reports are being sent every feature (which results
in thousands of 0.00001 progress increment reports
for large layers!!)
  • Loading branch information
nyalldawson committed May 1, 2018
1 parent 350200d commit 8961ac447eefe17b7d16991fd52166db8ac8fc4c
Showing with 4 additions and 1 deletion.
  1. +4 −1 src/core/qgstaskmanager.cpp
@@ -212,8 +212,11 @@ void QgsTask::setProgress( double progress )
progress = ( progress + totalProgress ) / ( mSubTasks.count() + 1 );
}

// avoid flooding with too many events
if ( static_cast< int >( mTotalProgress * 10 ) != static_cast< int >( progress * 10 ) )
emit progressChanged( progress );

mTotalProgress = progress;
emit progressChanged( mTotalProgress );
}

void QgsTask::completed()

0 comments on commit 8961ac4

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