1 | // Copyright (C) 2023 The Qt Company Ltd. |
---|---|
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
3 | |
4 | #ifndef QTIMELINEANIMATIONNODE_P_H |
5 | #define QTIMELINEANIMATIONNODE_P_H |
6 | |
7 | // |
8 | // W A R N I N G |
9 | // ------------- |
10 | // |
11 | // This file is not part of the Qt API. It exists purely as an |
12 | // implementation detail. This header file may change from version to |
13 | // version without notice, or even be removed. |
14 | // |
15 | // We mean it. |
16 | // |
17 | |
18 | #include <QObject> |
19 | #include <QtQml> |
20 | #include <QtQuickTimeline/private/qquicktimeline_p.h> |
21 | #include <QtQuickTimeline/private/qquicktimelineanimation_p.h> |
22 | #include <QtQuickTimelineBlendTrees/private/qblendtreenode_p.h> |
23 | |
24 | QT_BEGIN_NAMESPACE |
25 | |
26 | class Q_QUICKTIMELINEBLENDTREES_EXPORT QTimelineAnimationNode : public QBlendTreeNode |
27 | { |
28 | Q_OBJECT |
29 | Q_PROPERTY(QQuickTimelineAnimation *animation READ animation WRITE setAnimation NOTIFY animationChanged FINAL) |
30 | Q_PROPERTY(QQuickTimeline *timeline READ timeline WRITE setTimeline NOTIFY timelineChanged FINAL) |
31 | Q_PROPERTY(qreal currentFrame READ currentFrame WRITE setCurrentFrame NOTIFY currentFrameChanged FINAL) |
32 | QML_NAMED_ELEMENT(TimelineAnimationNode) |
33 | public: |
34 | explicit QTimelineAnimationNode(QObject *parent = nullptr); |
35 | |
36 | QQuickTimelineAnimation *animation() const; |
37 | void setAnimation(QQuickTimelineAnimation *newAnimation); |
38 | |
39 | QQuickTimeline *timeline() const; |
40 | void setTimeline(QQuickTimeline *newTimeline); |
41 | |
42 | qreal currentFrame() const; |
43 | void setCurrentFrame(qreal newCurrentFrame); |
44 | |
45 | Q_SIGNALS: |
46 | void animationChanged(); |
47 | void timelineChanged(); |
48 | void currentFrameChanged(); |
49 | |
50 | private: |
51 | void updateFrameData(); |
52 | void updateAnimationTarget(); |
53 | QQuickTimelineAnimation *m_animation = nullptr; |
54 | QQuickTimeline *m_timeline = nullptr; |
55 | qreal m_currentFrame = -1.0; |
56 | |
57 | QMetaObject::Connection m_animationDestroyedConnection; |
58 | QMetaObject::Connection m_timelineDestroyedConnection; |
59 | }; |
60 | |
61 | QT_END_NAMESPACE |
62 | |
63 | #endif // QTIMELINEANIMATIONNODE_P_H |
64 |