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 XYANIMATION_P_H |
14 | #define XYANIMATION_P_H |
15 | |
16 | #include <private/chartanimation_p.h> |
17 | #include <QtCharts/private/qchartglobal_p.h> |
18 | #include <QtCore/QPointF> |
19 | |
20 | QT_BEGIN_NAMESPACE |
21 | |
22 | class XYChart; |
23 | |
24 | class Q_CHARTS_PRIVATE_EXPORT XYAnimation : public ChartAnimation |
25 | { |
26 | protected: |
27 | enum Animation { AddPointAnimation, RemovePointAnimation, ReplacePointAnimation, NewAnimation }; |
28 | public: |
29 | XYAnimation(XYChart *item, int duration, QEasingCurve &curve); |
30 | ~XYAnimation(); |
31 | void setup(const QList<QPointF> &oldPoints, const QList<QPointF> &newPoints, int index = -1); |
32 | Animation animationType() const { return m_type; }; |
33 | |
34 | protected: |
35 | QVariant interpolated(const QVariant &start, const QVariant &end, qreal progress) const override; |
36 | void updateCurrentValue(const QVariant &value) override; |
37 | void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState) override; |
38 | XYChart *chartItem() { return m_item; } |
39 | protected: |
40 | Animation m_type; |
41 | bool m_dirty; |
42 | int m_index; |
43 | private: |
44 | XYChart *m_item; |
45 | QList<QPointF> m_oldPoints; |
46 | QList<QPointF> m_newPoints; |
47 | }; |
48 | |
49 | QT_END_NAMESPACE |
50 | |
51 | #endif |
52 | |