1 | // Copyright (C) 2024 The Qt Company Ltd. |
---|---|
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
3 | |
4 | // W A R N I N G |
5 | // ------------- |
6 | // |
7 | // This file is not part of the QtGraphs API. It exists purely as an |
8 | // implementation detail. This header file may change from version to |
9 | // version without notice, or even be removed. |
10 | // |
11 | // We mean it. |
12 | |
13 | #ifndef QGRAPHTRANSITION_H |
14 | #define QGRAPHTRANSITION_H |
15 | |
16 | #include <QObject> |
17 | #include <QParallelAnimationGroup> |
18 | #include <QQmlEngine> |
19 | #include <private/qgraphanimation_p.h> |
20 | |
21 | QT_BEGIN_NAMESPACE |
22 | |
23 | class QGraphTransition : public QObject, public QQmlParserStatus |
24 | { |
25 | Q_OBJECT |
26 | Q_INTERFACES(QQmlParserStatus) |
27 | Q_PROPERTY(QQmlListProperty<QObject> animations READ animations CONSTANT) |
28 | Q_CLASSINFO("DefaultProperty", "animations") |
29 | QML_NAMED_ELEMENT(GraphTransition) |
30 | |
31 | public: |
32 | enum class TransitionType { |
33 | None, |
34 | PointAdded, |
35 | PointReplaced, |
36 | PointRemoved, |
37 | }; |
38 | |
39 | Q_ENUM(TransitionType); |
40 | |
41 | QGraphTransition(QObject *parent = nullptr); |
42 | ~QGraphTransition() override; |
43 | QQmlListProperty<QObject> animations(); |
44 | |
45 | void onPointChanged(TransitionType type, int index, QPointF point); |
46 | void initialize(); |
47 | void stop(); |
48 | |
49 | bool initialized(); |
50 | bool contains(QGraphAnimation::GraphAnimationType type); |
51 | |
52 | protected: |
53 | void classBegin() override; |
54 | void componentComplete() override; |
55 | |
56 | private: |
57 | QList<QGraphAnimation *> m_animations; |
58 | QParallelAnimationGroup m_animationGroup; |
59 | bool m_initialized; |
60 | |
61 | static void append(QQmlListProperty<QObject> *, QObject *); |
62 | static void clear(QQmlListProperty<QObject> *); |
63 | }; |
64 | |
65 | QT_END_NAMESPACE |
66 | |
67 | #endif // QGRAPHTRANSITION_H |
68 |