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
qquickanimatednode_p.h
Go to the documentation of this file.
1// Copyright (C) 2017 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 reason:default
4
5#ifndef QQUICKANIMATEDNODE_P_H
6#define QQUICKANIMATEDNODE_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 <QtQuick/qsgnode.h>
21#include <QtCore/qelapsedtimer.h>
22#include <QtQuickControls2Impl/private/qtquickcontrols2implglobal_p.h>
23
24QT_BEGIN_NAMESPACE
25
26class QQuickItem;
27class QQuickWindow;
28
29class Q_QUICKCONTROLS2IMPL_EXPORT QQuickAnimatedNode : public QObject, public QSGTransformNode
30{
31 Q_OBJECT
32
33public:
34 explicit QQuickAnimatedNode(QQuickItem *target);
35
36 bool isRunning() const;
37
38 int currentTime() const;
39 void setCurrentTime(int time);
40
41 int duration() const;
42 void setDuration(int duration);
43
44 enum LoopCount { Infinite = -1 };
45
46 int loopCount() const;
47 void setLoopCount(int count);
48
49 virtual void sync(QQuickItem *target);
50
51 QQuickWindow *window() const;
52
53 // must be called from sync() or updatePaintNode()
54 void start(int duration = 0);
55 void restart();
56 void stop();
57
58Q_SIGNALS:
59 void started();
60 void stopped();
61
62protected:
63 virtual void updateCurrentTime(int time);
64
65private Q_SLOTS:
66 void advance();
67 void update();
68
69private:
70 bool m_running = false;
71 int m_duration = 0;
72 int m_loopCount = 1;
73 int m_currentTime = 0;
74 int m_currentLoop = 0;
75 QElapsedTimer m_timer;
76 QQuickWindow *m_window = nullptr;
77};
78
79QT_END_NAMESPACE
80
81#endif // QQUICKANIMATEDNODE_P_H