QGIS API Documentation 3.41.0-Master (45a0abf3bec)
|
Base class for feedback objects to be used for cancellation of something running in a worker thread. More...
#include <qgsfeedback.h>
Public Slots | |
void | cancel () |
Tells the internal routines that the current operation should be canceled. This should be run by the main thread. | |
Signals | |
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 | |
QgsFeedback (QObject *parent=nullptr) | |
Construct a feedback object. | |
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. | |
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.
Definition at line 43 of file qgsfeedback.h.
|
inline |
Construct a feedback object.
Definition at line 48 of file qgsfeedback.h.
|
inlineslot |
Tells the internal routines that the current operation should be canceled. This should be run by the main thread.
Definition at line 105 of file qgsfeedback.h.
|
signal |
Internal routines can connect to this signal if they use event loop.
|
inline |
Tells whether the operation has been canceled already.
Definition at line 53 of file qgsfeedback.h.
|
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.
Definition at line 87 of file qgsfeedback.h.
|
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.
|
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.
Definition at line 77 of file qgsfeedback.h.
|
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.
|
inline |
Sets the current processed objects count for the feedback object.
The processedCount argument is an unsigned long integer and starts from 0.
Definition at line 96 of file qgsfeedback.h.
|
inline |
Sets the current progress for the feedback object.
The progress argument is in percentage and valid values range from 0-100.
Definition at line 61 of file qgsfeedback.h.