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
21QT_BEGIN_NAMESPACE
22
23class 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
31public:
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
52protected:
53 void classBegin() override;
54 void componentComplete() override;
55
56private:
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
65QT_END_NAMESPACE
66
67#endif // QGRAPHTRANSITION_H
68

Provided by KDAB

Privacy Policy
Learn Advanced QML with KDAB
Find out more

source code of qtgraphs/src/graphs2d/animation/qgraphtransition_p.h