QGIS API Documentation 3.30.0-'s-Hertogenbosch (f186b8efe0)
Public Slots | Signals | Public Member Functions | List of all members
QgsFeedback Class Reference

Base class for feedback objects to be used for cancellation of something running in a worker thread. More...

#include <qgsfeedback.h>

Inheritance diagram for QgsFeedback:
Inheritance graph
[legend]

Public Slots

void cancel ()
 Tells the internal routines that the current operation should be canceled. This should be run by the main thread. More...
 

Signals

void canceled ()
 Internal routines can connect to this signal if they use event loop. More...
 
void processedCountChanged (unsigned long long processedCount)
 Emitted when the feedback object reports a change in the number of processed objects. More...
 
void progressChanged (double progress)
 Emitted when the feedback object reports a progress change. More...
 

Public Member Functions

 QgsFeedback (QObject *parent=nullptr)
 Construct a feedback object. More...
 
bool isCanceled () const SIP_HOLDGIL
 Tells whether the operation has been canceled already. More...
 
unsigned long long processedCount () const SIP_HOLDGIL
 Returns the current processed objects count reported by the feedback object. More...
 
double progress () const SIP_HOLDGIL
 Returns the current progress reported by the feedback object. More...
 
void setProcessedCount (unsigned long long processedCount)
 Sets the current processed objects count for the feedback object. More...
 
void setProgress (double progress)
 Sets the current progress for the feedback object. More...
 

Detailed Description

Base class for feedback objects to be used for cancellation of something running in a worker thread.

The class may be used as is or it may be subclassed for extended functionality for a particular operation (e.g. report progress or pass some data for preview).

When cancel() is called, the internal code has two options to check for cancellation state:

The class is meant to be created and destroyed in the main thread.

For map rendering, the object may be created in constructor of a QgsMapLayerRenderer subclass and available with QgsMapLayerRenderer::feedback() method. When a map rendering job gets canceled, the cancel() method is called on the feedback object of all layers.

Since
QGIS 3.0

Definition at line 44 of file qgsfeedback.h.

Constructor & Destructor Documentation

◆ QgsFeedback()

QgsFeedback::QgsFeedback ( QObject *  parent = nullptr)
inline

Construct a feedback object.

Definition at line 49 of file qgsfeedback.h.

Member Function Documentation

◆ cancel

void QgsFeedback::cancel ( )
inlineslot

Tells the internal routines that the current operation should be canceled. This should be run by the main thread.

Definition at line 108 of file qgsfeedback.h.

◆ canceled

void QgsFeedback::canceled ( )
signal

Internal routines can connect to this signal if they use event loop.

◆ isCanceled()

bool QgsFeedback::isCanceled ( ) const
inline

Tells whether the operation has been canceled already.

Definition at line 54 of file qgsfeedback.h.

◆ processedCount()

unsigned long long QgsFeedback::processedCount ( ) const
inline

Returns the current processed objects count reported by the feedback object.

Depending on how the feedback object is used processed count reporting may not be supported. The returned value is an unsigned long integer and starts from 0.

See also
setProcessedCount()
processedCountChanged()
Since
QGIS 3.24

Definition at line 90 of file qgsfeedback.h.

◆ processedCountChanged

void QgsFeedback::processedCountChanged ( unsigned long long  processedCount)
signal

Emitted when the feedback object reports a change in the number of processed objects.

Depending on how the feedback object is used processed count reporting may not be supported. The processedCount argument is an unsigned long integer and starts from 0.

See also
setProgress()
progress()
Since
QGIS 3.24

◆ progress()

double QgsFeedback::progress ( ) const
inline

Returns the current progress reported by the feedback object.

Depending on how the feedback object is used progress reporting may not be supported. The returned value is in percentage and ranges from 0-100.

See also
setProgress()
progressChanged()
Since
QGIS 3.0

Definition at line 80 of file qgsfeedback.h.

◆ progressChanged

void QgsFeedback::progressChanged ( double  progress)
signal

Emitted when the feedback object reports a progress change.

Depending on how the feedback object is used progress reporting may not be supported. The progress argument is in percentage and ranges from 0-100.

See also
setProgress()
progress()
Since
QGIS 3.0

◆ setProcessedCount()

void QgsFeedback::setProcessedCount ( unsigned long long  processedCount)
inline

Sets the current processed objects count for the feedback object.

The processedCount argument is an unsigned long integer and starts from 0.

See also
processedCount()
processedCountChanged()
Since
QGIS 3.24

Definition at line 99 of file qgsfeedback.h.

◆ setProgress()

void QgsFeedback::setProgress ( double  progress)
inline

Sets the current progress for the feedback object.

The progress argument is in percentage and valid values range from 0-100.

See also
progress()
progressChanged()
Since
QGIS 3.0

Definition at line 63 of file qgsfeedback.h.


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