Base class for all threads capable of reporting progress and cancelling the progress when requested.
More...
Base class for all threads capable of reporting progress and cancelling the progress when requested.
Task thread can be added to AsyncProgressDialog and associated with a progress widget, which displays its progress. Typically, a thread first sets range using setRange() method, and then sets progress values within this range as it runs using setValue() method. Alternatively, the thread may set a progress text using setText() method.
◆ TaskThread()
APD::TaskThread::TaskThread |
( |
QObject * |
parent = nullptr | ) |
|
|
explicit |
Constructs a task thread with the given parent.
◆ cancel
void APD::TaskThread::cancel |
( |
| ) |
|
|
slot |
Registers cancel request. It is up to thread implementer to check for cancel request using isCanceled() method in reasonable intervals and abort the execution of the thread if this request has been registered.
This method is thread-safe.
◆ isCanceled()
bool APD::TaskThread::isCanceled |
( |
| ) |
const |
Checks for a pending cancel request.
This method is thread-safe.
◆ rangeChanged
void APD::TaskThread::rangeChanged |
( |
int |
minimum, |
|
|
int |
maximum |
|
) |
| |
|
signal |
This signal is emitted when progress range changes.
◆ setRange()
void APD::TaskThread::setRange |
( |
int |
minimum, |
|
|
int |
maximum |
|
) |
| |
Sets minimum and maximum progress values to minimum and maximum respectively. This method can be used from within asynchronous computation. The method should be called before any call to setValue() method.
The method emits rangeChanged() signal.
◆ setText()
void APD::TaskThread::setText |
( |
const QString & |
text | ) |
|
Sets current progress text to text. This method can be used from within asynchronous computation.
The method emits textChanged() signal.
◆ setValue()
void APD::TaskThread::setValue |
( |
int |
value, |
|
|
const QVariant & |
userValue = QVariant() |
|
) |
| |
Sets progress value to value. The value should be inside minimum - maximum range set by previous call to setRange() method. The userValue parameter is a user-defined value passed to the correpsonding ProgresWidget. This method can be used from within asynchronous computation.
The method emits valueChanged() signal.
◆ textChanged
void APD::TaskThread::textChanged |
( |
const QString & |
text | ) |
|
|
signal |
This signal is emitted whenever progress text changes.
◆ valueChanged
void APD::TaskThread::valueChanged |
( |
int |
value, |
|
|
const QVariant & |
userValue, |
|
|
const TimeStamp & |
timeStamp |
|
) |
| |
|
signal |
This signal is emitted whenever progress value changes. Current time stamp is added to this signal. Time step must be acquired within the asynchronous thread in order to avoid possible lags in GUI thread and allow widgets to display time accurately.
The documentation for this class was generated from the following files: