![]() |
itom
|
This class can be passed to a long running method (e.g. as QSharedPointer instance) for two reasons: More...
#include <functionCancellationAndObserver.h>
Public Types | |
| enum | CancellationReason { ReasonGeneral = 1 , ReasonKeyboardInterrupt = 2 } |
Signals | |
| void | progressTextChanged (QString text) |
| void | progressValueChanged (int value) |
| void | cancellationRequested () |
| void | resetDone () |
Public Member Functions | |
| FunctionCancellationAndObserver (int progressMinimum=0, int progressMaximum=100, QObject *parent=NULL) | |
| constructor | |
| virtual | ~FunctionCancellationAndObserver () |
| destructor (do not call directly, instead free the semaphore by ItomSharedSemaphore::deleteSemaphore | |
| bool | isCancelled () const |
| return true if a cancellation request has been signalled. Else false. | |
| CancellationReason | cancellationReason () |
| return the cancellation reason (call this only if isCancelled returned true) | |
| int | progressMinimum () const |
| returns the minimum progress value | |
| int | progressMaximum () const |
| returns the maximum progress value | |
| void | setProgressValue (int value) |
| changes the current value of the progress. | |
| int | progressValue () const |
| returns the current progress value | |
| void | setProgressText (const QString &text) |
| changes the current text of the progress | |
| QString | progressText () |
| returns the current text of the progress | |
Private Member Functions | |
| Q_DECLARE_PRIVATE (FunctionCancellationAndObserver) | |
Private Attributes | |
| QScopedPointer< FunctionCancellationAndObserverPrivate > | d_ptr |
This class can be passed to a long running method (e.g. as QSharedPointer instance) for two reasons:
This method is fully thread-safe such that read and write methods for progress as well as cancellation status can be called from different threads.
| ito::FunctionCancellationAndObserver::FunctionCancellationAndObserver | ( | int | progressMinimum = 0, |
| int | progressMaximum = 100, | ||
| QObject * | parent = NULL ) |
constructor
A new FuncitonCancellationAndObserver object is created.
Pass this object to a function (thread-safe) in order to signal a possible cancellation request and / or to let the function signal its current progress (value and / or text).
The progress should always be reported in the given range [progressMinimum, progressMaximum]
|
private |
self-managed pointer to the private class container (deletes itself if d_ptr is destroyed)