ThreadWeaver

qobjectdecorator.h
1/* -*- C++ -*-
2 A decorator to make jobs into QObjects in ThreadWeaver.
3
4 SPDX-FileCopyrightText: 2005-2013 Mirko Boehm <mirko@kde.org>
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
17namespace ThreadWeaver
18{
19class Collection;
20class Sequence;
21
22class THREADWEAVER_EXPORT QObjectDecorator : public QObject, public IdDecorator
23{
24 Q_OBJECT
25public:
26 explicit QObjectDecorator(JobInterface *decoratee, QObject *parent = nullptr);
27 explicit QObjectDecorator(JobInterface *decoratee, bool autoDelete, QObject *parent = nullptr);
28
29Q_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
39protected:
40 void defaultBegin(const JobPointer &job, Thread *thread) override;
41 void defaultEnd(const JobPointer &job, Thread *thread) override;
42};
43
44typedef QSharedPointer<QObjectDecorator> QJobPointer;
45
46}
47
48#endif // THREADWEAVER_QOBJECTDECORATOR_H
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 8 2024 11:58:32 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.