ThreadWeaver

qobjectdecorator.h
1 /* -*- C++ -*-
2  A decorator to make jobs into QObjects in ThreadWeaver.
3 
4  SPDX-FileCopyrightText: 2005-2013 Mirko Boehm <[email protected]>
5 
6  SPDX-License-Identifier: LGPL-2.0-or-later
7 */
8 
9 #ifndef THREADWEAVER_QOBJECTDECORATOR_H
10 #define THREADWEAVER_QOBJECTDECORATOR_H
11 
12 #include <QObject>
13 
14 #include "iddecorator.h"
15 #include "threadweaver_export.h"
16 
17 namespace ThreadWeaver
18 {
19 class Collection;
20 class Sequence;
21 
22 class THREADWEAVER_EXPORT QObjectDecorator : public QObject, public IdDecorator
23 {
24  Q_OBJECT
25 public:
26  explicit QObjectDecorator(JobInterface *decoratee, QObject *parent = nullptr);
27  explicit QObjectDecorator(JobInterface *decoratee, bool autoDelete, QObject *parent = nullptr);
28 
29 Q_SIGNALS:
30  /** This signal is emitted when this job is being processed by a thread. */
31  void started(ThreadWeaver::JobPointer);
32  /** This signal is emitted when the job has been finished (no matter if it succeeded or not). */
33  void done(ThreadWeaver::JobPointer);
34  /** This job has failed.
35  *
36  * This signal is emitted when success() returns false after the job is executed. */
37  void failed(ThreadWeaver::JobPointer);
38 
39 protected:
40  void defaultBegin(const JobPointer &job, Thread *thread) override;
41  void defaultEnd(const JobPointer &job, Thread *thread) override;
42 };
43 
44 typedef QSharedPointer<QObjectDecorator> QJobPointer;
45 
46 }
47 
48 #endif // THREADWEAVER_QOBJECTDECORATOR_H
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Thu Sep 21 2023 04:10:21 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.