1// Copyright (C) 2022 The Qt Company Ltd.
2// Copyright (C) 2016 Intel Corporation.
3// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
4
5#ifndef QSINGLESHOTTIMER_P_H
6#define QSINGLESHOTTIMER_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <QtCore/qobject.h>
20#include <QtCore/qabstracteventdispatcher.h>
21#include <QtCore/qnamespace.h>
22
23QT_BEGIN_NAMESPACE
24
25namespace QtPrivate {
26class QSlotObjectBase;
27}
28
29class QSingleShotTimer : public QObject
30{
31 Q_OBJECT
32
33 Qt::TimerId timerId = Qt::TimerId::Invalid;
34
35public:
36 // use the same duration type
37 using Duration = QAbstractEventDispatcher::Duration;
38
39 explicit QSingleShotTimer(Duration interval, Qt::TimerType timerType,
40 const QObject *r, const char *member);
41 explicit QSingleShotTimer(Duration interval, Qt::TimerType timerType,
42 const QObject *r, QtPrivate::QSlotObjectBase *slotObj);
43 ~QSingleShotTimer() override;
44
45 void startTimerForReceiver(Duration interval, Qt::TimerType timerType,
46 const QObject *receiver);
47Q_SIGNALS:
48 void timeout();
49
50private:
51 void timerEvent(QTimerEvent *) override;
52};
53
54QT_END_NAMESPACE
55
56#endif // QSINGLESHOTTIMER_P_H
57

Provided by KDAB

Privacy Policy
Learn Advanced QML with KDAB
Find out more

source code of qtbase/src/corelib/kernel/qsingleshottimer_p.h