Skip to content

Commit

Permalink
Prevent tasks from spamming progress reports
Browse files Browse the repository at this point in the history
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 8961ac4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/core/qgstaskmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 8961ac4

Please sign in to comment.