QGIS API Documentation 4.1.0-Master (31622b25bb0)
Loading...
Searching...
No Matches
QgsProcessingFeedback Class Reference

Base class for providing feedback from a processing algorithm. More...

#include <qgsprocessingfeedback.h>

Inheritance diagram for QgsProcessingFeedback:

Signals

void commandInfoPushed (const QString &text)
 Emitted when command information text is pushed.
void consoleInfoPushed (const QString &text)
 Emitted when console information text is pushed.
void debugInfoPushed (const QString &text)
 Emitted when debug information text is pushed.
void errorReported (const QString &text, bool fatalError)
 Emitted when an error is reported.
void formattedMessagePushed (const QString &html)
 Emitted when a formatted html message is pushed.
void infoPushed (const QString &text)
 Emitted when information text is pushed.
void progressTextChanged (const QString &text)
 Emitted when the progress text is changed.
void sinkFeatureCountChanged (const QString &output, long long featureCount)
 Emitted when the count of features pushed to a sink has changed.
void sourceLoaded (const QString &parameterName, long long featureCount)
 Emitted when a feature source was retrieved for the specified algorithm input parameter.
void warningPushed (const QString &text)
 Emitted when an warning is pushed.
Signals inherited from QgsFeedback
void canceled ()
 Internal routines can connect to this signal if they use event loop.
void processedCountChanged (unsigned long long processedCount)
 Emitted when the feedback object reports a change in the number of processed objects.
void progressChanged (double progress)
 Emitted when the feedback object reports a progress change.

Public Member Functions

 QgsProcessingFeedback (bool logFeedback=true)
 Constructor for QgsProcessingFeedback.
void featureAddedToSink (const QString &output)
 Reports that a feature was added to the the sink associated with the specified algorithm output.
void featureSinkFinalized (const QString &output)
 Reports that a feature sink has been finalized.
virtual QString htmlLog () const
 Returns the HTML formatted contents of the log, which contains all messages pushed to the feedback object.
virtual void pushCommandInfo (const QString &info)
 Pushes an informational message containing a command from the algorithm.
virtual void pushConsoleInfo (const QString &info)
 Pushes a console feedback message from the algorithm.
virtual void pushDebugInfo (const QString &info)
 Pushes an informational message containing debugging helpers from the algorithm.
virtual void pushFormattedMessage (const QString &html, const QString &text)
 Pushes a pre-formatted message from the algorithm.
void pushFormattedResults (const QgsProcessingAlgorithm *algorithm, QgsProcessingContext &context, const QVariantMap &results)
 Pushes a summary of the execution results to the log.
virtual void pushInfo (const QString &info)
 Pushes a general informational message from the algorithm.
void pushVersionInfo (const QgsProcessingProvider *provider=nullptr)
 Pushes a summary of the QGIS (and underlying library) version information to the log.
virtual void pushWarning (const QString &warning)
 Pushes a warning informational message from the algorithm.
virtual void reportError (const QString &error, bool fatalError=false)
 Reports that the algorithm encountered an error while executing.
void reportSourceLoaded (const QString &parameterName, long long featureCount)
 Reports that a feature source was retrieved for the specified algorithm input parameter.
void resetFeatureSinkCounts ()
 Resets all stored feature sink counts.
virtual void setProgressText (const QString &text)
 Sets a progress report text string.
virtual QString textLog () const
 Returns the plain text contents of the log, which contains all messages pushed to the feedback object.
Public Member Functions inherited from QgsFeedback
 QgsFeedback (QObject *parent=nullptr)
 Construct a feedback object.
 ~QgsFeedback () override
bool isCanceled () const
 Tells whether the operation has been canceled already.
unsigned long long processedCount () const
 Returns the current processed objects count reported by the feedback object.
double progress () const
 Returns the current progress reported by the feedback object.
void setProcessedCount (unsigned long long processedCount)
 Sets the current processed objects count for the feedback object.
void setProgress (double progress)
 Sets the current progress for the feedback object.

Additional Inherited Members

Public Slots inherited from QgsFeedback
void cancel ()
 Tells the internal routines that the current operation should be canceled. This should be run by the main thread.
Static Public Member Functions inherited from QgsFeedback
static std::unique_ptr< QgsFeedbackcreateScaledFeedback (QgsFeedback *parentFeedback, double startPercentage, double endPercentage)
 Returns a feedback object whose [0, 100] progression range will be mapped to parentFeedback [startPercentage, endPercentage].

Detailed Description

Base class for providing feedback from a processing algorithm.

This base class implementation silently ignores all feedback reported by algorithms. Subclasses of QgsProcessingFeedback can be used to log this feedback or report it to users via the GUI.

Definition at line 39 of file qgsprocessingfeedback.h.

