add documentation about task abortion

This commit is contained in:
iTrooz 2024-11-28 17:49:35 +01:00
parent dbb88ca7df
commit 6f9be258dc
No known key found for this signature in database
GPG Key ID: 8B83F77667B1BC6A

View File

@ -156,6 +156,7 @@ class Task : public QObject, public QRunnable {
// used by the task caller to start the task // used by the task caller to start the task
virtual void start(); virtual void start();
//! used by external code to ask the task to aborta
virtual bool abort() virtual bool abort()
{ {
if (canAbort()) if (canAbort())
@ -179,6 +180,7 @@ class Task : public QObject, public QRunnable {
protected slots: protected slots:
//! The Task subclass must call this method when the task has succeeded //! The Task subclass must call this method when the task has succeeded
virtual void emitSucceeded(); virtual void emitSucceeded();
//! **The Task subclass** must call this method when the task has succeeded. External code should call abort() instead.
virtual void emitAborted(); virtual void emitAborted();
//! The Task subclass must call this method when the task has failed //! The Task subclass must call this method when the task has failed
virtual void emitFailed(QString reason = ""); virtual void emitFailed(QString reason = "");