1// Copyright (C) 2024 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4#include "qgraphanimation_p.h"
5#include <private/qgraphanimation_p.h>
6
7/*!
8 \qmltype GraphAnimation
9 \qmlabstract
10 \inqmlmodule QtGraphs
11 \ingroup graphs_qml_2D
12 \brief The GraphAnimation type is the base type for all animations for 2D Qt Graphs series.
13
14 GraphAnimation is based on VariantAnimation and provides an interface for interpolation for child animations.
15 This type is an abstract type and doesn't have any default implementation for interpolation. Its derived types
16 should be used for the respective animations, such as GraphPointAnimation, SplineControlAnimation.
17*/
18
19/*!
20 \qmlproperty GraphAnimation::AnimationState GraphAnimation::animating
21
22 Holds the animation state. One of \l {GraphAnimation::AnimationState}.
23 */
24
25/*!
26 \qmlproperty enumeration GraphAnimation::AnimationState
27
28 Animation states.
29
30 \value Playing
31 Animation is playing.
32 \value Stopped
33 Animation is stopped.
34*/
35
36/*!
37 \qmlproperty enumeration GraphAnimation::GraphAnimationType
38
39 Animation type.
40
41 \value GraphPoint
42 A GraphPointAnimation animation.
43 \value ControlPoint
44 A ControlPointAnimation animation.
45*/
46
47QGraphAnimation::QGraphAnimation(QObject *parent)
48 : QVariantAnimation(parent)
49{
50 connect(sender: this, signal: &QVariantAnimation::valueChanged, context: this, slot: &QGraphAnimation::valueUpdated);
51 connect(sender: this, signal: &QVariantAnimation::finished, context: this, slot: &QGraphAnimation::end);
52}
53
54QGraphAnimation::~QGraphAnimation()
55{
56 stop();
57}
58
59QGraphAnimation::AnimationState QGraphAnimation::animating() const
60{
61 return m_animating;
62}
63
64void QGraphAnimation::setAnimating(AnimationState newAnimating)
65{
66 if (m_animating == newAnimating)
67 return;
68 m_animating = newAnimating;
69 emit animatingChanged();
70}
71

source code of qtgraphs/src/graphs2d/animation/qgraphanimation.cpp