Constructor & Destructor Documentation

◆ QgsProcessingFeedback()

QgsProcessingFeedback::QgsProcessingFeedback ( bool logFeedback = true)

Constructor for QgsProcessingFeedback.

If logFeedback is true, then all feedback received will be directed to QgsMessageLog.

Definition at line 46 of file qgsprocessingfeedback.cpp.

Member Function Documentation

◆ commandInfoPushed

void QgsProcessingFeedback::commandInfoPushed ( const QString & text)
signal

Emitted when command information text is pushed.

See also
pushCommandInfo()
Since
QGIS 4.2

◆ consoleInfoPushed

void QgsProcessingFeedback::consoleInfoPushed ( const QString & text)
signal

Emitted when console information text is pushed.

See also
pushConsoleInfo()
Since
QGIS 4.2

◆ debugInfoPushed

void QgsProcessingFeedback::debugInfoPushed ( const QString & text)
signal

Emitted when debug information text is pushed.

See also
pushDebugInfo()
Since
QGIS 4.2

◆ errorReported

void QgsProcessingFeedback::errorReported ( const QString & text,
bool fatalError )
signal

Emitted when an error is reported.

See also
reportError()
Since
QGIS 4.2

◆ featureAddedToSink()

void QgsProcessingFeedback::featureAddedToSink ( const QString & output)

Reports that a feature was added to the the sink associated with the specified algorithm output.

See also
sinkFeatureCountChanged()
featureSinkFinalized()
Since
QGIS 4.2

Definition at line 232 of file qgsprocessingfeedback.cpp.

◆ featureSinkFinalized()

void QgsProcessingFeedback::featureSinkFinalized ( const QString & output)

Reports that a feature sink has been finalized.

The output argument specifies the associated algorithm output name.

This will cause an immediate emission of sinkFeatureCountChanged() signal with the final sink size, even if it is zero.

See also
featureAddedToSink()
sinkFeatureCountChanged()
Since
QGIS 4.2

Definition at line 256 of file qgsprocessingfeedback.cpp.

◆ formattedMessagePushed

void QgsProcessingFeedback::formattedMessagePushed ( const QString & html)
signal

Emitted when a formatted html message is pushed.

See also
pushFormattedMessage()
Since
QGIS 4.2

◆ htmlLog()

QString QgsProcessingFeedback::htmlLog ( ) const
virtual

Returns the HTML formatted contents of the log, which contains all messages pushed to the feedback object.

See also
textLog()
Since
QGIS 3.14

Reimplemented in QgsProcessingMultiStepFeedback.

Definition at line 217 of file qgsprocessingfeedback.cpp.

◆ infoPushed

void QgsProcessingFeedback::infoPushed ( const QString & text)
signal

Emitted when information text is pushed.

See also
pushInfo()
Since
QGIS 4.2

◆ progressTextChanged

void QgsProcessingFeedback::progressTextChanged ( const QString & text)
signal

Emitted when the progress text is changed.

See also
setProgressText()
Since
QGIS 4.2

◆ pushCommandInfo()

void QgsProcessingFeedback::pushCommandInfo ( const QString & info)
virtual

Pushes an informational message containing a command from the algorithm.

This is usually used to report commands which are executed in an external application or as subprocesses.

See also
commandInfoPushed()
pushWarning()
pushInfo()
pushDebugInfo()
pushConsoleInfo()

Reimplemented in QgsProcessingMultiStepFeedback.

Definition at line 119 of file qgsprocessingfeedback.cpp.

◆ pushConsoleInfo()

void QgsProcessingFeedback::pushConsoleInfo ( const QString & info)
virtual

Pushes a console feedback message from the algorithm.

This is used to report the output from executing an external command or subprocess.

See also
consoleInfoPushed()
pushWarning()
pushInfo()
pushDebugInfo()
pushCommandInfo()

Reimplemented in QgsProcessingMultiStepFeedback.

Definition at line 139 of file qgsprocessingfeedback.cpp.

◆ pushDebugInfo()

void QgsProcessingFeedback::pushDebugInfo ( const QString & info)
virtual

Pushes an informational message containing debugging helpers from the algorithm.

See also
debugInfoPushed()
pushWarning()
pushInfo()
pushCommandInfo()
pushConsoleInfo()

Reimplemented in QgsProcessingMultiStepFeedback.

Definition at line 129 of file qgsprocessingfeedback.cpp.

◆ pushFormattedMessage()

void QgsProcessingFeedback::pushFormattedMessage ( const QString & html,
const QString & text )
virtual

Pushes a pre-formatted message from the algorithm.

This can be used to push formatted HTML messages to the feedback object. A plain text version of the message must also be specified.

