26 :
QgsTask( tr(
"Executing “%1”" ).arg( algorithm->displayName() ),
QgsTask::CanCancel )
27 , mParameters( parameters )
29 , mFeedback( feedback )
30 , mAlgorithm( algorithm->create() )
35 mFeedback = mOwnedFeedback.get();
37 if ( !mAlgorithm->prepare( mParameters, context, mFeedback ) )
56 mResults = mAlgorithm->runPrepared( mParameters, mContext, mFeedback );
71 QVariantMap ppResults;
74 ppResults = mAlgorithm->postProcess( mContext, mFeedback );
76 emit
executed( result, !ppResults.isEmpty() ? ppResults : mResults );
void setProgress(double progress)
Sets the task's current progress.
Base class for providing feedback from a processing algorithm.
void cancel()
Tells the internal routines that the current operation should be canceled. This should be run by the ...
bool run() override
Performs the task's operation.
bool isCanceled() const
Will return true if task should terminate ASAP.
Abstract base class for processing algorithms.
static void logMessage(const QString &message, const QString &tag=QString(), Qgis::MessageLevel level=Qgis::Warning)
add a message to the instance (and create it if necessary)
QgsProcessingAlgRunnerTask(const QgsProcessingAlgorithm *algorithm, const QVariantMap ¶meters, QgsProcessingContext &context, QgsProcessingFeedback *feedback=nullptr)
Constructor for QgsProcessingAlgRunnerTask.
void progressChanged(double progress)
Emitted when the feedback object reports a progress change.
Abstract base class for long running background tasks.
Custom exception class for processing related exceptions.
void cancel() override
Notifies the task that it should terminate.
virtual void cancel()
Notifies the task that it should terminate.
bool isCanceled() const
Tells whether the operation has been canceled already.
void finished(bool result) override
If the task is managed by a QgsTaskManager, this will be called after the task has finished (whether ...
Contains information about the context in which a processing algorithm is executed.
void executed(bool successful, const QVariantMap &results)
Emitted when the algorithm has finished execution.
virtual void reportError(const QString &error, bool fatalError=false)
Reports that the algorithm encountered an error while executing.