1 | // Copyright (C) 2016 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 Qt Chart 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 SPLINEANIMATION_P_H |
14 | #define SPLINEANIMATION_P_H |
15 | |
16 | #include <private/xyanimation_p.h> |
17 | #include <QtCharts/private/qchartglobal_p.h> |
18 | #include <QtCore/QPointF> |
19 | |
20 | typedef QPair<QList<QPointF>, QList<QPointF>> SplineVector; |
21 | |
22 | QT_BEGIN_NAMESPACE |
23 | |
24 | class SplineChartItem; |
25 | |
26 | class Q_CHARTS_PRIVATE_EXPORT SplineAnimation : public XYAnimation |
27 | { |
28 | public: |
29 | SplineAnimation(SplineChartItem *item, int duration, QEasingCurve &curve); |
30 | ~SplineAnimation(); |
31 | void setup(const QList<QPointF> &oldPoints, const QList<QPointF> &newPoints, |
32 | const QList<QPointF> &oldContorlPoints, const QList<QPointF> &newControlPoints, |
33 | int index = -1); |
34 | |
35 | protected: |
36 | QVariant interpolated(const QVariant &start, const QVariant &end, qreal progress) const override; |
37 | void updateCurrentValue(const QVariant &value) override; |
38 | void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState) override; |
39 | |
40 | private: |
41 | SplineVector m_oldSpline; |
42 | SplineVector m_newSpline; |
43 | SplineChartItem *m_item; |
44 | bool m_valid; |
45 | }; |
46 | |
47 | QT_END_NAMESPACE |
48 | |
49 | #endif |
50 | |