Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qqmltimer_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:significant
4
5#ifndef QQMLTIMER_H
6#define QQMLTIMER_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 <private/qtqmlglobal_p.h>
20
21#include <QtQmlMeta/qtqmlmetaexports.h>
22#include <QtQml/qqml.h>
23#include <QtCore/qobject.h>
24
26
27QT_BEGIN_NAMESPACE
28
29class QQmlTimerPrivate;
30class Q_QMLMETA_EXPORT QQmlTimer : public QObject, public QQmlParserStatus
31{
32 Q_OBJECT
33 Q_DECLARE_PRIVATE(QQmlTimer)
34 Q_INTERFACES(QQmlParserStatus)
35 Q_PROPERTY(int interval READ interval WRITE setInterval NOTIFY intervalChanged)
36 Q_PROPERTY(bool running READ isRunning WRITE setRunning NOTIFY runningChanged)
37 Q_PROPERTY(bool repeat READ isRepeating WRITE setRepeating NOTIFY repeatChanged)
38 Q_PROPERTY(bool triggeredOnStart READ triggeredOnStart WRITE setTriggeredOnStart NOTIFY triggeredOnStartChanged)
39 Q_PROPERTY(QObject *parent READ parent CONSTANT)
40 Q_CLASSINFO("ParentProperty", "parent")
41 QML_NAMED_ELEMENT(Timer)
42 QML_ADDED_IN_VERSION(2, 0)
43
44public:
45 QQmlTimer(QObject *parent=nullptr);
46
47 void setInterval(int interval);
48 int interval() const;
49
50 bool isRunning() const;
51 void setRunning(bool running);
52
53 bool isRepeating() const;
54 void setRepeating(bool repeating);
55
56 bool triggeredOnStart() const;
57 void setTriggeredOnStart(bool triggeredOnStart);
58
59protected:
60 void classBegin() override;
61 void componentComplete() override;
62
63 bool event(QEvent *) override;
64
65public Q_SLOTS:
66 void start();
67 void stop();
68 void restart();
69
70Q_SIGNALS:
71 void triggered();
72 void runningChanged();
73 void intervalChanged();
74 void repeatChanged();
75 void triggeredOnStartChanged();
76
77private:
78 void update();
79
80private Q_SLOTS:
81 void ticked();
82};
83
84QT_END_NAMESPACE
85
86#endif
void animationCurrentLoopChanged(QAbstractAnimationJob *) override
Definition qqmltimer.cpp:29
QPauseAnimationJob pause
Definition qqmltimer.cpp:40
const QEvent::Type QEvent_Triggered
Definition qqmltimer.cpp:17
const QEvent::Type QEvent_MaybeTick
Definition qqmltimer.cpp:16
QT_REQUIRE_CONFIG(qml_animation)