See also
formattedMessagePushed()
pushInfo()
pushWarning()
pushCommandInfo()
pushDebugInfo()
pushConsoleInfo()
Since
QGIS 3.36

Reimplemented in QgsProcessingMultiStepFeedback.

Definition at line 108 of file qgsprocessingfeedback.cpp.

◆ pushFormattedResults()

void QgsProcessingFeedback::pushFormattedResults ( const QgsProcessingAlgorithm * algorithm,
QgsProcessingContext & context,
const QVariantMap & results )

Pushes a summary of the execution results to the log.

Since
QGIS 3.36

Definition at line 190 of file qgsprocessingfeedback.cpp.

◆ pushInfo()

void QgsProcessingFeedback::pushInfo ( const QString & info)
virtual

Pushes a general informational message from the algorithm.

This can be used to report feedback which is neither a status report or an error, such as "Found 47 matching features".

See also
infoPushed()
pushFormattedMessage()
pushWarning()
pushCommandInfo()
pushDebugInfo()
pushConsoleInfo()

Reimplemented in QgsProcessingMultiStepFeedback.

Definition at line 97 of file qgsprocessingfeedback.cpp.

◆ pushVersionInfo()

void QgsProcessingFeedback::pushVersionInfo ( const QgsProcessingProvider * provider = nullptr)

Pushes a summary of the QGIS (and underlying library) version information to the log.

Since
QGIS 3.4.7

Definition at line 149 of file qgsprocessingfeedback.cpp.

◆ pushWarning()

void QgsProcessingFeedback::pushWarning ( const QString & warning)
virtual

Pushes a warning informational message from the algorithm.

This should only be used sparsely as to maintain the importance of visual queues associated to this type of message.

See also
warningPushed()
pushInfo()
pushCommandInfo()
pushDebugInfo()
pushConsoleInfo()
Since
QGIS 3.16.2

Reimplemented in QgsProcessingMultiStepFeedback.

Definition at line 87 of file qgsprocessingfeedback.cpp.

◆ reportError()

void QgsProcessingFeedback::reportError ( const QString & error,
bool fatalError = false )
virtual

Reports that the algorithm encountered an error while executing.

If fatalError is true then the error prevented the algorithm from executing.

See also
errorReported()

Reimplemented in QgsProcessingBatchFeedback, and QgsProcessingMultiStepFeedback.

Definition at line 77 of file qgsprocessingfeedback.cpp.

◆ reportSourceLoaded()

void QgsProcessingFeedback::reportSourceLoaded ( const QString & parameterName,
long long featureCount )

Reports that a feature source was retrieved for the specified algorithm input parameter.

See also
sourceLoaded()
Since
QGIS 4.2

Definition at line 227 of file qgsprocessingfeedback.cpp.

◆ resetFeatureSinkCounts()

void QgsProcessingFeedback::resetFeatureSinkCounts ( )

Resets all stored feature sink counts.

Since
QGIS 4.2

Definition at line 273 of file qgsprocessingfeedback.cpp.

◆ setProgressText()

void QgsProcessingFeedback::setProgressText ( const QString & text)
virtual

Sets a progress report text string.

This can be used in conjunction with setProgress() to provide detailed progress reports, such as "Transformed 4 of 5 layers".

See also
setProgress()
progressTextChanged()

Reimplemented in QgsProcessingMultiStepFeedback.

Definition at line 50 of file qgsprocessingfeedback.cpp.

◆ sinkFeatureCountChanged

void QgsProcessingFeedback::sinkFeatureCountChanged ( const QString & output,
long long featureCount )
signal

Emitted when the count of features pushed to a sink has changed.

The output argument specifies the associated algorithm output name.

Note
For performance, this signal is not emitted for every individual feature added to the sink. It is instead emitted only once for every 100 features added.
See also
featureAddedToSink()
featureSinkFinalized()
Since
QGIS 4.2

◆ sourceLoaded

void QgsProcessingFeedback::sourceLoaded ( const QString & parameterName,
long long featureCount )
signal

Emitted when a feature source was retrieved for the specified algorithm input parameter.

See also
reportSourceLoaded()
Since
QGIS 4.2

◆ textLog()

QString QgsProcessingFeedback::textLog ( ) const
virtual

Returns the plain text contents of the log, which contains all messages pushed to the feedback object.

See also
htmlLog()
Since
QGIS 3.14

Reimplemented in QgsProcessingMultiStepFeedback.

Definition at line 222 of file qgsprocessingfeedback.cpp.

◆ warningPushed

void QgsProcessingFeedback::warningPushed ( const QString & text)
signal

Emitted when an warning is pushed.

See also
pushWarning()
Since
QGIS 4.2

The documentation for this class was generated from the following files: